From dde4736cc27b539d5919b3f6907194afbcd37d4c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 11 Nov 2026 22:24:29 +0000 Subject: [PATCH] feat(display): add air quality pages, history and display settings --- AGENTS.md | 26 +- eez/nanopsx.eez-project | 1991 ++++++++++++++++- firmware/HARDWARE.md | 63 + firmware/components/eez_gui/CMakeLists.txt | 3 + firmware/components/eez_gui/screens.c | 1059 ++++++--- firmware/components/eez_gui/screens.h | 104 +- firmware/components/eez_gui/ui_dashboard.c | 204 ++ firmware/components/eez_gui/ui_dashboard.h | 23 + firmware/components/eez_gui/ui_model.c | 65 + firmware/components/eez_gui/ui_model.h | 23 + firmware/components/eez_gui/ui_navigation.c | 47 + firmware/components/eez_gui/ui_navigation.h | 4 + .../components/net_influx/src/net_influx.c | 1 + firmware/components/sen5x/CMakeLists.txt | 1 + firmware/components/sen5x/air_sensor_app.c | 29 +- firmware/components/sys_status/CMakeLists.txt | 2 +- .../sys_status/include/sys_status.h | 5 + .../components/sys_status/src/sys_status.c | 19 + firmware/platformio.ini | 2 +- firmware/src/main.c | 115 +- firmware/test/ui/run_tests.py | 23 + firmware/test/ui/test_navigation.c | 175 ++ firmware/tools/export_display.py | 123 + firmware/tools/pio_display.py | 8 + 24 files changed, 3634 insertions(+), 481 deletions(-) create mode 100644 firmware/components/eez_gui/ui_dashboard.c create mode 100644 firmware/components/eez_gui/ui_dashboard.h create mode 100644 firmware/components/eez_gui/ui_model.c create mode 100644 firmware/components/eez_gui/ui_model.h create mode 100644 firmware/components/eez_gui/ui_navigation.c create mode 100644 firmware/components/eez_gui/ui_navigation.h create mode 100644 firmware/test/ui/run_tests.py create mode 100644 firmware/test/ui/test_navigation.c create mode 100644 firmware/tools/export_display.py create mode 100644 firmware/tools/pio_display.py diff --git a/AGENTS.md b/AGENTS.md index e580a7a..2f2929e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -62,7 +62,7 @@ Die `write`-Funktion erhält die Firmwaredatei über stdin. Die erwartete Dateig Das PlatformIO-Projekt liegt unter `firmware/`. Das aktuelle Environment `esp32-c6-devkitc-1` ist für ESP32-C6 mit **8 MB Flash** konfiguriert. Diesen Build nicht auf das bekannte 4-MB-Board übertragen. Die aktive SDK-Konfiguration ist `firmware/sdkconfig.esp32-c6-devkitc-1`; Defaults stehen in `firmware/sdkconfig.defaults`, die Partitionstabelle in `firmware/partitions.csv`. -Sensor und Peripherieprofil werden zentral in `firmware/components/hardware_config/hardware_config.h` gewählt. Unterstützte Sensoren: SEN54 und SEN66; vorhandene Profile: ESP32-C6 mit Display (Touch auf Hardware-I²C GPIO18/19) und ESP32-C6 ohne Display (Hardware-I²C GPIO7/8), jeweils 8 MB. SEN54 nutzt den Hardware-Bus des Profils. SEN66 bleibt immer auf GPIO7/8 und verwendet beim Display-Profil einen separaten Software-I²C-Bus; ohne Display verwendet er den Hardware-Controller. Die aktuelle Standardauswahl ist SEN66 mit Display. Die Software-I²C-Implementierung hat ACK/NACK-, Clock-Stretching- und Timeout-Tests; keine weiteren Sensorgeräte ohne Prüfung auf diesem Bus hinzufügen. Auswahl und Verdrahtung vor jedem Build prüfen; nicht vom angeschlossenen Port oder einer früheren Auswahl ableiten. Die Auswahl ersetzt keine Prüfung von PlatformIO-Chip, Flash-Größe und Partitionstabelle. Anleitung und Tests: `firmware/HARDWARE.md`. Der SEN66 verwendet den gepinnten offiziellen Sensirion-Treiber; Herkunft und Lizenz sind in `firmware/components/sen5x/SENSIRION-UPSTREAM.md` dokumentiert. Die gemeinsame Sensoranwendung heißt `air_sensor_app`; SEN66 ergänzt das Influx-Feld `co2`, SEN54 darf keine künstlichen CO₂-Werte erzeugen. Die Displayansicht bleibt auf Benutzerwunsch exakt die bisherige SEN54-Ansicht mit Schriftzug, PM, Temperatur, Feuchte, VOC und Statussymbolen. NOx und CO₂ vorerst nur für InfluxDB verarbeiten; keine zusätzlichen Displayfelder ohne neuen Auftrag hinzufügen. +Sensor und Peripherieprofil werden zentral in `firmware/components/hardware_config/hardware_config.h` gewählt. Unterstützte Sensoren: SEN54 und SEN66; vorhandene Profile: ESP32-C6 mit Display (Touch auf Hardware-I²C GPIO18/19) und ESP32-C6 ohne Display (Hardware-I²C GPIO7/8), jeweils 8 MB. SEN54 nutzt den Hardware-Bus des Profils. SEN66 bleibt immer auf GPIO7/8 und verwendet beim Display-Profil einen separaten Software-I²C-Bus; ohne Display verwendet er den Hardware-Controller. Die aktuelle Standardauswahl ist SEN66 mit Display. Die Software-I²C-Implementierung hat ACK/NACK-, Clock-Stretching- und Timeout-Tests; keine weiteren Sensorgeräte ohne Prüfung auf diesem Bus hinzufügen. Auswahl und Verdrahtung vor jedem Build prüfen; nicht vom angeschlossenen Port oder einer früheren Auswahl ableiten. Die Auswahl ersetzt keine Prüfung von PlatformIO-Chip, Flash-Größe und Partitionstabelle. Anleitung und Tests: `firmware/HARDWARE.md`. Der SEN66 verwendet den gepinnten offiziellen Sensirion-Treiber; Herkunft und Lizenz sind in `firmware/components/sen5x/SENSIRION-UPSTREAM.md` dokumentiert. Die gemeinsame Sensoranwendung heißt `air_sensor_app`; SEN66 ergänzt das Influx-Feld `co2`, SEN54 darf keine künstlichen CO₂-Werte erzeugen. Die bisherige Messwertseite mit Schriftzug, PM, Temperatur, Feuchte, VOC und Statussymbolen bleibt erhalten. Der neue Benutzerauftrag vom 11.11.2026 erweitert das Display um Raumluft mit CO₂/VOC-/NOx-Index, lokalen Verlauf und Gerätestatus/Einstellungen. EEZ-Projekt und Firmware zusammen pflegen; PlatformIO synchronisiert die Bildschirmdateien vor dem Build automatisch. Details und native UI-Tests stehen in `firmware/HARDWARE.md`. 1. Projektkonfiguration in `platformio.ini` prüfen. 2. PlatformIO-Environment für das Zielboard bestimmen. @@ -158,7 +158,29 @@ Dieser Upload ist ein dokumentierter Referenzfall. Die genannten Adressen und Ha Nachfolgende Benutzerkorrektur am selben Tag: Die zusätzliche CO₂-Anzeige wurde wieder entfernt. Die EEZ-Displaydateien entsprechen bytegenau dem ursprünglichen Git-Stand; keine NOx-/CO₂-Widgets ergänzen, solange kein neuer Auftrag vorliegt. Die entsprechende SEN66-Anwendung wurde ausschließlich bei `0x20000` aktualisiert (1.735.776 Bytes, SHA256 `ed9cec4854c5c19eaaecf69c4a1f5c9740014caf8a2bcd88976bb0bbe7fba4dd`) und vollständig bytegenau/SHA256-verifiziert. Bootloader, Partitionstabelle, OTA-Auswahl und PHY-Partitionsinhalt unverändert. Anwendungseinstellungen in NVS behalten ihre Inhaltsfingerprints; normale Radio-Kalibrierungsänderungen wurden getrennt erfasst. Der anschließende 60-Sekunden-Monitor bestätigte laufende SEN66-Messungen und **55 erfolgreiche Influx-Schreibantworten mit HTTP 204**, keine Schreib-/Sensorfehler und keine Panic. NOx und CO₂ bleiben für InfluxDB erhalten. Der vorherige Setup-AP-Hinweis beschreibt den Zustand vor der inzwischen vom Benutzer eingerichteten WLAN-Verbindung. -## Bekannte Anwendungsprobleme +## Getestetes Displayseiten-Update (11.11.2026) + +- Benutzerauftrag: neue EEZ-Seite übernehmen, Wischen zur zweiten Seite und zurück ermöglichen, bauen und flashen. Git-Stand `62e9d24` enthält die leere `Page_2`; die Firmware-Displayobjekte wurden entsprechend ergänzt. Navigation liegt außerhalb der EEZ-Exportdateien in `firmware/components/eez_gui/ui_navigation.c` und wird nach `ui_init()` unter dem LVGL-Lock initialisiert. Links von `Main` zu `Page_2`, rechts zurück; kein Umlauf. Gesten über Kindobjekten werden zur Bildschirmwurzel weitergereicht, die festen Seiten scrollen nicht. +- Native Tests mit echten LVGL-Quellen, beiden Displayseiten und simuliertem Zeiger bestanden: Tippen, kurze/vertikale Gesten, äußere Grenzen, Kindobjekte und wiederholtes Hin-/Herwechseln. Aufruf und EEZ-Exporthinweise stehen in `firmware/HARDWARE.md`; Test: `python3 firmware/test/ui/run_tests.py`. +- Ziel erneut eindeutig bestätigt: `CC:BA:97:F2:5F:7C`, ESP32-C6FH8, Revision v0.2, 8 MB. Environment `esp32-c6-devkitc-1`, ESP-IDF 5.5.0, SEN66 mit Display, Sensor GPIO7/8 und separater Touch-Bus GPIO18/19. +- Neues vollständiges 8-MB-Backup und unabhängige Anfangs-/Endproben erfolgreich geprüft. Vor Upload Partitionstabelle einschließlich MD5, gültige OTA-Auswahl (`ota_0`, Sequenz 1, Zustand 2, CRC gültig), vorhandener Bootloader, Image-Prüfsumme/Validierungshash und Sektorgrenzen geprüft. +- Genau ein Anwendungsschreibvorgang bei `0x20000`, 1.736.384 Bytes, SHA256 `86021d81ed8b2e2f284f2f1bda0c32efd231a878f3792a705a307fa816c36a46`. Vollständige bytegenaue Rücklese-/SHA256-Verifikation erfolgreich; kein vollständiges Löschen. Anschließender vollständiger Flash-Vergleich bestätigt unveränderten Bootloader, Partitionstabellensektor, OTA-Auswahl, PHY, übrige Flash-Bereiche und 320-Byte-Sektorrand. NVS änderte sich zur Laufzeit um 85 Rohbytes; kein NVS-Schreibbefehl oder Reset ausgeführt, logische Inhaltsgleichheit diesmal nicht separat geprüft. +- 60 Sekunden Monitor: Navigation bereit, laufende SEN66-Messung und 55 erfolgreiche Influx-Antworten mit HTTP 204; keine erkannten Fehler-, Panic-, Reset- oder Sensorfehlerzeilen. Keine physischen Wischgesten im Monitor beobachtet; sichtbares Display und Fingerbedienung müssen vor Ort geprüft werden. `Page_2` bleibt entsprechend dem EEZ-Projekt leer. +- Geschützte Backups und Logs außerhalb des Repositorys enthalten `flash-plan.json`, `backup-report.json`, `write-results.json`, `deployment-report.json`, Build-/UI-Testlogs, Monitor und vollständige Vor-/Nach-Flashdateien. Diese abgeschlossene Ausführung ist keine Freigabe für weitere Schreibvorgänge. + +## Vier Displayseiten, Verlauf und Einstellungen (11.11.2026) + +- Neuer Benutzerauftrag: vollständige Umsetzung der vorgeschlagenen Display-Erweiterungen einschließlich EEZ-Projekt, Bedienung, Build und Flash. Die bisherige Hauptansicht bleibt erhalten; `Page_2` zeigt CO₂/VOC-/NOx-Index mit CO₂-Verlauf, `History` den wählbaren Verlauf und `Device` WLAN/IP, Alter des letzten HTTP-204-Erfolgs, Sensoralter und Display-Einstellungen. Wischen durch vier Seiten ohne Umlauf; Statussymbole öffnen die Geräteseite. +- `eez/nanopsx.eez-project` und generierte Bildschirmdateien synchronisiert. PlatformIO führt `firmware/tools/export_display.py` vor jedem Build automatisch aus. Native Anwendungslogik und threadgeschütztes Zahlen-/Verlaufsmodell bleiben außerhalb der Exportdateien. Details, unterstützte Exporter-Widgets und Testbefehle: `firmware/HARDWARE.md`. +- Lokaler RAM-Verlauf: 180 Zehn-Sekunden-Mittelwerte, sechs auswählbare Messgrößen, fehlende Werte als Lücken, Neustart leert den Puffer. Veraltete Messungen nach mehr als fünf Sekunden und nicht verfügbare Kanäle werden gekennzeichnet. SEN54 liefert weiterhin keine künstlichen CO₂-Werte. +- Display: Helligkeit 20–100 %, Standard 100 %; Abdunkeln aus/30/60/120 s, Standard 60 s auf 15 %. Erste Berührung weckt ausschließlich. Eigene NVS-Einstellungen in `ui_display`, gespeichert bei Reglerfreigabe bzw. Auswahl, keine Änderung der WLAN-/Influx-Konfiguration. +- Erfolgreicher vollständiger Build für `esp32-c6-devkitc-1`, ESP-IDF 5.5.0, SEN66 mit Display. UI-Integrationstest mit echten LVGL-Quellen und 48 KiB LVGL-Heap bestanden: vierseitige Navigation, kurze/vertikale Gesten und Grenzen, Dropdown-Isolation, Regler, Aufwecken, Abschalten der Abdunklung, fehlende/veraltete Werte, alle sechs Diagrammkanäle sowie Ringpuffer-Mittelwerte, Lücken und Verdrängung. Native Hersteller-/Software-I²C- und Profilauswahltests bestanden. Gerenderte Vorschauen mit simulierten Werten visuell geprüft. +- Ziel erneut per `list`/`info`/`flash-id` bestätigt: `CC:BA:97:F2:5F:7C`, ESP32-C6FH8, Revision v0.2, 8 MB. Frisches vollständiges Backup mit unabhängigen Anfangs-/Endproben; Partitionstabelle, MD5, OTA-Auswahl, Bootloader, Firmware-Prüfsumme/Hash und Sektorrand vor Upload geprüft. +- Genau ein App-Schreibvorgang bei `0x20000`: 1.844.048 Bytes, SHA256 `10826853d6574c272dc91ca9cde0aabadc231172cbc8bdd1e32b628ba3701443`. Vollständige bytegenaue Rücklese-/SHA256-Verifikation erfolgreich. Kein vollständiges Löschen. Abschließender 8-MB-Vergleich bestätigt unveränderten Bootloader, Partitionstabellensektor, OTA-Auswahl, PHY, sonstige Flash-Bereiche und 3248-Byte-Sektorrand. NVS änderte sich zur Laufzeit um 74 Rohbytes; logische Inhalte diesmal nicht separat verglichen. +- 60 Sekunden Monitor: Vier-Seiten-Navigation bereit, SEN66-Messungen und 55 erfolgreiche Influx-Antworten mit HTTP 204. Keine erkannten Panics oder Sensor-/Touch-Fehler. Zwei bekannte SD-Timeout-Fehlerzeilen, keine sonstigen Fehlerzeilen. Physische Wischgesten, sichtbares Displaybild und Speichern/Neuladen der Einstellungen sind am Gerät durch den Benutzer zu prüfen; keine entsprechende Hardwarebetätigung im Monitor beobachtet. +- Geschützte Backups und Logs außerhalb des Repositorys: `flash-plan.json`, `backup-report.json`, `write-results.json`, `deployment-report.json`, Vor-/Nach-Flashdateien, Monitor, Build-/UI-Testlogs und Quellen-Hashes. Ausführung abgeschlossen; keine weitere Schreib-/Löschfreigabe ableiten. + +## Bekannte Anwendungsprobleme (historischer Stand) Beim letzten Hardwaretest wurden festgestellt: diff --git a/eez/nanopsx.eez-project b/eez/nanopsx.eez-project index 2628e50..cf74343 100644 --- a/eez/nanopsx.eez-project +++ b/eez/nanopsx.eez-project @@ -176,8 +176,8 @@ "type": "LVGLScreenWidget", "left": 0, "top": 0, - "width": 800, - "height": 480, + "width": 320, + "height": 172, "customInputs": [], "customOutputs": [], "style": { @@ -920,7 +920,7 @@ "hiddenInEditor": false, "timeline": [], "eventHandlers": [], - "identifier": "", + "identifier": "obj5", "leftUnit": "px", "topUnit": "px", "widthUnit": "content", @@ -1001,7 +1001,8 @@ "text": "pm2p5", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj6" }, { "objID": "2be9d099-aab1-4b0d-ca76-28b9b8b02f60", @@ -1051,7 +1052,8 @@ "text": "pm4p0", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj7" }, { "objID": "cce42fa6-5b06-420c-e8b7-c9be8572f0d6", @@ -1101,7 +1103,8 @@ "text": "pm10p0", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj8" }, { "objID": "ee5ac044-3ef2-4a4e-82b5-0ff8ea9e891d", @@ -1151,7 +1154,8 @@ "text": "voc_Ind", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj9" }, { "objID": "030e5627-b9a4-4f2a-91c3-aaa823d4bbb1", @@ -1201,7 +1205,8 @@ "text": "humidity", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj10" }, { "objID": "88b16a87-3896-4e8b-f1eb-d432c2903c2b", @@ -1251,7 +1256,8 @@ "text": "temp", "textType": "expression", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj11" } ], "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK|SCROLL_CHAIN_HOR|SCROLL_CHAIN_VER|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_WITH_ARROW|SNAPPABLE", @@ -1277,7 +1283,8 @@ } }, "group": "", - "groupIndex": 0 + "groupIndex": 0, + "identifier": "obj0" }, { "objID": "c5012810-5908-4563-f3d6-5b12a80e9a2a", @@ -1349,7 +1356,8 @@ "text": "Laser", "textType": "literal", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj2" }, { "objID": "66dc0ec9-e53e-472c-e623-130cda0845b7", @@ -1399,7 +1407,8 @@ "text": " nano", "textType": "literal", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj3" }, { "objID": "b9bd9d2c-88d6-41ef-c497-12787df8e0ab", @@ -1449,7 +1458,8 @@ "text": "Fab", "textType": "literal", "longMode": "WRAP", - "recolor": false + "recolor": false, + "identifier": "obj4" }, { "objID": "c4bef6f6-46da-493b-97fd-d01a833cf0a9", @@ -1756,6 +1766,243 @@ } }, "group": "", + "groupIndex": 0, + "identifier": "obj1" + }, + { + "objID": "77723cfa-1443-4bc4-88e1-a0f12941bd3e", + "type": "LVGLLabelWidget", + "identifier": "main_notice", + "left": 20, + "top": 70, + "width": 280, + "height": 28, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "029c33b9-eb3d-45be-b4d2-e8b720ccc545", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "b3d8dd51-854c-42ce-b6b4-2fe1127df96a", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#FFFFFF", + "bg_color": "#283B4C", + "bg_opa": 255, + "pad_left": 8, + "pad_top": 4, + "radius": 4 + } + } + } + }, + "groupIndex": 0, + "text": "Sensor startet ...", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "16b5fce7-e0aa-496c-8c76-0f2172dcd37a", + "type": "LVGLPanelWidget", + "identifier": "page_dot_0_0", + "left": 139, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "d3152cb0-bc2c-4c74-a7a5-f125c580f551", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "d6a38388-5d13-49af-ac8a-e4b704baca20", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#62D6C5", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "e1b00e42-2d51-4f51-b1ec-2bf5e00a46ef", + "type": "LVGLPanelWidget", + "identifier": "page_dot_0_1", + "left": 151, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "46159a8a-2b59-4520-a271-efcae3c69a0c", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "41074bb7-757e-4713-bd6e-f832ac942cc2", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "8e6cf26c-8c25-494b-b088-7076687ebe9d", + "type": "LVGLPanelWidget", + "identifier": "page_dot_0_2", + "left": 163, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "2a90e1dd-fcaa-4a35-b74e-f22c11109516", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "ba17b234-bfc4-46cd-8ed9-c2345cfc3d4d", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "88e56a1d-ed95-4fe1-a98c-bd3446171b85", + "type": "LVGLPanelWidget", + "identifier": "page_dot_0_3", + "left": 175, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "4b4eb022-10a8-49e0-9c79-78c9f6441a72", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "20fcc5a3-58db-438e-b2a6-d9b5a7b8c9bb", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, "groupIndex": 0 } ], @@ -1784,11 +2031,13 @@ "deleteOnScreenUnload": false }, { - "objID": "a72717ee-5f7d-411a-db98-f68b78400903", + "objID": "4f0f53b8-e9d1-451d-9d33-a850c98469f0", + "name": "Page_2", "components": [ { - "objID": "a94274da-132f-4ead-ce58-1cd8e76ac59c", + "objID": "5ae3a35a-3f81-4194-9a1b-307cf1048ad0", "type": "LVGLScreenWidget", + "identifier": "", "left": 0, "top": 0, "width": 320, @@ -1796,7 +2045,7 @@ "customInputs": [], "customOutputs": [], "style": { - "objID": "81ca3148-84c9-4b13-a021-8e5805657d94", + "objID": "09d77b9b-1a15-494d-acce-6fcad72c8a1b", "useStyle": "default", "conditionalStyles": [], "childStyles": [] @@ -1807,8 +2056,572 @@ "topUnit": "px", "widthUnit": "px", "heightUnit": "px", - "children": [], - "widgetFlags": "CLICKABLE|PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLLABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN_HOR|SCROLL_CHAIN_VER", + "children": [ + { + "objID": "e39e34fa-f1bb-4f75-a19f-30d282459a8b", + "type": "LVGLLabelWidget", + "identifier": "page_2_title", + "left": 12, + "top": 9, + "width": 220, + "height": 24, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "eafdf207-d73c-4962-a240-c173a77abf9c", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "f4d42b05-6a61-4585-982c-c21e2ae7d1ad", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_24", + "text_color": "#FFFFFF" + } + } + } + }, + "groupIndex": 0, + "text": "Raumluft", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "cc26821e-7f72-4a5e-8ea8-0475f4ce97c9", + "type": "LVGLLabelWidget", + "identifier": "room_state", + "left": 12, + "top": 37, + "width": 296, + "height": 19, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "a878af18-5fac-48b7-bb79-ba71ad87accc", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "9220336a-70e8-4426-b484-f9ae9071fbc7", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#8DA6BB" + } + } + } + }, + "groupIndex": 0, + "text": "Sensor startet ...", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "6bc8a55e-757a-4901-8421-72c376004040", + "type": "LVGLLabelWidget", + "identifier": "room_co2", + "left": 12, + "top": 59, + "width": 158, + "height": 44, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "4c6863e3-fe7b-40f7-8502-44a3e330a105", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "6712a7a0-274e-4553-b614-5b20e6c5e228", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "Pigiarniq_Italic_34", + "text_color": "#62D6C5" + } + } + } + }, + "groupIndex": 0, + "text": "--", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "58a3649f-1f86-4427-ae07-d4fab007fbc0", + "type": "LVGLLabelWidget", + "identifier": "room_unit", + "left": 14, + "top": 104, + "width": 150, + "height": 20, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "90b01b5f-8e01-44d0-bc6a-96325652d2d7", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "186d1349-61b8-4d1c-ad0e-76e46e4b24c8", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#8DA6BB" + } + } + } + }, + "groupIndex": 0, + "text": "CO2 / ppm", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "2ac92d84-b783-4ce5-a623-c710d5a7d62d", + "type": "LVGLLabelWidget", + "identifier": "room_voc", + "left": 14, + "top": 132, + "width": 154, + "height": 20, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "f1ea45e4-7978-42d7-bc3e-32b58682437b", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "3e33b562-2544-4875-8989-9165ae541998", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "VOC-Index --", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "49483877-b94e-4ce9-a31f-2256c05a37ff", + "type": "LVGLLabelWidget", + "identifier": "room_nox", + "left": 172, + "top": 132, + "width": 148, + "height": 20, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "226e4f38-9919-458b-a1dc-a0e3c41ca56d", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "c439bd24-28c6-47a0-bfdb-949353bd8ca9", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "NOx-Index --", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "3a0d0cd1-7e78-4a09-85c9-5814d7430e65", + "type": "LVGLChartWidget", + "identifier": "room_chart", + "left": 180, + "top": 65, + "width": 126, + "height": 46, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "66f1e2e7-cae5-49d2-9fc2-858ee0b5de3a", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "4fd5bc7f-08fd-4abf-a100-4314ddeeeb95", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_opa": 0, + "border_width": 0, + "pad_all": 0, + "line_color": "#2A3A48", + "line_width": 1 + } + } + } + }, + "groupIndex": 0, + "pointCount": 180, + "divLineCountH": 3, + "divLineCountV": 3, + "series": [] + }, + { + "objID": "270c23ac-2bad-4298-8e30-bf0316d1fc88", + "type": "LVGLLabelWidget", + "identifier": "room_chart_caption", + "left": 180, + "top": 111, + "width": 130, + "height": 20, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "ae31af8b-6c17-4c23-aa23-546478023336", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "cd097c72-f95d-46d9-85d4-2e9feb2814fe", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#8DA6BB" + } + } + } + }, + "groupIndex": 0, + "text": "CO2 / 30 min", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "c455cad3-0f74-4cab-b8db-716679353bad", + "type": "LVGLPanelWidget", + "identifier": "page_dot_1_0", + "left": 139, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "0721a34e-3862-4398-a3c1-3f13269e7de4", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "b3c777d0-f23a-4eb9-8434-78deb9332d9d", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "aca2b387-5da1-4c8a-a45b-d6a73a95c8c9", + "type": "LVGLPanelWidget", + "identifier": "page_dot_1_1", + "left": 151, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "561c433e-6c88-400f-afab-9a105b60de1f", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "abac888f-6529-4771-832f-76a10da43b18", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#62D6C5", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "06439ec2-fbeb-4266-ad57-254a668b9956", + "type": "LVGLPanelWidget", + "identifier": "page_dot_1_2", + "left": 163, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "d9e062f4-ec5d-4218-8a93-6c54bee31ed6", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "fe7b96ba-5622-486d-9fb6-382446299f1c", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "f3cd2e5b-2973-4b3e-9234-91267c370344", + "type": "LVGLPanelWidget", + "identifier": "page_dot_1_3", + "left": 175, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "8945ebc4-f86b-4c5e-9d6d-7740075ea572", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "f875649a-f120-4454-a555-92a318c25188", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + } + ], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", "hiddenFlagType": "literal", "clickableFlag": true, "clickableFlagType": "literal", @@ -1816,7 +2629,1144 @@ "disabledStateType": "literal", "states": "", "localStyles": { - "objID": "dd3e7d88-eef9-4ba7-d6c1-80def0f2aa25" + "objID": "0cdef8a5-0445-4d1d-a724-a0b5e5c8feb0", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#111923", + "bg_opa": 255, + "pad_all": 0, + "border_width": 0, + "radius": 0 + } + } + } + }, + "groupIndex": 0 + } + ], + "connectionLines": [], + "localVariables": [], + "userProperties": [], + "left": 0, + "top": 0, + "width": 320, + "height": 172, + "isUsedAsUserWidget": false, + "createAtStart": true, + "deleteOnScreenUnload": false + }, + { + "objID": "b83f4c48-687f-4c51-abb1-78a12102c6a6", + "name": "History", + "components": [ + { + "objID": "0e8570b1-aa7f-498d-8479-1332d25ea4a3", + "type": "LVGLScreenWidget", + "identifier": "", + "left": 0, + "top": 0, + "width": 320, + "height": 172, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "058c00c7-f6f8-40d3-9286-a0f73e7cb647", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [ + { + "objID": "7231ea42-e1be-44c9-9fcf-aee8d8538261", + "type": "LVGLLabelWidget", + "identifier": "history_title", + "left": 12, + "top": 9, + "width": 220, + "height": 24, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "f442cc70-da2a-4f1d-9ae5-aab276f63364", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "67e32306-2bde-4456-a5ec-d66b4b4d06fa", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_24", + "text_color": "#FFFFFF" + } + } + } + }, + "groupIndex": 0, + "text": "Verlauf", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "e8382ec5-b9ef-4810-a65a-88f67b073285", + "type": "LVGLDropdownWidget", + "identifier": "history_metric", + "left": 12, + "top": 40, + "width": 142, + "height": 28, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "5ab6113a-a326-4b25-bfe3-8149b0dd5bd2", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": true, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "cfd11796-474c-4b51-aa91-5195dc310465", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "pad_top": 3, + "pad_bottom": 3, + "bg_color": "#233544", + "text_color": "#D9E3ED", + "border_width": 0 + } + } + } + }, + "groupIndex": 0, + "options": "CO2\nPM2.5\nTemperatur\nFeuchte\nVOC-Index\nNOx-Index", + "optionsType": "literal", + "selected": 0, + "selectedType": "literal", + "direction": "bottom", + "useStaticText": true + }, + { + "objID": "515302eb-29a2-4180-97d0-386f20ae40e9", + "type": "LVGLLabelWidget", + "identifier": "history_range", + "left": 165, + "top": 43, + "width": 145, + "height": 22, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "998cd524-f763-44d8-9c41-767d98c3b620", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "cde936f6-ba02-4f35-8321-5468ec043fe8", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#8DA6BB" + } + } + } + }, + "groupIndex": 0, + "text": "Noch keine Daten", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "654f6551-f759-45e7-b050-3f607b91b462", + "type": "LVGLChartWidget", + "identifier": "history_chart", + "left": 16, + "top": 78, + "width": 288, + "height": 56, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "9d136f5b-73d9-479c-84c8-aa53be6dd398", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "5aea945d-73a1-42f4-a0ac-569c86fea0a1", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_opa": 0, + "pad_all": 2, + "border_width": 0, + "line_color": "#2A3A48", + "line_width": 1 + } + } + } + }, + "groupIndex": 0, + "pointCount": 180, + "divLineCountH": 3, + "divLineCountV": 6, + "series": [] + }, + { + "objID": "f4692d4b-53fc-44c8-97df-1370994be233", + "type": "LVGLLabelWidget", + "identifier": "history_caption", + "left": 16, + "top": 137, + "width": 290, + "height": 18, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "b5c17cb3-4add-4db9-9252-5a6bfaa33624", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "02c08e46-997c-4d7c-b80f-560b334031b2", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#8DA6BB" + } + } + } + }, + "groupIndex": 0, + "text": "-30 min jetzt", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "b4d98236-b63c-47d4-8ec0-cbfaf5ba0373", + "type": "LVGLPanelWidget", + "identifier": "page_dot_2_0", + "left": 139, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "9a108760-97d8-40be-bccd-92518ea53c6c", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "0805a184-b684-49b1-8d55-f45cb393e2e8", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "00adc3e0-96c6-44ad-bf82-08a7821e422a", + "type": "LVGLPanelWidget", + "identifier": "page_dot_2_1", + "left": 151, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "f5dff9bc-d045-43ba-94ca-dc9f3205c422", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "88ea819b-cc69-4893-a09f-4518ab0def35", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "683f8eaf-8848-41cf-9a06-d1100520b5ef", + "type": "LVGLPanelWidget", + "identifier": "page_dot_2_2", + "left": 163, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "c49584b7-4edd-4f5b-9f79-f189333fb919", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "16647073-001c-46f3-8450-b734469f90b2", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#62D6C5", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "c945a1c4-9933-4ceb-856a-a85ab5bf7b4a", + "type": "LVGLPanelWidget", + "identifier": "page_dot_2_3", + "left": 175, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "9f297a55-73ef-48b9-96d2-b1807f2a8a5d", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "eb6962d2-ae27-4147-91a8-558ba82e4e52", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + } + ], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": true, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "6b8a65b4-f749-48c9-92ae-eab06ca426cb", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#111923", + "bg_opa": 255, + "pad_all": 0, + "border_width": 0, + "radius": 0 + } + } + } + }, + "groupIndex": 0 + } + ], + "connectionLines": [], + "localVariables": [], + "userProperties": [], + "left": 0, + "top": 0, + "width": 320, + "height": 172, + "isUsedAsUserWidget": false, + "createAtStart": true, + "deleteOnScreenUnload": false + }, + { + "objID": "d3991a92-6f9c-4e78-84cc-180586c1fc4d", + "name": "Device", + "components": [ + { + "objID": "576bf091-f0ba-4157-b62a-4c91fbb9f401", + "type": "LVGLScreenWidget", + "identifier": "", + "left": 0, + "top": 0, + "width": 320, + "height": 172, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "a01f97e1-bc96-4d2f-a3ae-0fbc0d82d090", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [ + { + "objID": "68113096-81b3-4fd2-a277-2061c429f93d", + "type": "LVGLLabelWidget", + "identifier": "device_title", + "left": 12, + "top": 9, + "width": 220, + "height": 24, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "dd1caada-7a48-41df-b75e-5abe4d36f430", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "74fd0167-3860-4097-93c3-479a29902261", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_24", + "text_color": "#FFFFFF" + } + } + } + }, + "groupIndex": 0, + "text": "Gerät", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "f1294304-714b-4d4d-aa62-d0fb02199525", + "type": "LVGLLabelWidget", + "identifier": "device_wifi", + "left": 12, + "top": 37, + "width": 296, + "height": 22, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "2981c1da-7bcf-4275-915a-7336ec11dbeb", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "1748ebf9-8650-40b5-92ff-e43863d8e45d", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "WLAN: nicht verbunden", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "6ff39310-eb68-4ef7-bfe5-948192622934", + "type": "LVGLLabelWidget", + "identifier": "device_influx", + "left": 12, + "top": 58, + "width": 296, + "height": 22, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "4a0b4966-d7e2-4525-9fe2-dbdde696066d", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "9e9d4626-8e87-4dbf-b18b-b3d2b7206673", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "Influx: noch keine Übertragung", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "e5d1f7ec-fb3f-4397-9ec7-d2783d2e88d3", + "type": "LVGLLabelWidget", + "identifier": "device_sensor", + "left": 12, + "top": 79, + "width": 296, + "height": 22, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "dc2797dc-786e-40c9-883c-c15130bb69ba", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "e710fdaf-678c-48ea-acba-11f7a9ab6dde", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "Sensor: startet ...", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "0d71d496-bcd0-4d80-9ac5-e5be39caac93", + "type": "LVGLLabelWidget", + "identifier": "brightness_label", + "left": 12, + "top": 104, + "width": 96, + "height": 22, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "ae89d8d8-4b66-483d-a240-e729465ab03a", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "5a48e92a-d2c7-49e7-9ee7-97d7607701e3", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "Licht 100%", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "dccca32c-b38a-4d34-ba48-3421f38f4e65", + "type": "LVGLSliderWidget", + "identifier": "brightness", + "left": 119, + "top": 111, + "width": 177, + "height": 10, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "26e77592-14b8-49e6-878b-1badd8d593de", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": true, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "e0b7c717-5382-43ad-bcb8-03b7aeae9a66", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#2A3A48", + "border_width": 0 + } + } + } + }, + "groupIndex": 0, + "min": 20, + "minType": "literal", + "max": 100, + "maxType": "literal", + "mode": "NORMAL", + "value": 100, + "valueType": "literal", + "valueLeft": 0, + "valueLeftType": "literal", + "enableAnimation": false + }, + { + "objID": "90d355b5-b44f-4b92-be39-86d23cbc6ac6", + "type": "LVGLLabelWidget", + "identifier": "dim_label", + "left": 12, + "top": 132, + "width": 126, + "height": 20, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "676b0e07-bd6f-4184-b4d9-39f2333db980", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "d90a0637-c5fb-4f63-a174-f5ba6ffbc5ad", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "text_color": "#D9E3ED" + } + } + } + }, + "groupIndex": 0, + "text": "Abdunkeln", + "textType": "literal", + "longMode": "CLIP", + "recolor": false + }, + { + "objID": "0e64a509-ed05-4761-a389-cc8c68087dac", + "type": "LVGLDropdownWidget", + "identifier": "dim_timeout", + "left": 174, + "top": 128, + "width": 132, + "height": 27, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "3f9310f8-a48f-440e-b1d6-39a16b96e1cb", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": true, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "8da6827b-c446-4127-8ecc-ce893e073547", + "definition": { + "MAIN": { + "DEFAULT": { + "text_font": "ubuntu_16", + "pad_top": 2, + "pad_bottom": 2, + "bg_color": "#233544", + "text_color": "#D9E3ED", + "border_width": 0 + } + } + } + }, + "groupIndex": 0, + "options": "Aus\nNach 30 s\nNach 60 s\nNach 120 s", + "optionsType": "literal", + "selected": 2, + "selectedType": "literal", + "direction": "top", + "useStaticText": true + }, + { + "objID": "762e8440-ff4f-482b-a7df-ab940166d9ff", + "type": "LVGLPanelWidget", + "identifier": "page_dot_3_0", + "left": 139, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "7cde13dc-defe-4fe1-b081-579561c1cab3", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "480e6fb8-71d8-4993-80b4-2b818c6f9484", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "14040730-f64e-4356-8d81-9568f4fbf0a8", + "type": "LVGLPanelWidget", + "identifier": "page_dot_3_1", + "left": 151, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "cfe71fc6-99e3-4ed3-9e91-d1797e597ee9", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "bddd8d36-6cb2-48e1-9794-cf7a8cfabfd3", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "5a374866-134d-4c4c-8cc3-1649276dd0c5", + "type": "LVGLPanelWidget", + "identifier": "page_dot_3_2", + "left": 163, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "62f23d8f-3cb6-4752-a212-708e0377a686", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "dde3f14a-81f6-4f89-a316-49a3476834c3", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#526171", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + }, + { + "objID": "bb2378db-2d07-4097-9d63-ec66677a42b0", + "type": "LVGLPanelWidget", + "identifier": "page_dot_3_3", + "left": 175, + "top": 0, + "width": 7, + "height": 3, + "customInputs": [], + "customOutputs": [], + "style": { + "objID": "de7831d4-5f69-491a-b700-75ac4a0558bd", + "useStyle": "default", + "conditionalStyles": [], + "childStyles": [] + }, + "timeline": [], + "eventHandlers": [], + "leftUnit": "px", + "topUnit": "px", + "widthUnit": "px", + "heightUnit": "px", + "children": [], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": false, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "36212af1-2ed0-4934-9864-2516cb8c05fd", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#62D6C5", + "bg_opa": 255, + "border_width": 0, + "radius": 1, + "pad_all": 0 + } + } + } + }, + "groupIndex": 0 + } + ], + "widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK", + "hiddenFlagType": "literal", + "clickableFlag": true, + "clickableFlagType": "literal", + "checkedStateType": "literal", + "disabledStateType": "literal", + "states": "", + "localStyles": { + "objID": "8757261a-2417-4e34-a004-f61f7f21ff59", + "definition": { + "MAIN": { + "DEFAULT": { + "bg_color": "#111923", + "bg_opa": 255, + "pad_all": 0, + "border_width": 0, + "radius": 0 + } + } + } }, "groupIndex": 0 } @@ -1824,7 +3774,6 @@ "connectionLines": [], "localVariables": [], "userProperties": [], - "name": "Page_2", "left": 0, "top": 0, "width": 320, @@ -2235,4 +4184,4 @@ "colors": [] } ] -} \ No newline at end of file +} diff --git a/firmware/HARDWARE.md b/firmware/HARDWARE.md index a4f1063..0bd5a22 100644 --- a/firmware/HARDWARE.md +++ b/firmware/HARDWARE.md @@ -179,3 +179,66 @@ automatisch freigegeben. mit Portal `http://192.168.4.1` aktiv; keine STA-IP oder erfolgreichen Influx-Schreibvorgänge beobachtet. WLAN und bei Bedarf Organisation `Home` / Bucket `nanoPSX` im Portal einstellen; Tokens lokal eingeben. + +## Displayseiten und Bedienung + +Die vier EEZ-Seiten sind `Main` (bisherige Messwertansicht), `Page_2` (Raumluft), +`History` (Verlauf) und `Device` (Gerät). Nach links zur nächsten, nach rechts zur +vorherigen Seite wischen; an den äußeren Seiten gibt es keinen Umlauf. Vier kleine +Markierungen am oberen Rand zeigen die aktuelle Seite. Tippen auf ein Statussymbol +der Hauptseite öffnet die Geräteseite. Dropdowns und Helligkeitsregler verarbeiten +ihre Berührungen selbst, ohne dabei versehentlich die Seite zu wechseln. + +- Raumluft: CO₂ in ppm, VOC-/NOx-Index und ein kleiner CO₂-Verlauf. Nicht verfügbare + Kanäle erscheinen als `--`; SEN54 erzeugt keine künstlichen CO₂-Werte. +- Verlauf: Auswahl zwischen CO₂, PM2.5, Temperatur, Feuchte, VOC und NOx. Gezeigt + werden 180 Zehn-Sekunden-Mittelwerte über die letzten 30 Minuten. Die angezeigte + Wertespanne entspricht der automatisch angepassten Diagrammachse. Fehlende + Zeitabschnitte bleiben Lücken. Der feste RAM-Ringpuffer wird bei Neustart geleert; + SD-Karte, WLAN und InfluxDB sind für den lokalen Verlauf nicht erforderlich. +- Gerätestatus: WLAN/IP, Alter der letzten bestätigten Influx-Übertragung (HTTP 204) + und Sensoraktualität. Ein WLAN-Erfolg gilt nicht als erfolgreiche Datenübertragung. +- Helligkeit: 20–100 %, Standard 100 %. Automatisches Abdunkeln: aus oder nach + 30/60/120 Sekunden, Standard 60 Sekunden. Abgedunkelt wird auf 15 %. Die erste + Berührung weckt nur das Display und wird bis zum Loslassen verbraucht. +- Display-Einstellungen werden erst nach Änderung gespeichert: Helligkeit beim + Loslassen, Zeitwahl beim Auswählen. Eigener NVS-Namespace `ui_display`, keine + WLAN-/Influx-Einstellungen. Beim ersten Start werden nur die Defaults gelesen. +- Vor dem ersten Sensorpaket erscheint ein Starthinweis. Nach mehr als fünf + Sekunden ohne erfolgreiches Paket werden die aktuellen Anzeigen als veraltet + markiert und die Zahlen durch `--` ersetzt; der vorhandene Verlauf bleibt sichtbar. + +## EEZ-Projekt und Firmware zusammen bearbeiten + +`eez/nanopsx.eez-project` enthält Layout, Beschriftungen, Namen und Grundkonfiguration +der Widgets. PlatformIO ruft vor jedem Build `tools/export_display.py` auf und hält +`screens.c`/`screens.h` automatisch synchron. Kein manueller EEZ-Studio-Export nötig. +Der projektspezifische Exporter unterstützt die hier verwendeten statischen Screen-, +Panel-, Label-, Image-, Chart-, Slider- und Dropdown-Widgets und deren verwendete +Stile. Nicht unterstützte Widgettypen/Stile brechen den Build ab, statt unbemerkt +wegzufallen; bei Erweiterungen zuerst den Exporter ergänzen. EEZ Flow bleibt aus. + +Navigation, dynamische Texte, Chart-Daten, Touch-Aufwecken und Einstellungen liegen +außerhalb der generierten Dateien in `ui_navigation.c`, `ui_dashboard.c` und +`ui_model.c`. Diese werden nach `ui_init()` unter dem LVGL-Lock initialisiert. +Der Sensorproducer übergibt skalierte Zahlen an `ui_model_publish()` und ruft +keine LVGL-Funktionen auf. Snapshot und begrenzter Ringpuffer sind auf dem ESP +mit einem Spinlock geschützt. Die Diagramme werden im GUI-Task aktualisiert. + +Prüfungen aus dem Repository-Hauptverzeichnis: + +```bash +python3 firmware/tools/export_display.py --check +python3 firmware/test/ui/run_tests.py +bash firmware/test/sensors/run.sh +``` + +Die UI-Tests verwenden echte LVGL-Quellen und exportierte Displayobjekte bei +48 KiB LVGL-Speicher. Sie prüfen vierseitige Navigation, Tippen, kurze/vertikale +Gesten, äußere Grenzen, Kindobjekte, Dropdown-Isolation, Helligkeitsregler, +Aufweckberührung, Abdunkeln, fehlende/veraltete Werte und Verlaufsmittelwerte, +Lücken und Verdrängung alter Daten. Voraussetzung sind ein C-Compiler und die +bereits aufgelöste LVGL-Komponente unter `firmware/managed_components`. +Ein optionaler Verzeichnispfad hinter dem UI-Testbefehl speichert vier gerenderte +PPM-Vorschauen mit simulierten Messwerten. Physische Darstellung und Fingerbedienung +müssen zusätzlich am Gerät geprüft werden. diff --git a/firmware/components/eez_gui/CMakeLists.txt b/firmware/components/eez_gui/CMakeLists.txt index aca54ed..9a1eb39 100644 --- a/firmware/components/eez_gui/CMakeLists.txt +++ b/firmware/components/eez_gui/CMakeLists.txt @@ -1,6 +1,9 @@ idf_component_register( SRCS "ui.c" + "ui_navigation.c" + "ui_dashboard.c" + "ui_model.c" "images.c" "screens.c" "styles.c" diff --git a/firmware/components/eez_gui/screens.c b/firmware/components/eez_gui/screens.c index 988ed68..94930e1 100644 --- a/firmware/components/eez_gui/screens.c +++ b/firmware/components/eez_gui/screens.c @@ -1,369 +1,714 @@ -#include - +/* Generated by firmware/tools/export_display.py from the EEZ project. */ #include "screens.h" -#include "images.h" #include "fonts.h" -#include "actions.h" +#include "images.h" #include "vars.h" -#include "styles.h" -#include "ui.h" - #include - objects_t objects; lv_obj_t *tick_value_change_obj; -uint32_t active_theme_index = 0; - -void create_screen_main() { - lv_obj_t *obj = lv_obj_create(0); - objects.main = obj; - lv_obj_set_pos(obj, 0, 0); - lv_obj_set_size(obj, 320, 172); - { - lv_obj_t *parent_obj = obj; - { - lv_obj_t *obj = lv_obj_create(parent_obj); - objects.obj0 = obj; - lv_obj_set_pos(obj, 0, 43); - lv_obj_set_size(obj, 320, 129); - lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_bg_color(obj, lv_color_hex(0xff3e4045), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - { - lv_obj_t *parent_obj = obj; - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, -11, -16); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "PM 1.0: "); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, -11, 9); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "PM 2.5: "); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, -11, 34); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "PM 4.0: "); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, -11, 59); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "PM 10: "); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, -11, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "VOC:"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 89, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "RH:"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 202, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "T: "); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 223, -16); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "μg/m³"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 223, 9); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "µg/m³"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 223, 34); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "µg/m³"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 223, 59); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "µg/m³"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 223, 134); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "µg/m³"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 168, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, " %"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - lv_obj_set_pos(obj, 263, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, " °C"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj5 = obj; - lv_obj_set_pos(obj, 152, -16); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj6 = obj; - lv_obj_set_pos(obj, 152, 9); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj7 = obj; - lv_obj_set_pos(obj, 152, 34); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj8 = obj; - lv_obj_set_pos(obj, 152, 59); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj9 = obj; - lv_obj_set_pos(obj, 45, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj10 = obj; - lv_obj_set_pos(obj, 129, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj11 = obj; - lv_obj_set_pos(obj, 221, 84); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, ""); - } - } - } - { - lv_obj_t *obj = lv_obj_create(parent_obj); - objects.obj1 = obj; - lv_obj_set_pos(obj, 0, 4); - lv_obj_set_size(obj, 320, 39); - lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE|LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_bg_color(obj, lv_color_hex(0xffedeef4), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_line_rounded(obj, false, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(obj, lv_color_hex(0xff121314), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(obj, 10, LV_PART_MAIN | LV_STATE_DEFAULT); - { - lv_obj_t *parent_obj = obj; - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj2 = obj; - lv_obj_set_pos(obj, -11, -13); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(obj, lv_color_hex(0xff0b09f3), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "Laser"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj3 = obj; - lv_obj_set_pos(obj, 68, -13); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(obj, lv_color_hex(0xfff11808), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, " nano"); - } - { - lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj4 = obj; - lv_obj_set_pos(obj, 163, -13); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_font(obj, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(obj, lv_color_hex(0xff0b09f3), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(obj, "Fab"); - } - { - // wifi_ok - lv_obj_t *obj = lv_img_create(parent_obj); - objects.wifi_ok = obj; - lv_obj_set_pos(obj, 223, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_wifi_ok); - } - { - // wifi_off - lv_obj_t *obj = lv_img_create(parent_obj); - objects.wifi_off = obj; - lv_obj_set_pos(obj, 223, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_wifi_off); - } - { - // influx_ok - lv_obj_t *obj = lv_img_create(parent_obj); - objects.influx_ok = obj; - lv_obj_set_pos(obj, 276, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_influx_ok); - } - { - // influx_off - lv_obj_t *obj = lv_img_create(parent_obj); - objects.influx_off = obj; - lv_obj_set_pos(obj, 276, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_influx_off); - } - { - // mdns_ok - lv_obj_t *obj = lv_img_create(parent_obj); - objects.mdns_ok = obj; - lv_obj_set_pos(obj, 250, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_mdns_ok); - } - { - // mdns_off - lv_obj_t *obj = lv_img_create(parent_obj); - objects.mdns_off = obj; - lv_obj_set_pos(obj, 250, -8); - lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_img_set_src(obj, &img_mdns_off); - } - } - } - } - - tick_screen_main(); +uint32_t active_theme_index; +void create_screen_main(void) { + lv_obj_t *w0 = lv_obj_create(NULL); + objects.main = w0; + lv_obj_set_pos(w0, 0, 0); + lv_obj_set_size(w0, 320, 172); + lv_obj_clear_flag(w0, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w0, LV_OBJ_FLAG_CLICKABLE); + lv_obj_t *w1 = lv_obj_create(w0); + objects.obj0 = w1; + lv_obj_set_pos(w1, 0, 43); + lv_obj_set_size(w1, 320, 129); + lv_obj_clear_flag(w1, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w1, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_bg_color(w1, lv_color_hex(0x3e4045), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w1, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w2 = lv_label_create(w1); + lv_obj_set_pos(w2, -11, -16); + lv_obj_set_size(w2, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w2, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w2, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w2, LV_LABEL_LONG_WRAP); + lv_label_set_text(w2, "PM 1.0: "); + lv_obj_t *w3 = lv_label_create(w1); + lv_obj_set_pos(w3, -11, 9); + lv_obj_set_size(w3, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w3, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w3, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w3, LV_LABEL_LONG_WRAP); + lv_label_set_text(w3, "PM 2.5: "); + lv_obj_t *w4 = lv_label_create(w1); + lv_obj_set_pos(w4, -11, 34); + lv_obj_set_size(w4, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w4, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w4, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w4, LV_LABEL_LONG_WRAP); + lv_label_set_text(w4, "PM 4.0: "); + lv_obj_t *w5 = lv_label_create(w1); + lv_obj_set_pos(w5, -11, 59); + lv_obj_set_size(w5, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w5, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w5, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w5, LV_LABEL_LONG_WRAP); + lv_label_set_text(w5, "PM 10: "); + lv_obj_t *w6 = lv_label_create(w1); + lv_obj_set_pos(w6, -11, 84); + lv_obj_set_size(w6, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w6, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w6, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w6, LV_LABEL_LONG_WRAP); + lv_label_set_text(w6, "VOC:"); + lv_obj_t *w7 = lv_label_create(w1); + lv_obj_set_pos(w7, 89, 84); + lv_obj_set_size(w7, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w7, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w7, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w7, LV_LABEL_LONG_WRAP); + lv_label_set_text(w7, "RH:"); + lv_obj_t *w8 = lv_label_create(w1); + lv_obj_set_pos(w8, 202, 84); + lv_obj_set_size(w8, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w8, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w8, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w8, LV_LABEL_LONG_WRAP); + lv_label_set_text(w8, "T: "); + lv_obj_t *w9 = lv_label_create(w1); + lv_obj_set_pos(w9, 223, -16); + lv_obj_set_size(w9, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w9, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w9, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w9, LV_LABEL_LONG_WRAP); + lv_label_set_text(w9, "μg/m³"); + lv_obj_t *w10 = lv_label_create(w1); + lv_obj_set_pos(w10, 223, 9); + lv_obj_set_size(w10, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w10, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w10, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w10, LV_LABEL_LONG_WRAP); + lv_label_set_text(w10, "µg/m³"); + lv_obj_t *w11 = lv_label_create(w1); + lv_obj_set_pos(w11, 223, 34); + lv_obj_set_size(w11, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w11, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w11, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w11, LV_LABEL_LONG_WRAP); + lv_label_set_text(w11, "µg/m³"); + lv_obj_t *w12 = lv_label_create(w1); + lv_obj_set_pos(w12, 223, 59); + lv_obj_set_size(w12, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w12, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w12, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w12, LV_LABEL_LONG_WRAP); + lv_label_set_text(w12, "µg/m³"); + lv_obj_t *w13 = lv_label_create(w1); + lv_obj_set_pos(w13, 223, 134); + lv_obj_set_size(w13, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w13, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w13, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w13, LV_LABEL_LONG_WRAP); + lv_label_set_text(w13, "µg/m³"); + lv_obj_t *w14 = lv_label_create(w1); + lv_obj_set_pos(w14, 168, 84); + lv_obj_set_size(w14, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w14, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w14, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w14, LV_LABEL_LONG_WRAP); + lv_label_set_text(w14, " %"); + lv_obj_t *w15 = lv_label_create(w1); + lv_obj_set_pos(w15, 263, 84); + lv_obj_set_size(w15, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w15, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w15, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w15, LV_LABEL_LONG_WRAP); + lv_label_set_text(w15, " °C"); + lv_obj_t *w16 = lv_label_create(w1); + objects.obj5 = w16; + lv_obj_set_pos(w16, 152, -16); + lv_obj_set_size(w16, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w16, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w16, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w16, LV_LABEL_LONG_WRAP); + lv_label_set_text(w16, get_var_pm1p0()); + lv_obj_t *w17 = lv_label_create(w1); + objects.obj6 = w17; + lv_obj_set_pos(w17, 152, 9); + lv_obj_set_size(w17, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w17, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w17, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w17, LV_LABEL_LONG_WRAP); + lv_label_set_text(w17, get_var_pm2p5()); + lv_obj_t *w18 = lv_label_create(w1); + objects.obj7 = w18; + lv_obj_set_pos(w18, 152, 34); + lv_obj_set_size(w18, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w18, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w18, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w18, LV_LABEL_LONG_WRAP); + lv_label_set_text(w18, get_var_pm4p0()); + lv_obj_t *w19 = lv_label_create(w1); + objects.obj8 = w19; + lv_obj_set_pos(w19, 152, 59); + lv_obj_set_size(w19, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w19, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w19, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w19, LV_LABEL_LONG_WRAP); + lv_label_set_text(w19, get_var_pm10p0()); + lv_obj_t *w20 = lv_label_create(w1); + objects.obj9 = w20; + lv_obj_set_pos(w20, 45, 84); + lv_obj_set_size(w20, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w20, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w20, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w20, LV_LABEL_LONG_WRAP); + lv_label_set_text(w20, get_var_voc_ind()); + lv_obj_t *w21 = lv_label_create(w1); + objects.obj10 = w21; + lv_obj_set_pos(w21, 129, 84); + lv_obj_set_size(w21, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w21, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w21, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w21, LV_LABEL_LONG_WRAP); + lv_label_set_text(w21, get_var_humidity()); + lv_obj_t *w22 = lv_label_create(w1); + objects.obj11 = w22; + lv_obj_set_pos(w22, 221, 84); + lv_obj_set_size(w22, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w22, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w22, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w22, LV_LABEL_LONG_WRAP); + lv_label_set_text(w22, get_var_temp()); + lv_obj_t *w23 = lv_obj_create(w0); + objects.obj1 = w23; + lv_obj_set_pos(w23, 0, 4); + lv_obj_set_size(w23, 320, 39); + lv_obj_clear_flag(w23, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w23, lv_color_hex(0xedeef4), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_line_rounded(w23, false, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(w23, lv_color_hex(0x121314), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w23, 10, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w24 = lv_label_create(w23); + objects.obj2 = w24; + lv_obj_set_pos(w24, -11, -13); + lv_obj_set_size(w24, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w24, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w24, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w24, lv_color_hex(0x0b09f3), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w24, LV_LABEL_LONG_WRAP); + lv_label_set_text(w24, "Laser"); + lv_obj_t *w25 = lv_label_create(w23); + objects.obj3 = w25; + lv_obj_set_pos(w25, 68, -13); + lv_obj_set_size(w25, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w25, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w25, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w25, lv_color_hex(0xf11808), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w25, LV_LABEL_LONG_WRAP); + lv_label_set_text(w25, " nano"); + lv_obj_t *w26 = lv_label_create(w23); + objects.obj4 = w26; + lv_obj_set_pos(w26, 163, -13); + lv_obj_set_size(w26, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w26, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w26, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w26, lv_color_hex(0x0b09f3), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w26, LV_LABEL_LONG_WRAP); + lv_label_set_text(w26, "Fab"); + lv_obj_t *w27 = lv_img_create(w23); + objects.wifi_ok = w27; + lv_obj_set_pos(w27, 223, -8); + lv_obj_set_size(w27, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w27, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w27, &img_wifi_ok); + lv_obj_t *w28 = lv_img_create(w23); + objects.wifi_off = w28; + lv_obj_set_pos(w28, 223, -8); + lv_obj_set_size(w28, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w28, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w28, &img_wifi_off); + lv_obj_t *w29 = lv_img_create(w23); + objects.influx_ok = w29; + lv_obj_set_pos(w29, 276, -8); + lv_obj_set_size(w29, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w29, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w29, &img_influx_ok); + lv_obj_t *w30 = lv_img_create(w23); + objects.influx_off = w30; + lv_obj_set_pos(w30, 276, -8); + lv_obj_set_size(w30, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w30, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w30, &img_influx_off); + lv_obj_t *w31 = lv_img_create(w23); + objects.mdns_ok = w31; + lv_obj_set_pos(w31, 250, -8); + lv_obj_set_size(w31, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w31, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w31, &img_mdns_ok); + lv_obj_t *w32 = lv_img_create(w23); + objects.mdns_off = w32; + lv_obj_set_pos(w32, 250, -8); + lv_obj_set_size(w32, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + lv_obj_clear_flag(w32, LV_OBJ_FLAG_SCROLLABLE); + lv_img_set_src(w32, &img_mdns_off); + lv_obj_t *w33 = lv_label_create(w0); + objects.main_notice = w33; + lv_obj_set_pos(w33, 20, 70); + lv_obj_set_size(w33, 280, 28); + lv_obj_clear_flag(w33, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w33, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w33, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(w33, lv_color_hex(0x283B4C), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w33, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(w33, 8, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(w33, 4, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w33, 4, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w33, LV_LABEL_LONG_CLIP); + lv_label_set_text(w33, "Sensor startet ..."); + lv_obj_t *w34 = lv_obj_create(w0); + objects.page_dot_0_0 = w34; + lv_obj_set_pos(w34, 139, 0); + lv_obj_set_size(w34, 7, 3); + lv_obj_clear_flag(w34, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w34, lv_color_hex(0x62D6C5), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w34, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w34, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w34, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w34, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w35 = lv_obj_create(w0); + objects.page_dot_0_1 = w35; + lv_obj_set_pos(w35, 151, 0); + lv_obj_set_size(w35, 7, 3); + lv_obj_clear_flag(w35, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w35, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w35, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w35, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w35, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w35, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w36 = lv_obj_create(w0); + objects.page_dot_0_2 = w36; + lv_obj_set_pos(w36, 163, 0); + lv_obj_set_size(w36, 7, 3); + lv_obj_clear_flag(w36, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w36, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w36, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w36, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w36, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w36, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w37 = lv_obj_create(w0); + objects.page_dot_0_3 = w37; + lv_obj_set_pos(w37, 175, 0); + lv_obj_set_size(w37, 7, 3); + lv_obj_clear_flag(w37, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w37, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w37, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w37, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w37, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w37, 0, LV_PART_MAIN | LV_STATE_DEFAULT); } - -void tick_screen_main() { - { - const char *new_val = get_var_pm1p0(); - const char *cur_val = lv_label_get_text(objects.obj5); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj5; - lv_label_set_text(objects.obj5, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_pm2p5(); - const char *cur_val = lv_label_get_text(objects.obj6); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj6; - lv_label_set_text(objects.obj6, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_pm4p0(); - const char *cur_val = lv_label_get_text(objects.obj7); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj7; - lv_label_set_text(objects.obj7, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_pm10p0(); - const char *cur_val = lv_label_get_text(objects.obj8); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj8; - lv_label_set_text(objects.obj8, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_voc_ind(); - const char *cur_val = lv_label_get_text(objects.obj9); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj9; - lv_label_set_text(objects.obj9, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_humidity(); - const char *cur_val = lv_label_get_text(objects.obj10); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj10; - lv_label_set_text(objects.obj10, new_val); - tick_value_change_obj = NULL; - } - } - { - const char *new_val = get_var_temp(); - const char *cur_val = lv_label_get_text(objects.obj11); - if (strcmp(new_val, cur_val) != 0) { - tick_value_change_obj = objects.obj11; - lv_label_set_text(objects.obj11, new_val); - tick_value_change_obj = NULL; - } - } +void tick_screen_main(void) { + if (strcmp(lv_label_get_text(objects.obj5), get_var_pm1p0()) != 0) + lv_label_set_text(objects.obj5, get_var_pm1p0()); + if (strcmp(lv_label_get_text(objects.obj6), get_var_pm2p5()) != 0) + lv_label_set_text(objects.obj6, get_var_pm2p5()); + if (strcmp(lv_label_get_text(objects.obj7), get_var_pm4p0()) != 0) + lv_label_set_text(objects.obj7, get_var_pm4p0()); + if (strcmp(lv_label_get_text(objects.obj8), get_var_pm10p0()) != 0) + lv_label_set_text(objects.obj8, get_var_pm10p0()); + if (strcmp(lv_label_get_text(objects.obj9), get_var_voc_ind()) != 0) + lv_label_set_text(objects.obj9, get_var_voc_ind()); + if (strcmp(lv_label_get_text(objects.obj10), get_var_humidity()) != 0) + lv_label_set_text(objects.obj10, get_var_humidity()); + if (strcmp(lv_label_get_text(objects.obj11), get_var_temp()) != 0) + lv_label_set_text(objects.obj11, get_var_temp()); } - - - -typedef void (*tick_screen_func_t)(); -tick_screen_func_t tick_screen_funcs[] = { - tick_screen_main, -}; -void tick_screen(int screen_index) { - tick_screen_funcs[screen_index](); +void create_screen_page_2(void) { + lv_obj_t *w0 = lv_obj_create(NULL); + objects.page_2 = w0; + lv_obj_set_pos(w0, 0, 0); + lv_obj_set_size(w0, 320, 172); + lv_obj_clear_flag(w0, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w0, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_bg_color(w0, lv_color_hex(0x111923), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w0, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w1 = lv_label_create(w0); + objects.page_2_title = w1; + lv_obj_set_pos(w1, 12, 9); + lv_obj_set_size(w1, 220, 24); + lv_obj_clear_flag(w1, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w1, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w1, LV_LABEL_LONG_CLIP); + lv_label_set_text(w1, "Raumluft"); + lv_obj_t *w2 = lv_label_create(w0); + objects.room_state = w2; + lv_obj_set_pos(w2, 12, 37); + lv_obj_set_size(w2, 296, 19); + lv_obj_clear_flag(w2, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w2, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w2, lv_color_hex(0x8DA6BB), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w2, LV_LABEL_LONG_CLIP); + lv_label_set_text(w2, "Sensor startet ..."); + lv_obj_t *w3 = lv_label_create(w0); + objects.room_co2 = w3; + lv_obj_set_pos(w3, 12, 59); + lv_obj_set_size(w3, 158, 44); + lv_obj_clear_flag(w3, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w3, &ui_font_pigiarniq_italic_34, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w3, lv_color_hex(0x62D6C5), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w3, LV_LABEL_LONG_CLIP); + lv_label_set_text(w3, "--"); + lv_obj_t *w4 = lv_label_create(w0); + objects.room_unit = w4; + lv_obj_set_pos(w4, 14, 104); + lv_obj_set_size(w4, 150, 20); + lv_obj_clear_flag(w4, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w4, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w4, lv_color_hex(0x8DA6BB), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w4, LV_LABEL_LONG_CLIP); + lv_label_set_text(w4, "CO2 / ppm"); + lv_obj_t *w5 = lv_label_create(w0); + objects.room_voc = w5; + lv_obj_set_pos(w5, 14, 132); + lv_obj_set_size(w5, 154, 20); + lv_obj_clear_flag(w5, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w5, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w5, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w5, LV_LABEL_LONG_CLIP); + lv_label_set_text(w5, "VOC-Index --"); + lv_obj_t *w6 = lv_label_create(w0); + objects.room_nox = w6; + lv_obj_set_pos(w6, 172, 132); + lv_obj_set_size(w6, 148, 20); + lv_obj_clear_flag(w6, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w6, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w6, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w6, LV_LABEL_LONG_CLIP); + lv_label_set_text(w6, "NOx-Index --"); + lv_obj_t *w7 = lv_chart_create(w0); + objects.room_chart = w7; + lv_obj_set_pos(w7, 180, 65); + lv_obj_set_size(w7, 126, 46); + lv_obj_clear_flag(w7, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_opa(w7, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w7, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w7, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_line_color(w7, lv_color_hex(0x2A3A48), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_line_width(w7, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_chart_set_type(w7, LV_CHART_TYPE_LINE); + lv_chart_set_point_count(w7, 180); + lv_chart_set_div_line_count(w7, 3, 3); + lv_obj_t *w8 = lv_label_create(w0); + objects.room_chart_caption = w8; + lv_obj_set_pos(w8, 180, 111); + lv_obj_set_size(w8, 130, 20); + lv_obj_clear_flag(w8, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w8, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w8, lv_color_hex(0x8DA6BB), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w8, LV_LABEL_LONG_CLIP); + lv_label_set_text(w8, "CO2 / 30 min"); + lv_obj_t *w9 = lv_obj_create(w0); + objects.page_dot_1_0 = w9; + lv_obj_set_pos(w9, 139, 0); + lv_obj_set_size(w9, 7, 3); + lv_obj_clear_flag(w9, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w9, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w9, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w9, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w10 = lv_obj_create(w0); + objects.page_dot_1_1 = w10; + lv_obj_set_pos(w10, 151, 0); + lv_obj_set_size(w10, 7, 3); + lv_obj_clear_flag(w10, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w10, lv_color_hex(0x62D6C5), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w10, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w10, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w10, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w10, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w11 = lv_obj_create(w0); + objects.page_dot_1_2 = w11; + lv_obj_set_pos(w11, 163, 0); + lv_obj_set_size(w11, 7, 3); + lv_obj_clear_flag(w11, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w11, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w11, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w11, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w11, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w11, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w12 = lv_obj_create(w0); + objects.page_dot_1_3 = w12; + lv_obj_set_pos(w12, 175, 0); + lv_obj_set_size(w12, 7, 3); + lv_obj_clear_flag(w12, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w12, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w12, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w12, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w12, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w12, 0, LV_PART_MAIN | LV_STATE_DEFAULT); } -void tick_screen_by_id(enum ScreensEnum screenId) { - tick_screen_funcs[screenId - 1](); +void tick_screen_page_2(void) { } - -void create_screens() { - lv_disp_t *dispp = lv_disp_get_default(); - lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); - lv_disp_set_theme(dispp, theme); - +void create_screen_history(void) { + lv_obj_t *w0 = lv_obj_create(NULL); + objects.history = w0; + lv_obj_set_pos(w0, 0, 0); + lv_obj_set_size(w0, 320, 172); + lv_obj_clear_flag(w0, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w0, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_bg_color(w0, lv_color_hex(0x111923), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w0, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w1 = lv_label_create(w0); + objects.history_title = w1; + lv_obj_set_pos(w1, 12, 9); + lv_obj_set_size(w1, 220, 24); + lv_obj_clear_flag(w1, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w1, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w1, LV_LABEL_LONG_CLIP); + lv_label_set_text(w1, "Verlauf"); + lv_obj_t *w2 = lv_dropdown_create(w0); + objects.history_metric = w2; + lv_obj_set_pos(w2, 12, 40); + lv_obj_set_size(w2, 142, 28); + lv_obj_clear_flag(w2, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w2, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_text_font(w2, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(w2, 3, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_bottom(w2, 3, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(w2, lv_color_hex(0x233544), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w2, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w2, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_dropdown_set_options(w2, "CO2\nPM2.5\nTemperatur\nFeuchte\nVOC-Index\nNOx-Index"); + lv_dropdown_set_selected(w2, 0); + lv_dropdown_set_dir(w2, LV_DIR_BOTTOM); + lv_obj_t *w3 = lv_label_create(w0); + objects.history_range = w3; + lv_obj_set_pos(w3, 165, 43); + lv_obj_set_size(w3, 145, 22); + lv_obj_clear_flag(w3, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w3, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w3, lv_color_hex(0x8DA6BB), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w3, LV_LABEL_LONG_CLIP); + lv_label_set_text(w3, "Noch keine Daten"); + lv_obj_t *w4 = lv_chart_create(w0); + objects.history_chart = w4; + lv_obj_set_pos(w4, 16, 78); + lv_obj_set_size(w4, 288, 56); + lv_obj_clear_flag(w4, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_opa(w4, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w4, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w4, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_line_color(w4, lv_color_hex(0x2A3A48), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_line_width(w4, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_chart_set_type(w4, LV_CHART_TYPE_LINE); + lv_chart_set_point_count(w4, 180); + lv_chart_set_div_line_count(w4, 3, 6); + lv_obj_t *w5 = lv_label_create(w0); + objects.history_caption = w5; + lv_obj_set_pos(w5, 16, 137); + lv_obj_set_size(w5, 290, 18); + lv_obj_clear_flag(w5, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w5, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w5, lv_color_hex(0x8DA6BB), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w5, LV_LABEL_LONG_CLIP); + lv_label_set_text(w5, "-30 min jetzt"); + lv_obj_t *w6 = lv_obj_create(w0); + objects.page_dot_2_0 = w6; + lv_obj_set_pos(w6, 139, 0); + lv_obj_set_size(w6, 7, 3); + lv_obj_clear_flag(w6, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w6, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w6, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w6, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w6, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w6, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w7 = lv_obj_create(w0); + objects.page_dot_2_1 = w7; + lv_obj_set_pos(w7, 151, 0); + lv_obj_set_size(w7, 7, 3); + lv_obj_clear_flag(w7, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w7, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w7, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w7, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w7, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w7, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w8 = lv_obj_create(w0); + objects.page_dot_2_2 = w8; + lv_obj_set_pos(w8, 163, 0); + lv_obj_set_size(w8, 7, 3); + lv_obj_clear_flag(w8, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w8, lv_color_hex(0x62D6C5), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w8, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w8, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w8, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w8, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w9 = lv_obj_create(w0); + objects.page_dot_2_3 = w9; + lv_obj_set_pos(w9, 175, 0); + lv_obj_set_size(w9, 7, 3); + lv_obj_clear_flag(w9, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w9, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w9, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w9, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); +} +void tick_screen_history(void) { +} +void create_screen_device(void) { + lv_obj_t *w0 = lv_obj_create(NULL); + objects.device = w0; + lv_obj_set_pos(w0, 0, 0); + lv_obj_set_size(w0, 320, 172); + lv_obj_clear_flag(w0, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w0, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_bg_color(w0, lv_color_hex(0x111923), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w0, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w0, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w1 = lv_label_create(w0); + objects.device_title = w1; + lv_obj_set_pos(w1, 12, 9); + lv_obj_set_size(w1, 220, 24); + lv_obj_clear_flag(w1, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w1, &ui_font_ubuntu_24, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w1, LV_LABEL_LONG_CLIP); + lv_label_set_text(w1, "Gerät"); + lv_obj_t *w2 = lv_label_create(w0); + objects.device_wifi = w2; + lv_obj_set_pos(w2, 12, 37); + lv_obj_set_size(w2, 296, 22); + lv_obj_clear_flag(w2, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w2, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w2, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w2, LV_LABEL_LONG_CLIP); + lv_label_set_text(w2, "WLAN: nicht verbunden"); + lv_obj_t *w3 = lv_label_create(w0); + objects.device_influx = w3; + lv_obj_set_pos(w3, 12, 58); + lv_obj_set_size(w3, 296, 22); + lv_obj_clear_flag(w3, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w3, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w3, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w3, LV_LABEL_LONG_CLIP); + lv_label_set_text(w3, "Influx: noch keine Übertragung"); + lv_obj_t *w4 = lv_label_create(w0); + objects.device_sensor = w4; + lv_obj_set_pos(w4, 12, 79); + lv_obj_set_size(w4, 296, 22); + lv_obj_clear_flag(w4, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w4, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w4, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w4, LV_LABEL_LONG_CLIP); + lv_label_set_text(w4, "Sensor: startet ..."); + lv_obj_t *w5 = lv_label_create(w0); + objects.brightness_label = w5; + lv_obj_set_pos(w5, 12, 104); + lv_obj_set_size(w5, 96, 22); + lv_obj_clear_flag(w5, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w5, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w5, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w5, LV_LABEL_LONG_CLIP); + lv_label_set_text(w5, "Licht 100%"); + lv_obj_t *w6 = lv_slider_create(w0); + objects.brightness = w6; + lv_obj_set_pos(w6, 119, 111); + lv_obj_set_size(w6, 177, 10); + lv_obj_clear_flag(w6, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w6, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_bg_color(w6, lv_color_hex(0x2A3A48), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w6, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_slider_set_range(w6, 20, 100); + lv_slider_set_value(w6, 100, LV_ANIM_OFF); + lv_obj_t *w7 = lv_label_create(w0); + objects.dim_label = w7; + lv_obj_set_pos(w7, 12, 132); + lv_obj_set_size(w7, 126, 20); + lv_obj_clear_flag(w7, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_text_font(w7, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w7, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_long_mode(w7, LV_LABEL_LONG_CLIP); + lv_label_set_text(w7, "Abdunkeln"); + lv_obj_t *w8 = lv_dropdown_create(w0); + objects.dim_timeout = w8; + lv_obj_set_pos(w8, 174, 128); + lv_obj_set_size(w8, 132, 27); + lv_obj_clear_flag(w8, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(w8, LV_OBJ_FLAG_CLICKABLE); + lv_obj_set_style_text_font(w8, &ui_font_ubuntu_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(w8, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_bottom(w8, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(w8, lv_color_hex(0x233544), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(w8, lv_color_hex(0xD9E3ED), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w8, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_dropdown_set_options(w8, "Aus\nNach 30 s\nNach 60 s\nNach 120 s"); + lv_dropdown_set_selected(w8, 2); + lv_dropdown_set_dir(w8, LV_DIR_TOP); + lv_obj_t *w9 = lv_obj_create(w0); + objects.page_dot_3_0 = w9; + lv_obj_set_pos(w9, 139, 0); + lv_obj_set_size(w9, 7, 3); + lv_obj_clear_flag(w9, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w9, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w9, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w9, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w9, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w10 = lv_obj_create(w0); + objects.page_dot_3_1 = w10; + lv_obj_set_pos(w10, 151, 0); + lv_obj_set_size(w10, 7, 3); + lv_obj_clear_flag(w10, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w10, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w10, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w10, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w10, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w10, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w11 = lv_obj_create(w0); + objects.page_dot_3_2 = w11; + lv_obj_set_pos(w11, 163, 0); + lv_obj_set_size(w11, 7, 3); + lv_obj_clear_flag(w11, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w11, lv_color_hex(0x526171), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w11, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w11, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w11, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w11, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_t *w12 = lv_obj_create(w0); + objects.page_dot_3_3 = w12; + lv_obj_set_pos(w12, 175, 0); + lv_obj_set_size(w12, 7, 3); + lv_obj_clear_flag(w12, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(w12, lv_color_hex(0x62D6C5), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(w12, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(w12, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(w12, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_all(w12, 0, LV_PART_MAIN | LV_STATE_DEFAULT); +} +void tick_screen_device(void) { +} +void create_screens(void) { + lv_disp_t *display = lv_disp_get_default(); + lv_disp_set_theme(display, lv_theme_default_init(display, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT)); create_screen_main(); + create_screen_page_2(); + create_screen_history(); + create_screen_device(); } +void tick_screen(int index) { + switch (index) { + case 0: tick_screen_main(); break; + case 1: tick_screen_page_2(); break; + case 2: tick_screen_history(); break; + case 3: tick_screen_device(); break; + default: break; + } +} +void tick_screen_by_id(enum ScreensEnum id) { tick_screen(id - 1); } diff --git a/firmware/components/eez_gui/screens.h b/firmware/components/eez_gui/screens.h index 5201bb5..91c1e94 100644 --- a/firmware/components/eez_gui/screens.h +++ b/firmware/components/eez_gui/screens.h @@ -1,15 +1,22 @@ -#ifndef EEZ_LVGL_UI_SCREENS_H -#define EEZ_LVGL_UI_SCREENS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _objects_t { +/* Generated by firmware/tools/export_display.py from the EEZ project. */ +#pragma once +#include +#ifdef __cplusplus +extern "C" { +#endif +typedef struct { lv_obj_t *main; + lv_obj_t *page_2; + lv_obj_t *history; + lv_obj_t *device; lv_obj_t *obj0; + lv_obj_t *obj5; + lv_obj_t *obj6; + lv_obj_t *obj7; + lv_obj_t *obj8; + lv_obj_t *obj9; + lv_obj_t *obj10; + lv_obj_t *obj11; lv_obj_t *obj1; lv_obj_t *obj2; lv_obj_t *obj3; @@ -20,32 +27,63 @@ typedef struct _objects_t { lv_obj_t *influx_off; lv_obj_t *mdns_ok; lv_obj_t *mdns_off; - lv_obj_t *obj5; - lv_obj_t *obj6; - lv_obj_t *obj7; - lv_obj_t *obj8; - lv_obj_t *obj9; - lv_obj_t *obj10; - lv_obj_t *obj11; + lv_obj_t *main_notice; + lv_obj_t *page_dot_0_0; + lv_obj_t *page_dot_0_1; + lv_obj_t *page_dot_0_2; + lv_obj_t *page_dot_0_3; + lv_obj_t *page_2_title; + lv_obj_t *room_state; + lv_obj_t *room_co2; + lv_obj_t *room_unit; + lv_obj_t *room_voc; + lv_obj_t *room_nox; + lv_obj_t *room_chart; + lv_obj_t *room_chart_caption; + lv_obj_t *page_dot_1_0; + lv_obj_t *page_dot_1_1; + lv_obj_t *page_dot_1_2; + lv_obj_t *page_dot_1_3; + lv_obj_t *history_title; + lv_obj_t *history_metric; + lv_obj_t *history_range; + lv_obj_t *history_chart; + lv_obj_t *history_caption; + lv_obj_t *page_dot_2_0; + lv_obj_t *page_dot_2_1; + lv_obj_t *page_dot_2_2; + lv_obj_t *page_dot_2_3; + lv_obj_t *device_title; + lv_obj_t *device_wifi; + lv_obj_t *device_influx; + lv_obj_t *device_sensor; + lv_obj_t *brightness_label; + lv_obj_t *brightness; + lv_obj_t *dim_label; + lv_obj_t *dim_timeout; + lv_obj_t *page_dot_3_0; + lv_obj_t *page_dot_3_1; + lv_obj_t *page_dot_3_2; + lv_obj_t *page_dot_3_3; } objects_t; - extern objects_t objects; - enum ScreensEnum { SCREEN_ID_MAIN = 1, + SCREEN_ID_PAGE_2 = 2, + SCREEN_ID_HISTORY = 3, + SCREEN_ID_DEVICE = 4, }; - -void create_screen_main(); -void tick_screen_main(); - -void tick_screen_by_id(enum ScreensEnum screenId); +void create_screen_main(void); +void tick_screen_main(void); +void create_screen_page_2(void); +void tick_screen_page_2(void); +void create_screen_history(void); +void tick_screen_history(void); +void create_screen_device(void); +void tick_screen_device(void); +void create_screens(void); void tick_screen(int screen_index); - -void create_screens(); - - -#ifdef __cplusplus -} -#endif - -#endif /*EEZ_LVGL_UI_SCREENS_H*/ \ No newline at end of file +void tick_screen_by_id(enum ScreensEnum screen_id); +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/eez_gui/ui_dashboard.c b/firmware/components/eez_gui/ui_dashboard.c new file mode 100644 index 0000000..7075e84 --- /dev/null +++ b/firmware/components/eez_gui/ui_dashboard.c @@ -0,0 +1,204 @@ +#include "ui_dashboard.h" +#include "ui_model.h" +#include "ui.h" +#include "fonts.h" +#include +#include + +static ui_display_config_t config; +static ui_brightness_cb_t set_brightness; +static ui_save_config_cb_t save_config; +static lv_chart_series_t *room_series, *history_series; +static uint32_t last_activity; +static bool initialized, dimmed, suppress_touch; +static const uint16_t dim_seconds[] = {0, 30, 60, 120}; +static const char *units[] = {"ppm", "µg/m³", "°C", "%", "Index", "Index"}; + +static void update_brightness_label(void) +{ + lv_label_set_text_fmt(objects.brightness_label, "Licht %u%%", config.brightness); +} + +static void settings_event(lv_event_t *event) +{ + lv_obj_t *target = lv_event_get_target(event); + if (target == objects.brightness) { + config.brightness = (uint8_t)lv_slider_get_value(target); + set_brightness(config.brightness); + update_brightness_label(); + /* Dragging previews immediately, persistence happens only on release. */ + if (lv_event_get_code(event) == LV_EVENT_RELEASED && save_config) save_config(&config); + } else if (target == objects.dim_timeout) { + unsigned selected = lv_dropdown_get_selected(target); + if (selected < sizeof(dim_seconds) / sizeof(dim_seconds[0])) { + config.dim_after_s = dim_seconds[selected]; + if (save_config) save_config(&config); + } + } + last_activity = lv_tick_get(); +} + +static void status_clicked(lv_event_t *event) +{ + (void)event; + loadScreen(SCREEN_ID_DEVICE); +} + +void ui_dashboard_init(ui_display_config_t selected, ui_brightness_cb_t brightness, + ui_save_config_cb_t save) +{ + config = selected; + if (config.brightness < 20 || config.brightness > 100) config.brightness = 100; + unsigned dim_index = 2; + for (unsigned i = 0; i < 4; ++i) if (config.dim_after_s == dim_seconds[i]) dim_index = i; + config.dim_after_s = dim_seconds[dim_index]; + set_brightness = brightness; + save_config = save; + dimmed = suppress_touch = false; + last_activity = lv_tick_get(); + initialized = true; + lv_slider_set_value(objects.brightness, config.brightness, LV_ANIM_OFF); + lv_obj_set_ext_click_area(objects.brightness, 12); + lv_dropdown_set_selected(objects.dim_timeout, dim_index); + update_brightness_label(); + /* Custom Ubuntu fonts do not contain LVGL's private-use arrow glyphs. */ + lv_obj_set_style_text_font(objects.history_metric, LV_FONT_DEFAULT, LV_PART_INDICATOR); + lv_obj_set_style_text_font(objects.dim_timeout, LV_FONT_DEFAULT, LV_PART_INDICATOR); + lv_obj_add_event_cb(objects.brightness, settings_event, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(objects.brightness, settings_event, LV_EVENT_RELEASED, NULL); + lv_obj_add_event_cb(objects.dim_timeout, settings_event, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_t *icons[] = {objects.wifi_ok, objects.wifi_off, objects.influx_ok, + objects.influx_off, objects.mdns_ok, objects.mdns_off}; + for (unsigned i = 0; i < sizeof(icons) / sizeof(icons[0]); ++i) { + lv_obj_add_flag(icons[i], LV_OBJ_FLAG_CLICKABLE); + lv_obj_add_event_cb(icons[i], status_clicked, LV_EVENT_CLICKED, NULL); + } + lv_chart_set_point_count(objects.room_chart, UI_HISTORY_POINTS); + lv_chart_set_point_count(objects.history_chart, UI_HISTORY_POINTS); + room_series = lv_chart_add_series(objects.room_chart, lv_color_hex(0x62D6C5), LV_CHART_AXIS_PRIMARY_Y); + history_series = lv_chart_add_series(objects.history_chart, lv_color_hex(0x62D6C5), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_set_all_value(objects.room_chart, room_series, LV_CHART_POINT_NONE); + lv_chart_set_all_value(objects.history_chart, history_series, LV_CHART_POINT_NONE); + lv_obj_set_style_size(objects.room_chart, 0, LV_PART_INDICATOR); + lv_obj_set_style_size(objects.history_chart, 0, LV_PART_INDICATOR); + lv_obj_set_style_line_width(objects.room_chart, 2, LV_PART_ITEMS); + lv_obj_set_style_line_width(objects.history_chart, 2, LV_PART_ITEMS); + set_brightness(config.brightness); +} + +void ui_dashboard_filter_touch(lv_indev_data_t *data) +{ + if (!initialized) return; + const bool pressed = data->state == LV_INDEV_STATE_PRESSED; + if (pressed) { + last_activity = lv_tick_get(); + if (dimmed) { + dimmed = false; + suppress_touch = true; + set_brightness(config.brightness); + } + } + if (suppress_touch) { + data->state = LV_INDEV_STATE_RELEASED; + if (!pressed) suppress_touch = false; + } +} + +static void format_value(lv_obj_t *label, const char *prefix, float value, unsigned decimals) +{ + if (!isfinite(value)) lv_label_set_text_fmt(label, "%s--", prefix); + else { + /* LVGL's compact printf is built without floating-point support. */ + char text[64]; + snprintf(text, sizeof(text), "%s%.*f", prefix, (int)decimals, (double)value); + lv_label_set_text(label, text); + } +} + +static void fill_chart(lv_obj_t *chart, lv_chart_series_t *series, + ui_metric_t metric, uint64_t now_ms, lv_obj_t *range_label) +{ + float values[UI_HISTORY_POINTS]; + ui_model_history(metric, now_ms, values); + float low = INFINITY, high = -INFINITY; + for (unsigned i = 0; i < UI_HISTORY_POINTS; ++i) { + if (isfinite(values[i])) { + if (values[i] < low) low = values[i]; + if (values[i] > high) high = values[i]; + } + } + /* Values use tenths in the plot. Never overflow LVGL's 16-bit coordinates. */ + const float scale = metric == UI_METRIC_CO2 ? 1.0f : 10.0f; + int minimum = isfinite(low) ? (int)floorf(low * scale) : 0; + int maximum = isfinite(high) ? (int)ceilf(high * scale) : 10; + int margin = (maximum - minimum) / 10; + if (margin < 5) margin = 5; + minimum -= margin; maximum += margin; + if (metric != UI_METRIC_TEMP && minimum < 0) minimum = 0; + if (minimum < -32000) minimum = -32000; + if (maximum > 32000) maximum = 32000; + if (maximum <= minimum) maximum = minimum + 1; + lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, minimum, maximum); + for (unsigned i = 0; i < UI_HISTORY_POINTS; ++i) { + float value = values[i] * scale; + series->y_points[i] = !isfinite(value) ? LV_CHART_POINT_NONE : + (lv_coord_t)lroundf(fminf(32000, fmaxf(-32000, value))); + } + lv_chart_refresh(chart); + if (range_label) { + if (isfinite(low)) { + char text[64]; + snprintf(text, sizeof(text), "%.0f..%.0f %s", minimum / scale, maximum / scale, units[metric]); + lv_label_set_text(range_label, text); + } + else lv_label_set_text(range_label, "Noch keine Daten"); + } +} + +void ui_dashboard_tick(uint64_t now_ms, const ui_device_status_t *status) +{ + if (!initialized) return; + lv_obj_t *on[] = {objects.wifi_ok, objects.influx_ok, objects.mdns_ok}; + lv_obj_t *off[] = {objects.wifi_off, objects.influx_off, objects.mdns_off}; + bool ok[] = {status->wifi_connected, status->influx_ok, status->mdns_ok}; + for (unsigned i = 0; i < 3; ++i) { + lv_obj_add_flag(ok[i] ? off[i] : on[i], LV_OBJ_FLAG_HIDDEN); + lv_obj_clear_flag(ok[i] ? on[i] : off[i], LV_OBJ_FLAG_HIDDEN); + } + if (!dimmed && config.dim_after_s && + lv_tick_elaps(last_activity) >= (uint32_t)config.dim_after_s * 1000) { + dimmed = true; + set_brightness(15); + } + ui_sample_t sample; + ui_model_snapshot(&sample); + const uint64_t age = sample.available && now_ms >= sample.timestamp_ms ? now_ms - sample.timestamp_ms : 0; + const bool fresh = sample.available && now_ms >= sample.timestamp_ms && age <= UI_SENSOR_STALE_MS; + const char *state = !sample.available ? "Sensor startet ..." : fresh ? "Live / 1 Messung pro Sekunde" : "Messwerte veraltet"; + lv_label_set_text(objects.room_state, state); + if (fresh) lv_obj_add_flag(objects.main_notice, LV_OBJ_FLAG_HIDDEN); + else { + lv_obj_clear_flag(objects.main_notice, LV_OBJ_FLAG_HIDDEN); + lv_label_set_text(objects.main_notice, state); + lv_obj_t *values[] = {objects.obj5, objects.obj6, objects.obj7, objects.obj8, + objects.obj9, objects.obj10, objects.obj11}; + for (unsigned i = 0; i < sizeof(values) / sizeof(values[0]); ++i) lv_label_set_text(values[i], "--"); + } + format_value(objects.room_co2, "", fresh ? sample.values[UI_METRIC_CO2] : NAN, 0); + format_value(objects.room_voc, "VOC-Index ", fresh ? sample.values[UI_METRIC_VOC] : NAN, 0); + format_value(objects.room_nox, "NOx-Index ", fresh ? sample.values[UI_METRIC_NOX] : NAN, 0); + if (fresh && !isfinite(sample.values[UI_METRIC_CO2])) + lv_label_set_text(objects.room_state, "CO2-Kanal nicht verfügbar"); + fill_chart(objects.room_chart, room_series, UI_METRIC_CO2, now_ms, NULL); + unsigned metric = lv_dropdown_get_selected(objects.history_metric); + if (metric >= UI_METRIC_COUNT) metric = UI_METRIC_CO2; + fill_chart(objects.history_chart, history_series, (ui_metric_t)metric, now_ms, objects.history_range); + lv_label_set_text_fmt(objects.device_wifi, "WLAN: %s", status->wifi_connected ? status->ip : "nicht verbunden"); + if (status->last_influx_success_ms && now_ms >= status->last_influx_success_ms) { + unsigned seconds = (unsigned)((now_ms - status->last_influx_success_ms) / 1000); + if (seconds < 60) lv_label_set_text_fmt(objects.device_influx, "Influx: vor %u s / %s", seconds, status->influx_ok ? "OK" : "Fehler"); + else lv_label_set_text_fmt(objects.device_influx, "Influx: vor %u min / %s", seconds / 60, status->influx_ok ? "OK" : "Fehler"); + } else lv_label_set_text(objects.device_influx, "Influx: noch keine Übertragung"); + if (!sample.available) lv_label_set_text(objects.device_sensor, "Sensor: startet / wartet auf Daten"); + else lv_label_set_text_fmt(objects.device_sensor, "Sensor: %s / vor %u s", fresh ? "OK" : "veraltet", (unsigned)(age / 1000)); +} diff --git a/firmware/components/eez_gui/ui_dashboard.h b/firmware/components/eez_gui/ui_dashboard.h new file mode 100644 index 0000000..c6206ac --- /dev/null +++ b/firmware/components/eez_gui/ui_dashboard.h @@ -0,0 +1,23 @@ +#pragma once +#include +#include +#include + +typedef struct { + uint8_t brightness; /* 20..100 percent */ + uint16_t dim_after_s; /* 0, 30, 60, 120 */ +} ui_display_config_t; +typedef struct { + bool wifi_connected, influx_ok, mdns_ok; + char ip[16]; + uint64_t last_influx_success_ms; /* zero until first successful HTTP 204 */ +} ui_device_status_t; +typedef void (*ui_brightness_cb_t)(uint8_t percent); +typedef void (*ui_save_config_cb_t)(const ui_display_config_t *config); + +/* All calls run on the LVGL task or while its lock is held. */ +void ui_dashboard_init(ui_display_config_t config, ui_brightness_cb_t brightness, + ui_save_config_cb_t save); +void ui_dashboard_tick(uint64_t now_ms, const ui_device_status_t *status); +/* Wrap the touch read callback, so the wake-up touch cannot activate controls. */ +void ui_dashboard_filter_touch(lv_indev_data_t *data); diff --git a/firmware/components/eez_gui/ui_model.c b/firmware/components/eez_gui/ui_model.c new file mode 100644 index 0000000..de8e572 --- /dev/null +++ b/firmware/components/eez_gui/ui_model.c @@ -0,0 +1,65 @@ +#include "ui_model.h" +#include +#include +#ifdef ESP_PLATFORM +#include "freertos/FreeRTOS.h" +#include "freertos/portmacro.h" +static portMUX_TYPE model_mux = portMUX_INITIALIZER_UNLOCKED; +#define LOCK() portENTER_CRITICAL(&model_mux) +#define UNLOCK() portEXIT_CRITICAL(&model_mux) +#else +#define LOCK() ((void)0) +#define UNLOCK() ((void)0) +#endif + +typedef struct { + uint64_t bucket; + float sum[UI_METRIC_COUNT]; + uint16_t count[UI_METRIC_COUNT]; + bool used; +} history_bin_t; +static ui_sample_t latest; +static history_bin_t bins[UI_HISTORY_POINTS]; + +void ui_model_publish(const ui_sample_t *sample) +{ + if (!sample || !sample->available) return; + const uint64_t bucket = sample->timestamp_ms / UI_HISTORY_BUCKET_MS; + LOCK(); + latest = *sample; + history_bin_t *bin = &bins[bucket % UI_HISTORY_POINTS]; + if (!bin->used || bin->bucket != bucket) { + *bin = (history_bin_t){.bucket = bucket, .used = true}; + } + for (unsigned i = 0; i < UI_METRIC_COUNT; ++i) { + if (isfinite(sample->values[i]) && bin->count[i] < UINT16_MAX) { + bin->sum[i] += sample->values[i]; + ++bin->count[i]; + } + } + UNLOCK(); +} + +void ui_model_snapshot(ui_sample_t *sample) +{ + LOCK(); + *sample = latest; + UNLOCK(); +} + +void ui_model_history(ui_metric_t metric, uint64_t now_ms, float *values) +{ + const uint64_t last_bucket = now_ms / UI_HISTORY_BUCKET_MS; + LOCK(); + for (unsigned i = 0; i < UI_HISTORY_POINTS; ++i) { + const unsigned age = UI_HISTORY_POINTS - 1 - i; + values[i] = NAN; + if ((unsigned)metric >= UI_METRIC_COUNT || last_bucket < age) continue; + const uint64_t bucket = last_bucket - age; + const history_bin_t *bin = &bins[bucket % UI_HISTORY_POINTS]; + if (bin->used && bin->bucket == bucket && bin->count[metric]) { + values[i] = bin->sum[metric] / bin->count[metric]; + } + } + UNLOCK(); +} diff --git a/firmware/components/eez_gui/ui_model.h b/firmware/components/eez_gui/ui_model.h new file mode 100644 index 0000000..6825c8a --- /dev/null +++ b/firmware/components/eez_gui/ui_model.h @@ -0,0 +1,23 @@ +#pragma once +#include +#include + +#define UI_HISTORY_POINTS 180 +#define UI_HISTORY_BUCKET_MS 10000 +#define UI_SENSOR_STALE_MS 5000 + +typedef enum { + UI_METRIC_CO2, UI_METRIC_PM25, UI_METRIC_TEMP, UI_METRIC_RH, + UI_METRIC_VOC, UI_METRIC_NOX, UI_METRIC_COUNT +} ui_metric_t; +typedef struct { + uint64_t timestamp_ms; + float values[UI_METRIC_COUNT]; /* ppm, ug/m3, degC, %, VOC index, NOx index */ + bool available; +} ui_sample_t; + +/* Producer submits scaled numbers, with NAN for unavailable channels. No LVGL calls. */ +void ui_model_publish(const ui_sample_t *sample); +void ui_model_snapshot(ui_sample_t *sample); +/* 180 fixed ten-second bins, oldest first; empty bins are NAN. RAM only. */ +void ui_model_history(ui_metric_t metric, uint64_t now_ms, float *values); diff --git a/firmware/components/eez_gui/ui_navigation.c b/firmware/components/eez_gui/ui_navigation.c new file mode 100644 index 0000000..567ed82 --- /dev/null +++ b/firmware/components/eez_gui/ui_navigation.c @@ -0,0 +1,47 @@ +#include "ui_navigation.h" +#include "esp_log.h" +#include "screens.h" +#include "ui.h" + +static void screen_gesture_cb(lv_event_t *event) +{ + lv_indev_t *input = lv_indev_get_act(); + if (!input || lv_dropdown_is_open(objects.history_metric) || + lv_dropdown_is_open(objects.dim_timeout)) return; + lv_obj_t *screen = lv_event_get_current_target(event); + lv_obj_t *screens[] = {objects.main, objects.page_2, objects.history, objects.device}; + unsigned index = 0; + while (index < 4 && screens[index] != screen) ++index; + if (index >= 4) return; + lv_dir_t direction = lv_indev_get_gesture_dir(input); + unsigned next = index; + if (direction == LV_DIR_LEFT && index < 3) ++next; + else if (direction == LV_DIR_RIGHT && index > 0) --next; + if (next == index) return; + lv_indev_wait_release(input); + loadScreen((enum ScreensEnum)(next + 1)); + ESP_LOGI("ui_navigation", "Swipe: page %u -> %u", index + 1, next + 1); +} + +static void prepare_gestures(lv_obj_t *object) +{ + lv_obj_clear_flag(object, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(object, LV_OBJ_FLAG_GESTURE_BUBBLE); + for (uint32_t i = 0; i < lv_obj_get_child_cnt(object); ++i) + prepare_gestures(lv_obj_get_child(object, i)); +} + +void ui_navigation_init(void) +{ + lv_obj_t *screens[] = {objects.main, objects.page_2, objects.history, objects.device}; + for (unsigned i = 0; i < 4; ++i) { + prepare_gestures(screens[i]); + lv_obj_clear_flag(screens[i], LV_OBJ_FLAG_GESTURE_BUBBLE); + lv_obj_add_event_cb(screens[i], screen_gesture_cb, LV_EVENT_GESTURE, NULL); + } + /* Sliders/dropdowns own their gestures; changing brightness must not navigate. */ + lv_obj_clear_flag(objects.brightness, LV_OBJ_FLAG_GESTURE_BUBBLE); + lv_obj_clear_flag(objects.history_metric, LV_OBJ_FLAG_GESTURE_BUBBLE); + lv_obj_clear_flag(objects.dim_timeout, LV_OBJ_FLAG_GESTURE_BUBBLE); + ESP_LOGI("ui_navigation", "Ready: 4 pages / measurements, air, history, device"); +} diff --git a/firmware/components/eez_gui/ui_navigation.h b/firmware/components/eez_gui/ui_navigation.h new file mode 100644 index 0000000..9ce1f6a --- /dev/null +++ b/firmware/components/eez_gui/ui_navigation.h @@ -0,0 +1,4 @@ +#pragma once + +/* Call once after ui_init(), with the LVGL lock held. Kept outside EEZ exports. */ +void ui_navigation_init(void); diff --git a/firmware/components/net_influx/src/net_influx.c b/firmware/components/net_influx/src/net_influx.c index 6929411..d6fe696 100644 --- a/firmware/components/net_influx/src/net_influx.c +++ b/firmware/components/net_influx/src/net_influx.c @@ -288,6 +288,7 @@ static esp_err_t net_influx_write_line(const char* line) { esp_http_client_cleanup(h); ok = (err == ESP_OK && status == 204); + if (ok) sys_status_record_influx_success(); sys_status_set_influx_ok(ok); return ok ? ESP_OK : ESP_FAIL; } diff --git a/firmware/components/sen5x/CMakeLists.txt b/firmware/components/sen5x/CMakeLists.txt index 0e42162..eb8580a 100644 --- a/firmware/components/sen5x/CMakeLists.txt +++ b/firmware/components/sen5x/CMakeLists.txt @@ -18,4 +18,5 @@ idf_component_register( eez_gui storage hardware_config + esp_timer ) diff --git a/firmware/components/sen5x/air_sensor_app.c b/firmware/components/sen5x/air_sensor_app.c index 0da6dba..b236275 100644 --- a/firmware/components/sen5x/air_sensor_app.c +++ b/firmware/components/sen5x/air_sensor_app.c @@ -24,6 +24,8 @@ #include #include // NAN, isfinite, lround #include "vars.h" +#include "ui_model.h" +#include "esp_timer.h" static const char* TAG = "air_sensor_app"; @@ -188,26 +190,28 @@ static void air_sensor_task_producer(void* arg) { // float noxf = (s.nox_idx == 0x7FFF) ? NAN : s.nox_idx / 10.0f; // bei Bedarf anzeigen // Temperatur - snprintf(buf, sizeof(buf), "%.1f", (double)s.temp_c); + if (isfinite(s.temp_c)) snprintf(buf, sizeof(buf), "%.1f", (double)s.temp_c); + else snprintf(buf, sizeof(buf), "--"); set_var_temp(buf); // Feuchte - snprintf(buf, sizeof(buf), "%.1f", (double)s.rh_pct); + if (isfinite(s.rh_pct)) snprintf(buf, sizeof(buf), "%.1f", (double)s.rh_pct); + else snprintf(buf, sizeof(buf), "--"); set_var_humidity(buf); - // VOC-Index (gerundet), falls NAN → "nan" - if (!isfinite(vocf)) snprintf(buf, sizeof(buf), "nan"); + // VOC-Index (gerundet), nicht verfügbare Werte als "--" + if (!isfinite(vocf)) snprintf(buf, sizeof(buf), "--"); else snprintf(buf, sizeof(buf), "%d", (int)lround(vocf)); set_var_voc_ind(buf); // PM (µg/m³) mit einer Nachkommastelle - if (!isfinite(pm10f)) snprintf(buf, sizeof(buf), "nan"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm10f); + if (!isfinite(pm10f)) snprintf(buf, sizeof(buf), "--"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm10f); set_var_pm10p0(buf); - if (!isfinite(pm4f)) snprintf(buf, sizeof(buf), "nan"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm4f); + if (!isfinite(pm4f)) snprintf(buf, sizeof(buf), "--"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm4f); set_var_pm4p0(buf); - if (!isfinite(pm2f)) snprintf(buf, sizeof(buf), "nan"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm2f); + if (!isfinite(pm2f)) snprintf(buf, sizeof(buf), "--"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm2f); set_var_pm2p5(buf); - if (!isfinite(pm1f)) snprintf(buf, sizeof(buf), "nan"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm1f); + if (!isfinite(pm1f)) snprintf(buf, sizeof(buf), "--"); else snprintf(buf, sizeof(buf), "%.1f", (double)pm1f); set_var_pm1p0(buf); /* === Influx submit (generisch, variabel viele Felder) === */ @@ -220,6 +224,15 @@ static void air_sensor_task_producer(void* arg) { const double temp = (double)s.temp_c; const double rh = (double)s.rh_pct; const double co2 = (co2_raw == UINT16_MAX) ? NAN : (double)co2_raw; +#if NANOPSX_HAS_DISPLAY + ui_sample_t display_sample = { + .timestamp_ms = (uint64_t)(esp_timer_get_time() / 1000), + .available = true, + .values = {(float)co2, (float)pm2_5, (float)temp, + (float)rh, (float)voc, (float)nox} + }; + ui_model_publish(&display_sample); +#endif static unsigned samples; if (++samples % 10 == 0) { ESP_LOGI(TAG, "%s sample: PM2.5=%.1f temp=%.2f rh=%.2f CO2=%.0f", diff --git a/firmware/components/sys_status/CMakeLists.txt b/firmware/components/sys_status/CMakeLists.txt index 1a6f7f5..cc1d960 100644 --- a/firmware/components/sys_status/CMakeLists.txt +++ b/firmware/components/sys_status/CMakeLists.txt @@ -3,6 +3,6 @@ idf_component_register( "src/sys_status.c" INCLUDE_DIRS "include" - REQUIRES + REQUIRES esp_timer ) diff --git a/firmware/components/sys_status/include/sys_status.h b/firmware/components/sys_status/include/sys_status.h index 25beaf2..82e26b3 100644 --- a/firmware/components/sys_status/include/sys_status.h +++ b/firmware/components/sys_status/include/sys_status.h @@ -1,6 +1,7 @@ // File: firmware/components/sys_status/include/sys_status.h #pragma once #include +#include #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" @@ -25,6 +26,10 @@ static inline bool sys_status_get_wifi_ok(void) { return (xEventGroupGetBits(s static inline bool sys_status_get_influx_ok(void) { return (xEventGroupGetBits(sys_status_group()) & SYS_STATUS_INFLUX_OK) != 0; } static inline bool sys_status_get_mdns_ok(void) { return (xEventGroupGetBits(sys_status_group()) & SYS_STATUS_MDNS_OK) != 0; } +/* Monotonic timestamp of a confirmed HTTP 204, never merely a WLAN connection. */ +void sys_status_record_influx_success(void); +uint64_t sys_status_last_influx_success_ms(void); + #ifdef __cplusplus } #endif diff --git a/firmware/components/sys_status/src/sys_status.c b/firmware/components/sys_status/src/sys_status.c index 127a5f3..90d2a4e 100644 --- a/firmware/components/sys_status/src/sys_status.c +++ b/firmware/components/sys_status/src/sys_status.c @@ -21,3 +21,22 @@ EventGroupHandle_t sys_status_group(void) if (!s_status_group) sys_status_init(); return s_status_group; } + +#include "esp_timer.h" +#include "freertos/portmacro.h" +static portMUX_TYPE influx_time_mux = portMUX_INITIALIZER_UNLOCKED; +static uint64_t last_influx_success; +void sys_status_record_influx_success(void) +{ + uint64_t now = (uint64_t)(esp_timer_get_time() / 1000); + portENTER_CRITICAL(&influx_time_mux); + last_influx_success = now; + portEXIT_CRITICAL(&influx_time_mux); +} +uint64_t sys_status_last_influx_success_ms(void) +{ + portENTER_CRITICAL(&influx_time_mux); + uint64_t result = last_influx_success; + portEXIT_CRITICAL(&influx_time_mux); + return result; +} diff --git a/firmware/platformio.ini b/firmware/platformio.ini index 83af333..91be169 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -9,4 +9,4 @@ monitor_speed = 115200 monitor_dtr = 0 monitor_rts = 0 board_build.partitions = partitions.csv -; extra_scripts = scripts/enable_ccache.py +extra_scripts = pre:tools/pio_display.py diff --git a/firmware/src/main.c b/firmware/src/main.c index 5944a6b..3c34200 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -35,6 +35,10 @@ #include "demos/lv_demos.h" #include "ui.h" +#include "ui_navigation.h" +#include "ui_dashboard.h" +#include "nvs.h" +#include "esp_netif.h" #include "i2cdev.h" #include "sys_status.h" @@ -73,61 +77,6 @@ static void app_save_device_info( storage_save_influx_softap(org, bucket, token); } -// ---------- Status-Icons updaten: nutzt die in screens.c erzeugten Objekte ---------- -static void ui_update_status_icons(void) -{ - static bool first = true; - static bool pw=false, pi=false, pm=false; - - bool w = sys_status_get_wifi_ok(); - bool i = sys_status_get_influx_ok(); - bool m = sys_status_get_mdns_ok(); - - // WiFi - if (first || w != pw) { - if (objects.wifi_ok && objects.wifi_off) { - if (w) { - lv_obj_clear_flag(objects.wifi_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag (objects.wifi_off, LV_OBJ_FLAG_HIDDEN); - } else { - lv_obj_add_flag (objects.wifi_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(objects.wifi_off, LV_OBJ_FLAG_HIDDEN); - } - } - pw = w; - } - - // Influx - if (first || i != pi) { - if (objects.influx_ok && objects.influx_off) { - if (i) { - lv_obj_clear_flag(objects.influx_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag (objects.influx_off, LV_OBJ_FLAG_HIDDEN); - } else { - lv_obj_add_flag (objects.influx_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(objects.influx_off, LV_OBJ_FLAG_HIDDEN); - } - } - pi = i; - } - - // mDNS - if (first || m != pm) { - if (objects.mdns_ok && objects.mdns_off) { - if (m) { - lv_obj_clear_flag(objects.mdns_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag (objects.mdns_off, LV_OBJ_FLAG_HIDDEN); - } else { - lv_obj_add_flag (objects.mdns_ok, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(objects.mdns_off, LV_OBJ_FLAG_HIDDEN); - } - } - pm = m; - } - - first = false; -} - #define EXAMPLE_DISPLAY_ROTATION 270 #if EXAMPLE_DISPLAY_ROTATION == 90 || EXAMPLE_DISPLAY_ROTATION == 270 @@ -236,12 +185,57 @@ static esp_err_t app_lvgl_init(void) return ESP_OK; } +#if NANOPSX_HAS_DISPLAY +static void (*original_touch_read)(lv_indev_drv_t *, lv_indev_data_t *); +static void filtered_touch_read(lv_indev_drv_t *driver, lv_indev_data_t *data) +{ + original_touch_read(driver, data); + ui_dashboard_filter_touch(data); +} + +static ui_display_config_t load_display_config(void) +{ + ui_display_config_t result = {.brightness = 100, .dim_after_s = 60}; + nvs_handle_t handle; + if (nvs_open("ui_display", NVS_READONLY, &handle) == ESP_OK) { + nvs_get_u8(handle, "brightness", &result.brightness); + nvs_get_u16(handle, "dim_after", &result.dim_after_s); + nvs_close(handle); + } + return result; +} + +static void save_display_config(const ui_display_config_t *config) +{ + nvs_handle_t handle; + esp_err_t err = nvs_open("ui_display", NVS_READWRITE, &handle); + if (err == ESP_OK) { + err = nvs_set_u8(handle, "brightness", config->brightness); + if (err == ESP_OK) err = nvs_set_u16(handle, "dim_after", config->dim_after_s); + if (err == ESP_OK) err = nvs_commit(handle); + nvs_close(handle); + } + if (err != ESP_OK) ESP_LOGW("display", "Cannot save settings: %s", esp_err_to_name(err)); +} +#endif + static void ui_tick_cb(lv_timer_t *t) { (void)t; app_update_mdns_status_from_nvs(); if (lvgl_port_lock(0)) { - ui_update_status_icons(); tick_screen(0); + ui_device_status_t status = { + .wifi_connected = sys_status_get_wifi_ok(), + .influx_ok = sys_status_get_influx_ok(), + .mdns_ok = sys_status_get_mdns_ok(), + .last_influx_success_ms = sys_status_last_influx_success_ms() + }; + snprintf(status.ip, sizeof(status.ip), "verbunden"); + esp_netif_t *netif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"); + esp_netif_ip_info_t ip; + if (netif && esp_netif_get_ip_info(netif, &ip) == ESP_OK && ip.ip.addr) + snprintf(status.ip, sizeof(status.ip), IPSTR, IP2STR(&ip.ip)); + ui_dashboard_tick((uint64_t)(esp_timer_get_time() / 1000), &status); lvgl_port_unlock(); } } @@ -404,11 +398,16 @@ void app_main(void) if (lvgl_port_lock(0)) { ui_init(); // erzeugt auch die Objekte in screens.c + ui_dashboard_init(load_display_config(), bsp_display_set_brightness, save_display_config); + ui_navigation_init(); + if (lvgl_touch_indev) { + original_touch_read = lvgl_touch_indev->driver->read_cb; + lvgl_touch_indev->driver->read_cb = filtered_touch_read; + } + lv_timer_create(ui_tick_cb, 1000, NULL); lvgl_port_unlock(); } - lv_timer_t *ui_timer = lv_timer_create(ui_tick_cb, 1000, NULL); - (void)ui_timer; #endif diff --git a/firmware/test/ui/run_tests.py b/firmware/test/ui/run_tests.py new file mode 100644 index 0000000..cca9c79 --- /dev/null +++ b/firmware/test/ui/run_tests.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""Run native UI integration tests against the project's actual LVGL sources.""" +from pathlib import Path +import subprocess +import tempfile +import sys + +firmware = Path(__file__).resolve().parents[2] +lvgl = firmware / 'managed_components/lvgl__lvgl' +ui = firmware / 'components/eez_gui' +with tempfile.TemporaryDirectory(prefix='nanopsx-ui-') as directory: + build = Path(directory) + (build / 'esp_log.h').write_text('#pragma once\n#define ESP_LOGI(...) ((void)0)\n') + sources = list((lvgl / 'src').rglob('*.c')) + sources += [ui / name for name in ['ui.c', 'screens.c', 'ui_navigation.c', 'ui_dashboard.c', 'ui_model.c', 'ui_font_ubuntu_16.c', + 'ui_font_ubuntu_24.c', 'ui_font_pigiarniq_italic_34.c']] + sources += list(ui.glob('ui_image_*.c')) + sources += [Path(__file__).with_name('test_navigation.c')] + subprocess.run(['cc', '-std=c99', '-O0', '-g', '-DLV_CONF_SKIP', + '-DLV_MEM_SIZE=49152', '-I', str(build), '-I', str(lvgl), + '-I', str(ui), *map(str, sources), '-lm', + '-o', str(build / 'test_navigation')], check=True) + subprocess.run([str(build / 'test_navigation'), *sys.argv[1:]], check=True) diff --git a/firmware/test/ui/test_navigation.c b/firmware/test/ui/test_navigation.c new file mode 100644 index 0000000..4b80bb5 --- /dev/null +++ b/firmware/test/ui/test_navigation.c @@ -0,0 +1,175 @@ +/* Integration tests use the actual LVGL pointer pipeline, charts and EEZ exports. */ +#include +#include +#include +#include +#include +#include "ui.h" +#include "ui_navigation.h" +#include "ui_dashboard.h" +#include "ui_model.h" + +static lv_indev_data_t sample; +static uint32_t framebuffer[172][320]; +static unsigned brightness, saved; +static ui_display_config_t saved_config; +static void set_light(uint8_t value) { brightness = value; } +static void save_settings(const ui_display_config_t *value) { saved_config = *value; ++saved; } +static void read_pointer(lv_indev_drv_t *drv, lv_indev_data_t *data) +{ + (void)drv; *data = sample; + ui_dashboard_filter_touch(data); +} +static void flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *colors) +{ + for (int y = area->y1; y <= area->y2; ++y) + for (int x = area->x1; x <= area->x2; ++x) { + if (x >= 0 && x < 320 && y >= 0 && y < 172) framebuffer[y][x] = lv_color_to32(*colors); + ++colors; + } + lv_disp_flush_ready(drv); +} +static void advance(unsigned ms) +{ + for (unsigned i = 0; i < ms; i += 10) { lv_tick_inc(10); lv_timer_handler(); } +} +static void point(int x, int y, bool pressed) +{ + sample.point.x = x; sample.point.y = y; + sample.state = pressed ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED; + advance(40); +} +static void swipe(int x, int y, int dx, int dy) +{ + point(x, y, true); + for (int i = 1; i <= 8; ++i) point(x + i * dx, y + i * dy, true); + point(x + 8 * dx, y + 8 * dy, false); + advance(300); + ui_tick(); +} +static void screenshot(const char *directory, unsigned page) +{ + if (!directory) return; + char path[1024]; snprintf(path,sizeof(path),"%s/page-%u.ppm",directory,page); + FILE *file = fopen(path,"wb"); assert(file); + fprintf(file,"P6\n320 172\n255\n"); + for (unsigned y=0;y<172;++y) for(unsigned x=0;x<320;++x) { + uint32_t c=framebuffer[y][x]; + unsigned char rgb[]={c>>16,c>>8,c}; fwrite(rgb,1,3,file); + } + fclose(file); +} +#define VALUE(name, text) const char *get_var_##name(void) { return text; } +VALUE(pm1p0,"3.2") VALUE(pm2p5,"6.8") VALUE(pm4p0,"7.1") VALUE(pm10p0,"7.3") +VALUE(voc_ind,"98") VALUE(humidity,"42.1") VALUE(temp,"23.4") + +int main(int argc, char **argv) +{ + lv_init(); + static lv_color_t pixels[320 * 10]; + static lv_disp_draw_buf_t buffer; + lv_disp_draw_buf_init(&buffer,pixels,NULL,320*10); + lv_disp_drv_t display; lv_disp_drv_init(&display); + display.hor_res=320; display.ver_res=172; display.draw_buf=&buffer; display.flush_cb=flush; + lv_disp_drv_register(&display); + lv_indev_drv_t pointer; lv_indev_drv_init(&pointer); + pointer.type=LV_INDEV_TYPE_POINTER; pointer.read_cb=read_pointer; + lv_indev_drv_register(&pointer); + ui_init(); + ui_dashboard_init((ui_display_config_t){100,60},set_light,save_settings); + ui_navigation_init(); advance(300); + ui_device_status_t status={.wifi_connected=true,.influx_ok=true,.mdns_ok=true, + .ip="192.168.50.86",.last_influx_success_ms=1790000}; + ui_dashboard_tick(1000,&status); + assert(strstr(lv_label_get_text(objects.room_state),"startet")); + assert(strcmp(lv_label_get_text(objects.room_co2),"--")==0); + assert(!lv_obj_has_flag(objects.main_notice,LV_OBJ_FLAG_HIDDEN)); + ui_sample_t data={.available=true}; + /* Realistic 30-minute test data exercises the complete ring buffer and chart. */ + for (unsigned i=0;i<180;++i) { + data.timestamp_ms=1000+i*10000; + data.values[UI_METRIC_CO2]=900+150*sinf(i/15.0f); + data.values[UI_METRIC_PM25]=6.8f+2*sinf(i/10.0f); + data.values[UI_METRIC_TEMP]=23.4f; + data.values[UI_METRIC_RH]=42.1f; + data.values[UI_METRIC_VOC]=98; + data.values[UI_METRIC_NOX]=1; + ui_model_publish(&data); + } + ui_dashboard_tick(data.timestamp_ms,&status); tick_screen(0); advance(300); + assert(lv_obj_has_flag(objects.main_notice,LV_OBJ_FLAG_HIDDEN)); + assert(atoi(lv_label_get_text(objects.room_co2))>700); + const char *previews=argc>1?argv[1]:NULL; + screenshot(previews,1); + point(160,80,true); point(160,80,false); advance(300); + assert(lv_scr_act()==objects.main); + swipe(140,80,-1,0); assert(lv_scr_act()==objects.main); + swipe(160,20,0,15); assert(lv_scr_act()==objects.main); + swipe(40,80,25,0); assert(lv_scr_act()==objects.main); + swipe(280,80,-25,0); assert(lv_scr_act()==objects.page_2); + screenshot(previews,2); + swipe(280,80,-25,0); assert(lv_scr_act()==objects.history); + for(unsigned i=0;i=20 && brightness<100 && saved>0); + unsigned before=brightness, save_count=saved; + advance(61000); ui_dashboard_tick(data.timestamp_ms,&status); + assert(brightness==15); + point(170,111,true); point(170,111,false); + assert(brightness==before && saved==save_count); /* first touch wakes only */ + point(220,111,true); point(220,111,false); + assert(brightness!=before && saved>save_count); + lv_dropdown_set_selected(objects.dim_timeout,0); + lv_event_send(objects.dim_timeout,LV_EVENT_VALUE_CHANGED,NULL); + assert(saved_config.dim_after_s==0); + advance(121000); ui_dashboard_tick(data.timestamp_ms,&status); + assert(brightness==saved_config.brightness); + /* Freshness is independent of network connectivity and missing channels. */ + ui_dashboard_tick(data.timestamp_ms+6000,&status); + assert(strstr(lv_label_get_text(objects.room_state),"veraltet")); + assert(strcmp(lv_label_get_text(objects.room_co2),"--")==0); + data.values[UI_METRIC_CO2]=NAN; + data.timestamp_ms+=10000; ui_model_publish(&data); + status.wifi_connected=false; status.influx_ok=false; + ui_dashboard_tick(data.timestamp_ms,&status); + assert(strstr(lv_label_get_text(objects.room_state),"nicht verfügbar")); + assert(strstr(lv_label_get_text(objects.device_wifi),"nicht verbunden")); + assert(strstr(lv_label_get_text(objects.device_influx),"Fehler")); + for(unsigned repeat=0;repeat<3;++repeat) { + swipe(40,20,25,0); assert(lv_scr_act()==objects.history); + swipe(40,20,25,0); assert(lv_scr_act()==objects.page_2); + swipe(40,20,25,0); assert(lv_scr_act()==objects.main); + swipe(280,20,-25,0); assert(lv_scr_act()==objects.page_2); + swipe(280,20,-25,0); assert(lv_scr_act()==objects.history); + swipe(280,20,-25,0); assert(lv_scr_act()==objects.device); + } + /* Ten-second means, gap preservation, missing-channel independence, eviction. */ + float history[UI_HISTORY_POINTS]; + uint64_t base=4000000; + data.timestamp_ms=base; data.values[0]=800; ui_model_publish(&data); + data.timestamp_ms=base+1000; data.values[0]=1000; ui_model_publish(&data); + ui_model_history(UI_METRIC_CO2,base+1000,history); + assert(fabsf(history[179]-900)<0.01f); + ui_model_history(UI_METRIC_CO2,base+20000,history); + assert(isnan(history[179]) && isnan(history[178]) && history[177]==900); + ui_model_history(UI_METRIC_CO2,base+1810000,history); + for(unsigned i=0;i<180;++i) assert(isnan(history[i])); + puts("PASS: four-page navigation, controls, popup isolation, wake-only touch, dim settings, stale/missing data, six charts, history means/gaps/eviction"); +} diff --git a/firmware/tools/export_display.py b/firmware/tools/export_display.py new file mode 100644 index 0000000..eb87b86 --- /dev/null +++ b/firmware/tools/export_display.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Export this project's static EEZ/LVGL screens without a desktop installation. + +Supports the widget/style subset used here; rejects unsupported widget types. +Application behavior stays in ui_dashboard/ui_navigation, outside generated files. +""" +from pathlib import Path +import argparse +import json +import re + +root = Path(__file__).resolve().parents[2] +project = json.loads((root / 'eez/nanopsx.eez-project').read_text()) +out = root / 'firmware/components/eez_gui' + +def name(value): + return re.sub(r'[^a-z0-9_]', '_', value.lower()) +def string(value): + return json.dumps(value, ensure_ascii=False) +def walk(widget): + yield widget + for child in widget.get('children', []): + yield from walk(child) + +pages = project['userPages'] +roots = [name(page['name']) for page in pages] +fields = list(roots) +for page in pages: + for widget in walk(page['components'][0]): + identifier = widget.get('identifier', '').strip() + if identifier: + assert name(identifier) not in fields, identifier + fields.append(name(identifier)) +header = ['/* Generated by firmware/tools/export_display.py from the EEZ project. */', + '#pragma once', '#include ', '#ifdef __cplusplus', 'extern "C" {', '#endif', + 'typedef struct {', *[f' lv_obj_t *{field};' for field in fields], + '} objects_t;', 'extern objects_t objects;', 'enum ScreensEnum {', + *[f' SCREEN_ID_{r.upper()} = {i+1},' for i,r in enumerate(roots)], '};'] +for r in roots: + header += [f'void create_screen_{r}(void);', f'void tick_screen_{r}(void);'] +header += ['void create_screens(void);', 'void tick_screen(int screen_index);', + 'void tick_screen_by_id(enum ScreensEnum screen_id);', '#ifdef __cplusplus', '}', '#endif'] +source = ['/* Generated by firmware/tools/export_display.py from the EEZ project. */', + '#include "screens.h"', '#include "fonts.h"', '#include "images.h"', + '#include "vars.h"', '#include ', + 'objects_t objects;', 'lv_obj_t *tick_value_change_obj;', 'uint32_t active_theme_index;'] +creators = {'Screen':'lv_obj_create','Panel':'lv_obj_create','Label':'lv_label_create', + 'Image':'lv_img_create','Chart':'lv_chart_create','Slider':'lv_slider_create', + 'Dropdown':'lv_dropdown_create'} +color_styles = {'bg_color','border_color','text_color','line_color'} +scalar_styles = {'radius','border_width','pad_all','pad_left','pad_right','pad_top','pad_bottom', + 'bg_opa','line_width','line_rounded','text_letter_space','text_line_space'} +for page,r in zip(pages, roots): + bindings = [] + source.append(f'void create_screen_{r}(void) {{') + for i,widget in enumerate(walk(page['components'][0])): + kind = widget['type'].removeprefix('LVGL').removesuffix('Widget') + assert kind in creators, f'Unsupported EEZ widget: {kind}' + identifier = r if i == 0 else name(widget.get('identifier','').strip()) + # Resolve parent from the actual tree, avoiding flattened-index assumptions. + def find_parent(node, target): + for child in node.get('children',[]): + if child is target: return node + found = find_parent(child,target) + if found is not None: return found + tree = list(walk(page['components'][0])) + parent = find_parent(tree[0], widget) if i else None + parent_expr = f'w{next(j for j,node in enumerate(tree) if node is parent)}' if parent else 'NULL' + v=f'w{i}' + source.append(f' lv_obj_t *{v} = {creators[kind]}({parent_expr});') + if identifier: source.append(f' objects.{identifier} = {v};') + source.append(f' lv_obj_set_pos({v}, {widget["left"]}, {widget["top"]});') + width = 'LV_SIZE_CONTENT' if widget.get('widthUnit')=='content' else widget['width'] + height = 'LV_SIZE_CONTENT' if widget.get('heightUnit')=='content' else widget['height'] + source.append(f' lv_obj_set_size({v}, {width}, {height});') + source.append(f' lv_obj_clear_flag({v}, LV_OBJ_FLAG_SCROLLABLE);') + if widget.get('clickableFlag'): source.append(f' lv_obj_add_flag({v}, LV_OBJ_FLAG_CLICKABLE);') + if widget.get('hiddenFlag'): source.append(f' lv_obj_add_flag({v}, LV_OBJ_FLAG_HIDDEN);') + for part,states in widget.get('localStyles',{}).get('definition',{}).items(): + for state,props in states.items(): + selector = f'LV_PART_{part} | LV_STATE_{state}' + for prop,value in props.items(): + if prop in color_styles: cvalue=f'lv_color_hex(0x{value.lstrip("#")})' + elif prop=='text_font': cvalue='&ui_font_'+name(value) + elif prop in scalar_styles: cvalue=str(value).lower() + else: raise ValueError(f'Unsupported EEZ style: {prop}') + source.append(f' lv_obj_set_style_{prop}({v}, {cvalue}, {selector});') + if kind=='Label': + source.append(f' lv_label_set_long_mode({v}, LV_LABEL_LONG_{widget.get("longMode","WRAP")});') + if widget.get('textType')=='expression': + assert identifier + binding=f'get_var_{name(widget["text"])}()' + source.append(f' lv_label_set_text({v}, {binding});') + bindings.append((identifier,binding)) + else: source.append(f' lv_label_set_text({v}, {string(widget.get("text",""))});') + elif kind=='Image': source.append(f' lv_img_set_src({v}, &img_{name(widget["image"])});') + elif kind=='Chart': + source += [f' lv_chart_set_type({v}, LV_CHART_TYPE_LINE);',f' lv_chart_set_point_count({v}, {widget["pointCount"]});',f' lv_chart_set_div_line_count({v}, {widget["divLineCountH"]}, {widget["divLineCountV"]});'] + elif kind=='Slider': + source += [f' lv_slider_set_range({v}, {widget["min"]}, {widget["max"]});',f' lv_slider_set_value({v}, {widget["value"]}, LV_ANIM_OFF);'] + elif kind=='Dropdown': + source += [f' lv_dropdown_set_options({v}, {string(widget["options"])});',f' lv_dropdown_set_selected({v}, {widget["selected"]});',f' lv_dropdown_set_dir({v}, LV_DIR_{widget["direction"].upper()});'] + source += ['}',f'void tick_screen_{r}(void) {{'] + for identifier,binding in bindings: + source += [f' if (strcmp(lv_label_get_text(objects.{identifier}), {binding}) != 0)', f' lv_label_set_text(objects.{identifier}, {binding});'] + source += ['}'] +source += ['void create_screens(void) {', ' lv_disp_t *display = lv_disp_get_default();', + ' lv_disp_set_theme(display, lv_theme_default_init(display, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT));', + *[f' create_screen_{r}();' for r in roots], '}', + 'void tick_screen(int index) {', ' switch (index) {', + *[f' case {i}: tick_screen_{r}(); break;' for i,r in enumerate(roots)], + ' default: break;', ' }', '}', + 'void tick_screen_by_id(enum ScreensEnum id) { tick_screen(id - 1); }'] +parser=argparse.ArgumentParser(description=__doc__) +parser.add_argument('--check', action='store_true', help='Fail if checked-in exports differ') +args=parser.parse_args() +for filename,lines in [('screens.h',header),('screens.c',source)]: + data='\n'.join(lines)+'\n' + if args.check: + assert (out/filename).read_text()==data, f'Outdated EEZ export: {filename}' + elif not (out/filename).exists() or (out/filename).read_text() != data: + (out/filename).write_text(data) +print('EEZ screen exports '+('verified' if args.check else 'generated')) diff --git a/firmware/tools/pio_display.py b/firmware/tools/pio_display.py new file mode 100644 index 0000000..b65fd13 --- /dev/null +++ b/firmware/tools/pio_display.py @@ -0,0 +1,8 @@ +"""Keep EEZ screen exports in sync before PlatformIO configures the build.""" +from pathlib import Path +import subprocess +import sys + +Import("env") +script = Path(env.subst("$PROJECT_DIR")) / "tools" / "export_display.py" +subprocess.run([sys.executable, str(script)], check=True)