Skip to content

Commit

Permalink
Merge pull request #11 from ubopod/test-env
Browse files Browse the repository at this point in the history
Test env
  • Loading branch information
sassanh authored Mar 26, 2024
2 parents ccc3b46 + 2b88edf commit 5f20684
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
path: artifacts

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
tag_name: v${{ needs.build.outputs.version }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## Version 0.7.2

- fix: revert numpy data structure storing display data to uint16 as 2 bytes are
used per pixel

## Version 0.7.1

- fix: don't interact with window system when running headless for tests

## Version 0.7.0

- feat: render relevant parts of the screen only
Expand Down
7 changes: 4 additions & 3 deletions headless_kivy_pi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ def setup_headless_kivy(config: SetupHeadlessConfig) -> None:
{BITS_PER_BYTE}))"""
raise ValueError(msg)

from kivy.metrics import dp

if is_test_environment():
Config.set('graphics', 'window_state', 'hidden')
from kivy.core.window import Window

from kivy.metrics import dp

if IS_RPI:
_display = Fake()
elif IS_RPI:
Config.set('graphics', 'window_state', 'hidden')
# Configuration for CS and DC pins (these are PiTFT defaults):
cs_pin = digitalio.DigitalInOut(board.CE0)
Expand Down
3 changes: 2 additions & 1 deletion headless_kivy_pi/display.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement `transfer_to_display` function."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand All @@ -24,7 +25,7 @@ def transfer_to_display(
logger.debug(f'Rendering frame with hash "{data_hash}"')

# Flip the image vertically
data = data.reshape(rectangle[2], rectangle[3], -1)[::-1, :, :3].astype(np.uint8)
data = data.reshape(rectangle[2], rectangle[3], -1)[::-1, :, :3].astype(np.uint16)

color = (
((data[:, :, 0] & 0xF8) << 8)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "headless-kivy-pi"
version = "0.7.0"
version = "0.7.2"
description = "Headless renderer for Kivy framework on Raspberry Pi"
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 5f20684

Please sign in to comment.