pi: GPIO-controlled theme switch

- apt dependencies (RPI.GPIO somehow needs to be installed from apt to work & re-establish uv venv with --system-site-packages
- GPIO 20 triggers mode switching (can link to a photodiode or just switch)
This commit is contained in:
Mikkeli Matlock
2026-02-04 11:13:07 +09:00
parent 64ce2472ab
commit 4a830dde91
6 changed files with 154 additions and 45 deletions

View File

@@ -129,11 +129,9 @@ def handle_emergency(data):
def on_arduino_data(data):
"""Called by ArduinoService when new telemetry arrives."""
# Check for GPIO state changes to piggyback on this emit
theme_change = gpio.get_theme_switch_change()
if theme_change is not None:
data = dict(data) # Don't mutate original
data["theme_switch"] = theme_change
# Always include current GPIO state (UI dedupes)
data = dict(data) # Don't mutate original
data["theme_switch"] = gpio.theme_switch
def emit_fn(d):
socketio.emit("arduino", d)