From 7ebffdab8f64ec06ec649ec8b9ea304791e2391a Mon Sep 17 00:00:00 2001 From: raw-designs Date: Wed, 2 Sep 2026 18:02:23 +0200 Subject: [PATCH] =?UTF-8?q?feat(P4):=20Schriftgr=C3=B6=C3=9Fe=20einstellba?= =?UTF-8?q?r=20(1.7.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Klein, Mittel oder Groß - Karte "Darstellung" auf der Seite Reinigung & Wartung. LVGL-Schriften sind fest einkompilierte Bilddaten und existieren nur in den Größen, die im Projekt liegen (14/18/28/40/48). Stufenloses Skalieren gibt es also nicht. Stattdessen drei Rollen - font_small(), font_text(), font_title() -, die je nach Einstellung eine Stufe höher greifen; die 45 festen Schriftverweise in ui.cpp sind darauf umgestellt. - Die großen Anzeigen (Temperatur 40/48, Uhr) bleiben fest: Sie sind auf die Bildschirmgröße abgestimmt. - Die Grundschrift wird am Bildschirmobjekt gesetzt, damit alles ohne eigene Schrift sie erbt. - Die Einstellung liegt lokal im P4 (NVS "anzeige"), nicht auf der S3. - Nach der Auswahl folgt ein Neustart; der Frühstart-Zähler der Absturzsicherung wird vorher zurückgesetzt. Offen: In der Stufe Groß brauchen die Karten mehr Platz - ob alle Seiten dann noch vollständig auf den Bildschirm passen, zeigt erst das Gerät. Beide Panel-Varianten mit arduino-cli gegengebaut. Co-Authored-By: Claude Opus 5 --- P4_Display_Firmware/Changelog.txt | 15 +++ P4_Display_Firmware/ui.cpp | 167 +++++++++++++++++++++++------- 2 files changed, 143 insertions(+), 39 deletions(-) diff --git a/P4_Display_Firmware/Changelog.txt b/P4_Display_Firmware/Changelog.txt index 792ae4e..cc948c0 100644 --- a/P4_Display_Firmware/Changelog.txt +++ b/P4_Display_Firmware/Changelog.txt @@ -1,3 +1,18 @@ +Version 1.7.2: +- Die Schriftgröße lässt sich jetzt einstellen: Klein, Mittel oder Groß, zu finden auf der + Seite Reinigung & Wartung in der neuen Karte „Darstellung". +- LVGL-Schriften sind fest einkompilierte Bilddaten; es gibt sie nur in den Größen, die im + Projekt liegen (14, 18, 28, 40 und 48 Pixel). Stufenlos skalieren lässt sich also nichts. + Stattdessen gibt es drei Rollen - klein, normal, hervorgehoben -, die je nach Einstellung + eine Stufe höher greifen. +- Die großen Anzeigen für Temperatur und Uhrzeit bleiben unverändert: Sie sind bereits auf + die Bildschirmgröße abgestimmt und sollen nicht mitwachsen. +- Die Einstellung liegt lokal im Display, nicht auf der Hauptplatine - sie betrifft nur + dieses Gerät. Nach der Auswahl startet der P4 neu, weil die Schriften in bereits + angelegten Bedienelementen stecken und sich nicht nachträglich umhängen lassen. +- Zu erwarten: In der Stufe Groß brauchen die Karten mehr Platz. Ob alle Seiten dann noch + vollständig auf den Bildschirm passen, zeigt erst das Gerät. + Version 1.7.1: - Cold Extraction ist auf dem 7-Zoll-Panel dreispaltig: oben die drei Karten mit Erklaerungstext (Modus, Vorbenetzung, Bezugsende), darunter die knappen (Grundeinstellung, diff --git a/P4_Display_Firmware/ui.cpp b/P4_Display_Firmware/ui.cpp index a955e6f..2ba8339 100644 --- a/P4_Display_Firmware/ui.cpp +++ b/P4_Display_Firmware/ui.cpp @@ -20,6 +20,71 @@ #include // Dashboard-Design P4-lokal merken (NVS) #include // Verlaufs-Historie im PSRAM allozieren (interner RAM ist knapp) #include "ui.h" +#include +#include "esp_system.h" + +// ------------------------------------------------------------------------------------ +// Schriftgroesse +// +// LVGL-Schriften sind fest einkompilierte Bilddaten, es gibt sie also nur in den Groessen, +// die im Projekt liegen: 14, 18, 28, 40 und 48 Pixel. Stufenlos skalieren laesst sich +// nichts. Umschalten zwischen ihnen dagegen schon - deshalb drei Rollen statt fester +// Groessen, die je nach Einstellung eine Stufe hoeher greifen. +// +// Die grossen Anzeigen (Temperatur, Uhr) bleiben unveraendert: Sie sind bereits auf die +// Bildschirmgroesse abgestimmt und sollen nicht mitwachsen. +// +// Die Einstellung liegt lokal im P4, nicht auf der Hauptplatine - sie betrifft nur dieses +// Display. Sie wirkt beim naechsten Start: Die Schriften stecken in Hunderten bereits +// angelegter Bedienelemente, die sich nicht nachtraeglich umhaengen lassen, ohne die +// gesamte Oberflaeche neu aufzubauen. +// ------------------------------------------------------------------------------------ +enum { FONT_KLEIN = 0, FONT_MITTEL = 1, FONT_GROSS = 2 }; +static uint8_t g_fontStep = FONT_KLEIN; + +static const lv_font_t* font_small() { + switch (g_fontStep) { + case FONT_GROSS: return &lv_font_maven_pro_28; + case FONT_MITTEL: return &lv_font_maven_pro_18; + default: return &lv_font_maven_pro_14; + } +} +static const lv_font_t* font_text() { + switch (g_fontStep) { + case FONT_GROSS: return &lv_font_maven_pro_40; + case FONT_MITTEL: return &lv_font_maven_pro_28; + default: return &lv_font_maven_pro_18; + } +} +static const lv_font_t* font_title() { + switch (g_fontStep) { + case FONT_GROSS: return &lv_font_maven_pro_48; + case FONT_MITTEL: return &lv_font_maven_pro_40; + default: return &lv_font_maven_pro_28; + } +} + +static void font_step_load() { + Preferences p; + if (p.begin("anzeige", true)) { + g_fontStep = (uint8_t)p.getUChar("schrift", FONT_KLEIN); + p.end(); + } + if (g_fontStep > FONT_GROSS) g_fontStep = FONT_KLEIN; +} + +static void font_step_save_and_restart(uint8_t step) { + if (step > FONT_GROSS) return; + Preferences p; + if (p.begin("anzeige", false)) { + p.putUChar("schrift", step); + p.end(); + } + // Der Zaehler der Absturzsicherung darf diesen gewollten Neustart nicht mitzaehlen. + { Preferences b; if (b.begin("bootguard", false)) { b.putUShort("early", 0); b.end(); } } + delay(120); + esp_restart(); +} #include "theme.h" #include "config.h" #include "display_hal.h" // hal_backlight() - Helligkeit fuer den Aufweck-Dialog @@ -426,7 +491,7 @@ static lv_obj_t* group_card(lv_obj_t* parent, const char* title, const char* sub lv_obj_t* t = lv_label_create(c); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, COL_ACCENT, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); if (subtitle) { lv_obj_t* s = lv_label_create(c); lv_label_set_long_mode(s, LV_LABEL_LONG_WRAP); @@ -460,6 +525,8 @@ static void add_save_button(lv_obj_t* parent, const char* txt, lv_event_cb_t cb) // Nur fuer das Waveshare-Panel: Die JC-Panels haben das Tempoproblem nicht, ihr // Bediengefuehl soll unveraendert bleiben. + + // ------------------------------------------------------------------------------------ // Mehrspaltige Seiten fuer das grosse Panel // @@ -751,7 +818,7 @@ static void tempCard(lv_obj_t* parent, const char* title, lv_color_t accent, lv_obj_t* t = lv_label_create(card); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); *big = lv_label_create(card); lv_label_set_text(*big, "--.-"); lv_obj_set_style_text_color(*big, COL_TEXT, 0); @@ -759,7 +826,7 @@ static void tempCard(lv_obj_t* parent, const char* title, lv_color_t accent, *setp = lv_label_create(card); lv_label_set_text(*setp, "Soll --.-"); lv_obj_set_style_text_color(*setp, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(*setp, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(*setp, font_text(), 0); *bar = lv_bar_create(card); lv_obj_set_size(*bar, LV_PCT(92), 12); lv_obj_set_style_bg_color(*bar, lv_color_hex(0x3a3a3a), 0); // sichtbarer Track (auch bei 0 %) @@ -836,7 +903,7 @@ static void tempGauge(lv_obj_t* parent, const char* title, lv_color_t accent, lv_obj_t* t = lv_label_create(face); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(t, font_small(), 0); lv_obj_align(t, LV_ALIGN_CENTER, 0, -48); *big = lv_label_create(face); lv_label_set_text(*big, "--.-"); @@ -847,7 +914,7 @@ static void tempGauge(lv_obj_t* parent, const char* title, lv_color_t accent, *setp = lv_label_create(face); lv_label_set_text(*setp, "Soll --.-"); lv_obj_set_style_text_color(*setp, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(*setp, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(*setp, font_small(), 0); lv_obj_align(*setp, LV_ALIGN_CENTER, 0, 62); } // Minimal-Design (TD_MINIMAL): komplett rahmenlos - nur grosser Ist-Wert in der @@ -868,7 +935,7 @@ static void tempMinimal(lv_obj_t* parent, const char* title, lv_color_t accent, lv_obj_t* t = lv_label_create(holder); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); *big = lv_label_create(holder); lv_label_set_text(*big, "--.-"); lv_obj_set_style_text_color(*big, COL_TEXT, 0); @@ -886,7 +953,7 @@ static void tempMinimal(lv_obj_t* parent, const char* title, lv_color_t accent, *setp = lv_label_create(holder); lv_label_set_text(*setp, "Soll --.-"); lv_obj_set_style_text_color(*setp, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(*setp, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(*setp, font_text(), 0); } // Soft-3D/Neumorph (TD_NEO): Flaeche fast im Hintergrundton, wirkt herausgedrueckt. // LVGL kann nur einen Schatten je Objekt, daher zwei verschachtelte Objekte: @@ -930,7 +997,7 @@ static void tempNeo(lv_obj_t* parent, const char* title, lv_color_t accent, lv_obj_t* t = lv_label_create(inner); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); *big = lv_label_create(inner); lv_label_set_text(*big, "--.-"); lv_obj_set_style_text_color(*big, COL_TEXT, 0); @@ -938,7 +1005,7 @@ static void tempNeo(lv_obj_t* parent, const char* title, lv_color_t accent, *setp = lv_label_create(inner); lv_label_set_text(*setp, "Soll --.-"); lv_obj_set_style_text_color(*setp, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(*setp, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(*setp, font_text(), 0); *bar = lv_bar_create(inner); // "eingelassener" Balken: Track dunkler als Flaeche lv_obj_set_size(*bar, LV_PCT(78), 10); lv_obj_set_style_bg_color(*bar, lv_color_hex(0x0a0a0a), 0); @@ -1020,7 +1087,7 @@ static void tempThermo(lv_obj_t* parent, const char* title, lv_color_t accent, lv_obj_t* t = lv_label_create(col); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); *big = lv_label_create(col); lv_label_set_text(*big, "--.-"); lv_obj_set_style_text_color(*big, COL_TEXT, 0); @@ -1028,7 +1095,7 @@ static void tempThermo(lv_obj_t* parent, const char* title, lv_color_t accent, *setp = lv_label_create(col); lv_label_set_text(*setp, "Soll --.-"); lv_obj_set_style_text_color(*setp, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(*setp, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(*setp, font_text(), 0); } // Temperaturzeile gemaess aktivem Design (neu) befuellen - auch beim Umschalten zur Laufzeit static void build_temp_row_content() { @@ -1080,7 +1147,7 @@ static lv_obj_t* infoCell(lv_obj_t* parent, const char* title, lv_obj_t** val, l *val = lv_label_create(card); lv_label_set_text(*val, "--"); lv_obj_set_style_text_color(*val, COL_TEXT, 0); - lv_obj_set_style_text_font(*val, &lv_font_maven_pro_28, 0); + lv_obj_set_style_text_font(*val, font_title(), 0); lv_obj_set_style_text_align(*val, LV_TEXT_ALIGN_CENTER, 0); // fuer mehrzeilige Werte return card; } @@ -1288,7 +1355,7 @@ static lv_obj_t* build_temp_arc(lv_obj_t* parent, const char* title, lv_color_t lv_obj_t* t = lv_label_create(card); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, accent, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); lv_obj_t* arc = lv_arc_create(card); lv_obj_set_size(arc, 180, 180); @@ -1465,7 +1532,7 @@ static void build_light(lv_obj_t* p) { lv_obj_set_size(btnLight, 320, 150); lv_obj_add_event_cb(btnLight, light_cb, LV_EVENT_CLICKED, nullptr); lv_obj_t* l = lv_obj_get_child(btnLight, 0); - if (l) lv_obj_set_style_text_font(l, &lv_font_maven_pro_28, 0); + if (l) lv_obj_set_style_text_font(l, font_title(), 0); } // ===================================================================================== @@ -1531,13 +1598,13 @@ static void build_chart(lv_obj_t* p) { g_chartWinBtn[i] = th_button(btns, winNames[i], COL_CARD2, COL_TEXT); lv_obj_set_style_pad_hor(g_chartWinBtn[i], 10, 0); lv_obj_set_style_pad_ver(g_chartWinBtn[i], 5, 0); - lv_obj_set_style_text_font(lv_obj_get_child(g_chartWinBtn[i], 0), &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(lv_obj_get_child(g_chartWinBtn[i], 0), font_small(), 0); lv_obj_add_event_cb(g_chartWinBtn[i], chart_win_btn_cb, LV_EVENT_CLICKED, (void*)(intptr_t)i); } g_chartDutyBtn = th_button(btns, "Leistung", COL_CARD2, COL_TEXT); lv_obj_set_style_pad_hor(g_chartDutyBtn, 10, 0); lv_obj_set_style_pad_ver(g_chartDutyBtn, 5, 0); - lv_obj_set_style_text_font(lv_obj_get_child(g_chartDutyBtn, 0), &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(lv_obj_get_child(g_chartDutyBtn, 0), font_small(), 0); lv_obj_add_event_cb(g_chartDutyBtn, chart_duty_btn_cb, LV_EVENT_CLICKED, nullptr); chart_win_btns_refresh(); @@ -1569,7 +1636,7 @@ static void build_chart(lv_obj_t* p) { g_tuneCardTitle = lv_label_create(tcol); lv_label_set_text(g_tuneCardTitle, "PID-Tuning läuft..."); lv_obj_set_style_text_color(g_tuneCardTitle, COL_WARN, 0); - lv_obj_set_style_text_font(g_tuneCardTitle, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_tuneCardTitle, font_text(), 0); g_tuneCardBody = lv_label_create(tcol); lv_label_set_text(g_tuneCardBody, "--"); lv_obj_set_style_text_color(g_tuneCardBody, COL_TEXT, 0); @@ -1626,7 +1693,7 @@ static void build_chart(lv_obj_t* p) { lv_obj_t* ax[3] = { g_axHi, g_axMid, g_axLo }; for (int i = 0; i < 3; i++) { lv_obj_set_style_text_color(ax[i], COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(ax[i], &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(ax[i], font_small(), 0); lv_label_set_text(ax[i], "--"); } @@ -1818,7 +1885,7 @@ static lv_obj_t* sum_stat_col(lv_obj_t* parent, const char* caption, lv_obj_t** lv_obj_t* c = lv_label_create(col); lv_label_set_text(c, caption); lv_obj_set_style_text_color(c, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(c, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(c, font_small(), 0); lv_obj_clear_flag(c, LV_OBJ_FLAG_CLICKABLE); if (valOut) *valOut = v; return col; @@ -1980,7 +2047,7 @@ static lv_obj_t* bz_stat_block(lv_obj_t* parent, const char* caption, lv_obj_t** lv_obj_t* c = lv_label_create(blk); lv_label_set_text(c, caption); lv_obj_set_style_text_color(c, COL_TEXT_MUT, 0); - lv_obj_set_style_text_font(c, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(c, font_small(), 0); lv_obj_t* v = lv_label_create(blk); lv_label_set_text(v, "--"); lv_obj_set_style_text_color(v, col, 0); @@ -2013,7 +2080,7 @@ static void build_brew_live_screen() { lv_obj_t* title = lv_label_create(top); lv_label_set_text(title, "Bezug läuft"); lv_obj_set_style_text_color(title, COL_ACCENT, 0); - lv_obj_set_style_text_font(title, &lv_font_maven_pro_28, 0); + lv_obj_set_style_text_font(title, font_title(), 0); lv_obj_t* closeBtn = th_button(top, LV_SYMBOL_CLOSE, COL_CARD2, COL_TEXT); lv_obj_set_size(closeBtn, 56, 40); lv_obj_add_event_cb(closeBtn, brew_live_close_cb, LV_EVENT_CLICKED, nullptr); @@ -2039,11 +2106,11 @@ static void build_brew_live_screen() { lv_obj_clear_flag(left, LV_OBJ_FLAG_SCROLLABLE); bz_stat_block(left, "ZEIT", &g_bzTimer, &lv_font_maven_pro_48, COL_ACCENT); g_bzWeightBlock = bz_stat_block(left, "GEWICHT", &g_bzWeight, &lv_font_maven_pro_48, COL_TEXT); - g_bzFlowBlock = bz_stat_block(left, "FLOW", &g_bzFlow, &lv_font_maven_pro_28, COL_TEXT); + g_bzFlowBlock = bz_stat_block(left, "FLOW", &g_bzFlow, font_title(), COL_TEXT); g_bzPhase = lv_label_create(left); lv_label_set_text(g_bzPhase, ""); lv_obj_set_style_text_color(g_bzPhase, COL_ACCENT, 0); - lv_obj_set_style_text_font(g_bzPhase, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_bzPhase, font_text(), 0); lv_obj_add_flag(g_bzPhase, LV_OBJ_FLAG_HIDDEN); g_bzChartWrap = lv_obj_create(main); @@ -2058,7 +2125,7 @@ static void build_brew_live_screen() { lv_obj_t* chartCap = lv_label_create(g_bzChartWrap); lv_label_set_text(chartCap, "Flow-Verlauf (letzte 30 s)"); lv_obj_set_style_text_color(chartCap, COL_TEXT_MUT, 0); - lv_obj_set_style_text_font(chartCap, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(chartCap, font_small(), 0); g_bzChart = lv_chart_create(g_bzChartWrap); lv_obj_set_width(g_bzChart, LV_PCT(100)); lv_obj_set_flex_grow(g_bzChart, 1); @@ -2090,7 +2157,7 @@ static void build_brew_live_screen() { g_bzBarLbl = lv_label_create(g_bzBarRow); lv_label_set_text(g_bzBarLbl, ""); lv_obj_set_style_text_color(g_bzBarLbl, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(g_bzBarLbl, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_bzBarLbl, font_text(), 0); g_bzBar = lv_bar_create(g_bzBarRow); lv_obj_set_size(g_bzBar, LV_PCT(100), 14); lv_bar_set_range(g_bzBar, 0, 100); @@ -2302,7 +2369,7 @@ static lv_obj_t* cln_stepper(lv_obj_t* parent, const char* label, lv_event_cb_t lv_obj_t* val = lv_label_create(grp); lv_label_set_text(val, "--"); lv_obj_set_style_text_color(val, COL_TEXT, 0); - lv_obj_set_style_text_font(val, &lv_font_maven_pro_28, 0); + lv_obj_set_style_text_font(val, font_title(), 0); lv_obj_t* bp = th_button(grp, "+", COL_CARD2, COL_TEXT); lv_obj_set_size(bp, 64, 56); lv_obj_add_event_cb(bp, plus, LV_EVENT_CLICKED, nullptr); @@ -2384,7 +2451,7 @@ static void build_cleaning_screen() { lv_obj_t* title = lv_label_create(hdr); lv_label_set_text(title, "Reinigungsassistent"); lv_obj_set_style_text_color(title, COL_ACCENT, 0); - lv_obj_set_style_text_font(title, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(title, font_text(), 0); // --- Konfigurationsbereich (sichtbar, wenn inaktiv) --- g_clnCfg = lv_obj_create(g_clnScreen); @@ -2429,7 +2496,7 @@ static void build_cleaning_screen() { lv_obj_set_width(g_clnProgLbl, LV_PCT(100)); lv_label_set_text(g_clnProgLbl, "Reinigung läuft..."); lv_obj_set_style_text_color(g_clnProgLbl, COL_TEXT, 0); - lv_obj_set_style_text_font(g_clnProgLbl, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_clnProgLbl, font_text(), 0); lv_obj_t* stopBtn = th_button(g_clnProgress, LV_SYMBOL_STOP " Reinigung abbrechen", COL_DANGER, COL_TEXT); lv_obj_set_width(stopBtn, LV_PCT(100)); @@ -2473,6 +2540,12 @@ static void send_reset_maint(lv_event_t*) { g_client->sendCommand("saveService", "\"resetMaintenanceCounter\":true"); showToast("Wartungszähler zurückgesetzt", false); } +// Schriftgroesse waehlen. Speichert und startet neu - die Schriften stecken in bereits +// angelegten Bedienelementen und lassen sich nicht nachtraeglich umhaengen. +static void font_pick_cb(lv_event_t* e) { + font_step_save_and_restart((uint8_t)(intptr_t)lv_event_get_user_data(e)); +} + static void build_service(lv_obj_t* p) { #if JC_PANEL_TYPE == WS_PANEL_7H // Vier Karten in zwei Spalten. Frueher standen hier lose Zeilen unter blossen @@ -2511,9 +2584,21 @@ static void build_service(lv_obj_t* p) { lv_obj_set_width(cb, LV_PCT(100)); lv_obj_add_event_cb(cb, cln_open, LV_EVENT_CLICKED, nullptr); + + lv_obj_t* cFont = group_card(p, "Darstellung", + "Schriftgröße dieses Displays. Wirkt nach einem Neustart, der sofort erfolgt."); + lv_obj_t* rowF = row(cFont, nullptr); + static const char* FONT_NAMEN[3] = { "Klein", "Mittel", "Groß" }; + for (uint8_t i = 0; i < 3; i++) { + lv_obj_t* fb = (i == g_fontStep) ? th_accent_button(rowF, FONT_NAMEN[i]) + : th_button(rowF, FONT_NAMEN[i], COL_CARD2, COL_TEXT); + lv_obj_add_event_cb(fb, font_pick_cb, LV_EVENT_CLICKED, (void*)(intptr_t)i); + } + page_grid(p, PAGE_COLS_2, PAGE_ROWS_2C); grid_at(cMaint, 0, 0); grid_at(cFlush, 1, 0); grid_at(cLight, 0, 1); grid_at(cCln, 1, 1); + grid_at(cFont, 0, 2, 2); #else section_title(p, "Reinigung & Wartung"); @@ -2799,7 +2884,7 @@ static void prof_picker_open() { lv_obj_t* t = lv_label_create(hdr); lv_label_set_text(t, "Profil laden"); lv_obj_set_style_text_color(t, COL_ACCENT, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); lv_obj_t* x = th_button(hdr, LV_SYMBOL_CLOSE, COL_CARD2, COL_TEXT); lv_obj_add_event_cb(x, prof_picker_close_cb, LV_EVENT_CLICKED, nullptr); @@ -2879,7 +2964,7 @@ static void info_block(lv_obj_t* card, const char* title, lv_obj_t** valOut, con lv_obj_t* t = lv_label_create(card); lv_label_set_text(t, title); lv_obj_set_style_text_color(t, COL_ACCENT, 0); - lv_obj_set_style_text_font(t, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(t, font_text(), 0); lv_obj_t* v = lv_label_create(card); lv_obj_set_width(v, LV_PCT(100)); lv_label_set_text(v, initial); @@ -3283,8 +3368,12 @@ void ui_init(ProtocolClient* client) { prefs.end(); if (g_tempDesign >= TD_DESIGN_COUNT) g_tempDesign = TD_GAUGE; } + font_step_load(); // gewaehlte Schriftgroesse, bevor irgendetwas angelegt wird + lv_obj_t* scr = lv_screen_active(); lv_obj_set_style_bg_color(scr, COL_BG, 0); + // Grundschrift am Bildschirm: Alles, was keine eigene Schrift setzt, erbt sie von hier. + lv_obj_set_style_text_font(scr, font_small(), 0); lv_obj_clear_flag(scr, LV_OBJ_FLAG_SCROLLABLE); // --- Kopfleiste --- @@ -3314,7 +3403,7 @@ void ui_init(ProtocolClient* client) { lv_obj_set_style_text_color(g_hdrTitle, COL_TEXT, 0); lv_obj_set_style_pad_left(g_hdrTitle, 10, 0); lv_obj_set_flex_grow(g_hdrTitle, 1); - lv_obj_set_style_text_font(g_hdrTitle, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_hdrTitle, font_text(), 0); // Profil-Chip: zuletzt geladenes Profil ("*" = seitdem geaenderte Einstellungen). // Antippen oeffnet die Profil-Schnellwahl. Unsichtbar, solange die S3 kein Profil meldet. @@ -3362,7 +3451,7 @@ void ui_init(ProtocolClient* client) { lv_label_set_text(g_clock, ""); lv_obj_set_style_text_color(g_clock, COL_TEXT, 0); lv_obj_set_style_pad_right(g_clock, 10, 0); - lv_obj_set_style_text_font(g_clock, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_clock, font_text(), 0); g_wifiIcon = lv_label_create(header); lv_label_set_text(g_wifiIcon, LV_SYMBOL_WIFI); @@ -3494,7 +3583,7 @@ void ui_init(ProtocolClient* client) { lv_obj_set_width(g_wakeMsg, LV_PCT(100)); lv_obj_set_style_text_align(g_wakeMsg, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_color(g_wakeMsg, COL_TEXT, 0); - lv_obj_set_style_text_font(g_wakeMsg, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_wakeMsg, font_text(), 0); lv_label_set_text(g_wakeMsg, "Die Maschine befindet sich im Standby.\nAus dem Standby aufwecken?"); lv_obj_t* wakeBtns = lv_obj_create(wakeCard); lv_obj_set_width(wakeBtns, LV_PCT(100)); @@ -3538,15 +3627,15 @@ void ui_init(ProtocolClient* client) { lv_obj_t* otaTitle = lv_label_create(g_otaScreen); lv_label_set_text(otaTitle, "Display-Firmware-Update"); lv_obj_set_style_text_color(otaTitle, COL_ACCENT, 0); - lv_obj_set_style_text_font(otaTitle, &lv_font_maven_pro_28, 0); + lv_obj_set_style_text_font(otaTitle, font_title(), 0); g_otaStatus = lv_label_create(g_otaScreen); lv_label_set_text(g_otaStatus, "Bitte warten..."); lv_obj_set_style_text_color(g_otaStatus, COL_TEXT, 0); - lv_obj_set_style_text_font(g_otaStatus, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_otaStatus, font_text(), 0); g_otaBytes = lv_label_create(g_otaScreen); lv_label_set_text(g_otaBytes, ""); lv_obj_set_style_text_color(g_otaBytes, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(g_otaBytes, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(g_otaBytes, font_text(), 0); lv_obj_add_flag(g_otaScreen, LV_OBJ_FLAG_HIDDEN); // Shot-Zusammenfassung (zentrierte Karte mit grossen Werten, antippbar zum Schliessen) @@ -3571,7 +3660,7 @@ void ui_init(ProtocolClient* client) { lv_obj_t* sumTitle = lv_label_create(g_shotSum); lv_label_set_text(sumTitle, "Bezug beendet"); lv_obj_set_style_text_color(sumTitle, COL_ACCENT, 0); - lv_obj_set_style_text_font(sumTitle, &lv_font_maven_pro_28, 0); + lv_obj_set_style_text_font(sumTitle, font_title(), 0); lv_obj_t* sumRow = lv_obj_create(g_shotSum); lv_obj_set_size(sumRow, LV_PCT(100), LV_SIZE_CONTENT); lv_obj_set_style_bg_opa(sumRow, LV_OPA_TRANSP, 0); @@ -3608,7 +3697,7 @@ void ui_init(ProtocolClient* client) { lv_obj_t* splashSub = lv_label_create(g_splash); lv_label_set_text(splashSub, "Siebträgersteuerung"); lv_obj_set_style_text_color(splashSub, COL_TEXT_DIM, 0); - lv_obj_set_style_text_font(splashSub, &lv_font_maven_pro_18, 0); + lv_obj_set_style_text_font(splashSub, font_text(), 0); lv_obj_t* splashSpin = lv_spinner_create(g_splash); lv_spinner_set_anim_params(splashSpin, 1000, 60); lv_obj_set_size(splashSpin, 48, 48); @@ -3618,7 +3707,7 @@ void ui_init(ProtocolClient* client) { lv_obj_t* splashVer = lv_label_create(g_splash); lv_label_set_text(splashVer, "Firmware " DISPLAY_FW_VERSION); lv_obj_set_style_text_color(splashVer, COL_TEXT_MUT, 0); - lv_obj_set_style_text_font(splashVer, &lv_font_maven_pro_14, 0); + lv_obj_set_style_text_font(splashVer, font_small(), 0); g_splashActive = true; ui_fade_in(g_splash, UI_FADE_MS); // weiches Erscheinen beim Boot -- 2.54.0