Skip to content

Commit

Permalink
fix(camera): render the viewfinder on the display even if the display…
Browse files Browse the repository at this point in the history
… is paused - closes #78
  • Loading branch information
sassanh committed Jul 19, 2024
1 parent 7cf660c commit f5f0913
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- feat(notifications): add `progress` and `progress_weight` properties to `Notification` object and show the progress on the header of the app
- feat(core): show the progress of the update using the new `progress` property of the `Notification` object
- fix(camera): render the viewfinder on the display even if the display is paused - closes #78

## Version 0.15.4

Expand Down
4 changes: 3 additions & 1 deletion ubo_app/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ def block(
self: _State,
rectangle: tuple[int, int, int, int],
data_bytes: bytes,
*,
bypass_pause: bool = False,
) -> None:
"""Block the display."""
if self.is_running:
if self.is_running or bypass_pause:
self.display._block(*rectangle, data_bytes) # noqa: SLF001


Expand Down
9 changes: 5 additions & 4 deletions ubo_app/services/040-camera/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ def feed_viewfinder(picamera2: Picamera2 | None) -> None:
),
)

if not display:
return

data = resize_image(data, new_size=(width, height))
data = np.rot90(data, 2)

Expand Down Expand Up @@ -170,7 +167,11 @@ def feed_viewfinder(picamera2: Picamera2 | None) -> None:
np.dstack(((color >> 8) & 0xFF, color & 0xFF)).flatten().tolist(),
)

display.state.block((0, 0, width - 1, height - 1), data_bytes)
display.state.block(
(0, 0, width - 1, height - 1),
data_bytes,
bypass_pause=True,
)


@mainthread
Expand Down

0 comments on commit f5f0913

Please sign in to comment.