Skip to content

Commit

Permalink
fix: pass raw bytes to DisplayRenderEvent and `DisplayCompressedRen…
Browse files Browse the repository at this point in the history
…derEvent` to avoid encoding issues
  • Loading branch information
sassanh committed Jan 4, 2025
1 parent ab526fe commit d650308
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 204 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- feat(docker): add instructions and icon for docker compositions
- refactor(core): rerender screen when rendering on the display is resumed like when returning from viewfinder to avoid artifacts
- refactor(docker): make composition menus responsive: showing spinner, etc
- fix: pass raw bytes to `DisplayRenderEvent` and `DisplayCompressedRenderEvent` to avoid encoding issues

## Version 1.1.0

Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name = "ubo-app"
dynamic = ["version"]
description = "Ubo main app, running on device initialization. A platform for running other apps."
license = { text = "Apache-2.0" }
authors = [{ name = "Sassan Haradji", email = "[email protected]" }]
maintainers = [{ name = "Sassan Haradji", email = "[email protected]" }]
readme = "README.md"
requires-python = ">=3.11"
keywords = ['ubo', 'ubo-pod', 'raspberry pi', 'rpi', 'home assistance']
Expand Down Expand Up @@ -92,10 +94,6 @@ bootstrap = "ubo_app.bootstrap:main"
ubo-system = "ubo_app.system.system_manager.main:main"


[[project.authors]]
name = "Sassan Haradji"
email = "[email protected]"

[tool.poe.tasks]
lint = "ruff check ."
"lint:fix" = "ruff check . --fix --unsafe-fixes"
Expand Down
2 changes: 1 addition & 1 deletion setup_scm_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ def local_scheme(version) -> str: # noqa: ANN001
original_local_version = get_local_node_and_date(version)
if not original_local_version:
return original_local_version
numeric_version = original_local_version.replace('+', '').replace('.d', '')[:12]
numeric_version = original_local_version.replace('+', '').replace('.d', '')[:11]
return datetime.now(UTC).strftime('%y%m%d') + numeric_version
9 changes: 3 additions & 6 deletions ubo_app/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@
display = cast(ST7789, Fake())


def render_on_display(
*,
regions: list[Region],
) -> None:
def render_on_display(*, regions: list[Region]) -> None:
"""Transfer data to the display via SPI controller."""
for region in regions:
rectangle = region['rectangle']
Expand All @@ -75,11 +72,11 @@ def render_on_display(
store._dispatch( # noqa: SLF001
[
DisplayRenderEvent(
data=data.tobytes(),
data=region['data'].tobytes(),
rectangle=rectangle,
),
DisplayCompressedRenderEvent(
compressed_data=compressor.compress(data.tobytes())
compressed_data=compressor.compress(region['data'].tobytes())
+ compressor.flush(),
rectangle=rectangle,
),
Expand Down
Loading

0 comments on commit d650308

Please sign in to comment.