Add Pico dashboard app controller

This commit is contained in:
2026-06-03 02:53:12 -06:00
parent 521ae0f75a
commit 95b27b223e
2 changed files with 85 additions and 0 deletions
+39
View File
@@ -778,3 +778,42 @@ def test_dashboard_renderer_creates_draw_commands():
assert ("text", 0, 128, "Fridge", 1) in display.commands
assert ("text", 0, 232, "Power", 1) in display.commands
assert ("text", 0, 440, "[Dash]", 1) in display.commands
def test_pico_dashboard_app_tick_updates_alarms_and_buzzer():
from app import PicoDashboardApp
from comms.uart_client import UartClient
from comms.communication_service import CommunicationService
from hardware.display import Display
from hardware.buzzer import Buzzer
from ui.renderers import DashboardRenderer
from ui.touch_router import TouchRouter
fake_uart = FakeUart()
fake_uart.read_chunks = [
b'{"type":"status_response","battery":{"soc":10,"voltage":11.8},"temps":{"fridge_zone_1":45.0},"sensor_health":{"fridge_zone_1":true,"fridge_zone_2":true,"rear_seat":true,"outside":true},"network":{"uart_connected":true}}\n'
]
state = AppState()
comms = CommunicationService(UartClient(fake_uart), state)
screens = ScreenManager()
display = Display()
buzzer = Buzzer()
app = PicoDashboardApp(
app_state=state,
communication_service=comms,
screen_manager=screens,
touch_router=TouchRouter(screens),
display=display,
dashboard_renderer=DashboardRenderer(display),
buzzer=buzzer,
)
app.tick()
assert "battery_soc_low" in app.alarms
assert "battery_voltage_low" in app.alarms
assert "fridge_zone_1_high" in app.alarms
assert buzzer.enabled is True
assert display.commands