// ===================================================================================== // ui.h - LVGL-Benutzeroberflaeche (Dashboard) fuer das P4-Touch-Display // ===================================================================================== // Board-AGNOSTISCH: erstellt nur LVGL-Objekte und bindet Bedienaktionen an den // ProtocolClient. Die Display-/Touch-Hardware wird in display_hal.* initialisiert. // ===================================================================================== #pragma once #include "protocol_client.h" #include "machine_state.h" // Initialisiert das Dashboard. 'client' wird fuer ausgehende Kommandos benoetigt. void ui_init(ProtocolClient* client); // Aktualisiert alle Anzeigen aus dem aktuellen Zustand (bei jedem state-Push aufrufen). void ui_update(const MachineState& st); // Fuellt die Profil-Liste (Antwort auf listProfiles). void ui_set_profiles(const String profiles[], int count); // Zeigt die Detailwerte des gewaehlten Profils an (Antwort auf getProfileDetails, Roh-JSON). void ui_set_profile_details(const String& json); // Fuellt die Statistik-Seite (Antwort auf getUsageStats, Roh-JSON). void ui_set_usage_stats(const String& json); // Fuellt die WLAN-Netzliste (Antwort auf scanWifi, Roh-JSON). void ui_set_wifi_networks(const String& json); // Zeigt eine kurze Rueckmeldung (z.B. aus ack/error) im Toast-Bereich an. void ui_toast(const char* txt, bool error); // true, solange der Standby-Aufweck-Dialog sichtbar ist. Die Helligkeitssteuerung (onState) // haelt das Display dann hell, damit der Dialog lesbar bleibt. bool ui_wake_dialog_open(); // Setzt den On-Screen-Diagnosetext (UART-Zaehler/letzte Rohzeile). Muss vom Aufrufer // (im realen Modus) unter hal_lock()/hal_unlock() aufgerufen werden. void ui_set_debug(const char* txt); // --- OTA-Update-Overlay (Aufrufe unter hal_lock()/hal_unlock()) --- void ui_ota_begin(); // Vollbild-Overlay einblenden void ui_ota_progress(uint32_t bytes); // empfangene Bytes aktualisieren void ui_ota_done(); // Erfolg (Neustart folgt) void ui_ota_fail(const char* msg); // Fehler anzeigen