fix(P4): Panel-Bringup meldet Fehler im Klartext statt abzustürzen (1.6.2)
Ein fehlgeschlagener Panel-Aufbau endete bisher in einem ESP_ERROR_CHECK tief im LVGL-Port und damit in einem Speicherauszug ohne erkennbare Ursache. - Die Schritte des Waveshare-Bringups melden ihren Fehler über esp_rom_printf, also auch bei Core-Debug-Level "none". Zusätzlich werden PSRAM-Größe, freier PSRAM, größter freier Block und der Framebuffer-Bedarf ausgegeben. - jc_board_bringup() liefert jetzt einen Status. Kommt das Panel nicht hoch, bleibt die Firmware ohne Anzeige lauffähig (UART + OTA), statt beim ersten LVGL-Zugriff erneut abzustürzen. - ui.cpp: alle öffentlichen Funktionen prüfen, ob ui_init gelaufen ist. - Fehlerbehebung: esp_lcd_touch_new_i2c_gt911 setzt im Fehlerfall einen bereits freigegebenen Zeiger. Das Handle wird vorbelegt und der Rückgabewert geprüft. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018QoLDQeUh1dCQz7yYZVb4Y
This commit is contained in:
co-authored by
Claude Opus 5
parent
146420a0bc
commit
d75708993a
@@ -3127,6 +3127,11 @@ static void dash_timers_cb(lv_timer_t*) {
|
||||
// =====================================================================================
|
||||
// Aufbau (Header + Schublade + Seiten)
|
||||
// =====================================================================================
|
||||
// Erst true, wenn das Dashboard steht. Kam das Panel nicht hoch (siehe display_hal.cpp),
|
||||
// wird ui_init nie aufgerufen - dann duerfen die uebrigen Funktionen nichts anfassen,
|
||||
// sonst greifen sie auf nicht angelegte LVGL-Objekte zu.
|
||||
static bool g_uiReady = false;
|
||||
|
||||
void ui_init(ProtocolClient* client) {
|
||||
g_client = client;
|
||||
|
||||
@@ -3486,6 +3491,8 @@ void ui_init(ProtocolClient* client) {
|
||||
|
||||
show_page(PG_DASH);
|
||||
if (g_client) g_client->sendListProfiles();
|
||||
|
||||
g_uiReady = true;
|
||||
}
|
||||
|
||||
// Haengt den Ergebnis-/Abbruchtext eines beendeten Tuning-Laufs an 'out' an.
|
||||
@@ -3531,6 +3538,8 @@ static void appendTuneLive(String& out, const char* kreis, uint32_t elapsedMs,
|
||||
// Live-Aktualisierung
|
||||
// =====================================================================================
|
||||
void ui_update(const MachineState& st) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
g_state = st;
|
||||
|
||||
// Boot-Splash: erster State = Verbindung zur Maschine steht -> Start-Animation ausblenden
|
||||
@@ -4171,9 +4180,11 @@ void ui_update(const MachineState& st) {
|
||||
}
|
||||
}
|
||||
|
||||
void ui_toast(const char* txt, bool error) { showToast(txt, error); }
|
||||
void ui_toast(const char* txt, bool error) { if (g_uiReady) showToast(txt, error); }
|
||||
|
||||
void ui_set_profiles(const String profiles[], int count) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
// Schnellwahl-Overlay (falls offen) mit derselben Antwort befuellen
|
||||
prof_picker_fill(profiles, count);
|
||||
if (!profList) return;
|
||||
@@ -4189,6 +4200,8 @@ void ui_set_profiles(const String profiles[], int count) {
|
||||
}
|
||||
|
||||
void ui_set_profile_details(const String& json) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!profDetailLbl) return;
|
||||
JsonDocument doc;
|
||||
if (deserializeJson(doc, json)) {
|
||||
@@ -4233,6 +4246,8 @@ void ui_set_profile_details(const String& json) {
|
||||
}
|
||||
|
||||
void ui_set_usage_stats(const String& json) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!g_statSummary) return;
|
||||
JsonDocument doc;
|
||||
if (deserializeJson(doc, json)) {
|
||||
@@ -4290,6 +4305,8 @@ void ui_set_usage_stats(const String& json) {
|
||||
}
|
||||
|
||||
void ui_set_wifi_networks(const String& json) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
wifi_scan_done(); // Scan abgeschlossen: Button wieder freigeben
|
||||
if (!wifiList) return;
|
||||
|
||||
@@ -4331,6 +4348,8 @@ void ui_set_debug(const char* txt) { (void)txt; }
|
||||
|
||||
// --- OTA-Overlay (Aufrufe unter hal_lock()) ---
|
||||
void ui_ota_begin() {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!g_otaScreen) return;
|
||||
lv_label_set_text(g_otaStatus, "Update läuft - bitte nicht ausschalten!");
|
||||
lv_obj_set_style_text_color(g_otaStatus, COL_TEXT, 0);
|
||||
@@ -4339,15 +4358,21 @@ void ui_ota_begin() {
|
||||
lv_obj_move_foreground(g_otaScreen);
|
||||
}
|
||||
void ui_ota_progress(uint32_t bytes) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!g_otaBytes) return;
|
||||
lv_label_set_text_fmt(g_otaBytes, "%lu KB übertragen", (unsigned long)(bytes / 1024));
|
||||
}
|
||||
void ui_ota_done() {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!g_otaStatus) return;
|
||||
lv_label_set_text(g_otaStatus, "Fertig - Neustart...");
|
||||
lv_obj_set_style_text_color(g_otaStatus, COL_OK, 0);
|
||||
}
|
||||
void ui_ota_fail(const char* msg) {
|
||||
if (!g_uiReady) return;
|
||||
|
||||
if (!g_otaStatus) return;
|
||||
lv_label_set_text_fmt(g_otaStatus, "Fehlgeschlagen: %s", msg);
|
||||
lv_obj_set_style_text_color(g_otaStatus, COL_DANGER, 0);
|
||||
|
||||
Reference in New Issue
Block a user