Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f840173a9 | ||
|
|
6371b22683 | ||
|
|
de2d0635b2 | ||
|
|
801a659b0c | ||
|
|
d97e4c34d5 | ||
|
|
00a4c80b13 | ||
|
|
a1431a9d42 | ||
|
|
d9bc31b555 | ||
|
|
5691a4c04f | ||
|
|
f8df6f85cd | ||
|
|
f43375e991 | ||
|
|
92ef4fbfb6 | ||
|
|
fd6ec5371b | ||
|
|
ea64e7de04 |
@@ -1,3 +1,43 @@
|
||||
Version 5.2.0:
|
||||
- Feed-Forward bei Bezug (Störgrößenaufschaltung) für den Wasserkessel: Während eines Bezugs wird der
|
||||
Heizung sofort ein einstellbarer Leistungs-Boost (0–100 % der Fenstergröße, 0 % = aus) aufgeschaltet,
|
||||
statt auf den vom Sensor gemeldeten Temperaturabfall zu warten. Die PID regelt nur noch den Restfehler;
|
||||
der Temperatur-Dip während des Shots wird deutlich kleiner. Einstellung auf der /PID-Seite
|
||||
(„Feed-Forward bei Bezug"), gespeichert im EEPROM (bewusst kein Profilfeld, da maschinenabhängig).
|
||||
- Optional: I-Anteil der Wasser-PID während des Bezugs einfrieren. Verhindert das Aufladen des
|
||||
Integral-Anteils während des Shots und damit das Überschwingen nach Bezugsende.
|
||||
- Der Boost wirkt nur bei echten Bezügen (Hardware-Schalter oder Software-Start), nicht bei
|
||||
Spülen/Wartungsmodus/AutoTune. Sicherheitslogik unverändert: Sensorfehler, Übertemperatur-Abschaltung
|
||||
und „Heizen oberhalb Setpoint verhindern" haben weiterhin Vorrang; Deckelung auf die Fenstergröße.
|
||||
- Die Heizleistungs-Telemetrie (dutyW, u. a. für das Verlaufs-Chart des Touch-Displays) zeigt den
|
||||
Boost mit an - damit ist die Wirkung direkt im Chart kalibrierbar.
|
||||
|
||||
Version 5.1.2:
|
||||
- Profil-Seite (Web-UI): Die neue „Aktives Profil"-Anzeige stand linksbündig außerhalb des
|
||||
Karten-Layouts. Sie nutzt jetzt den status-message-Stil der Seite (zentriert, max. 600 px,
|
||||
dezenter Rahmen) und fügt sich damit in das bestehende Layout ein; Profilname zusätzlich fett.
|
||||
|
||||
Version 5.1.1:
|
||||
- Aktives Profil wird jetzt geführt und angezeigt: Die Steuerung merkt sich das zuletzt geladene bzw.
|
||||
gespeicherte Profil dauerhaft im EEPROM (überlebt Neustarts). Web-UI: Anzeige auf dem Dashboard über der
|
||||
Profil-Auswahl sowie auf der Profil-Seite (aktives Profil zusätzlich mit grünem Punkt in der Liste).
|
||||
- „Geändert"-Erkennung: Werden nach dem Laden profil-relevante Einstellungen geändert (Solltemperaturen,
|
||||
PID-Werte inkl. AutoTune-Ergebnis und AutoTune-Parameter, Boost, Eco, Dampfverzögerung, Fast-Heat-Up,
|
||||
Brew-Control, Piezo), erscheint hinter dem Profilnamen „✱ (geändert)". Reine Anzeige-/Systemeinstellungen
|
||||
(Anzeigemodus, Aufheizzeit, Licht, FlowGuard, Waage/Sensoren) lösen das bewusst nicht aus.
|
||||
- Profil löschen setzt die Anzeige zurück, wenn das gelöschte Profil das aktive war; Werksreset ebenso.
|
||||
- Neue additive State-Felder "profile" und "profDirty" im UART-JSON für das Touch-Display (Protokoll bleibt
|
||||
kompatibel, ältere Display-Firmware ignoriert die Felder) - Grundlage für die Profil-Schnellwahl am Display.
|
||||
|
||||
Version 5.1.0:
|
||||
- Display-Auswahl in die Web-UI (/Sensoren) verlegt: Ohne Display / OLED (SH1106, I2C) / UART-Touch-Display.
|
||||
Der Compile-Schalter ENABLE_DISPLAY entfällt, die Einstellung wird im EEPROM gespeichert und ohne Neustart
|
||||
übernommen. Default ist "Ohne Display", damit die Steuerung ohne angeschlossene Anzeige immer sicher startet.
|
||||
- Boot-Schutz: Vor der OLED-Initialisierung wird per I2C-Probe (0x3C) geprüft, ob das Display wirklich
|
||||
angeschlossen ist. Ohne Antwort bleibt die Anzeige deaktiviert und die Steuerung bootet normal weiter -
|
||||
eine falsch gesetzte Display-Einstellung kann die Maschine damit nicht mehr blockieren.
|
||||
- UART-Touch-Anbindung (Serial1) wird nur noch initialisiert und bedient, wenn "UART-Touch-Display" gewählt ist.
|
||||
|
||||
Version 5.0.12:
|
||||
- Neues additives Feld "piState" im State-JSON für das UART-Touch-Display (0=inaktiv, 1=Pre-Infusion,
|
||||
2=Pause, 3=Hauptbezug): Die Pre-Infusion-Phasenleiste auf dem Display folgt damit quelltreu der echten
|
||||
|
||||
@@ -157,6 +157,8 @@ Erzeugt von `buildTouchUartStateJson()`. Alle Felder in einem flachen JSON-Objek
|
||||
| `steamHeatDisabled` | bool | Dampfheizung per Nutzer deaktiviert |
|
||||
| `lightOn` | bool | Beleuchtung an |
|
||||
| `piezoEnabled` | bool | Piezo-Summer aktiv |
|
||||
| `profile` | string | zuletzt geladenes/gespeichertes Profil, leer = keines (additiv seit S3 5.1.1) |
|
||||
| `profDirty` | bool | profil-relevante Einstellungen seit dem Laden geändert (additiv seit S3 5.1.1) |
|
||||
| `weight` | float | aktuelles Waagengewicht (UI) |
|
||||
| `targetWeight` | float | Ziel-Gewicht (Brew-by-Weight) |
|
||||
| `scaleEnabled` | bool | Waage aktiviert |
|
||||
|
||||
+492
-97
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,25 @@
|
||||
Version 1.0.13:
|
||||
- Profil-Schnellwahl + Anzeige des aktiven Profils (braucht S3-Firmware ab 5.1.1):
|
||||
- Neuer Profil-Chip im Header (auf allen Seiten sichtbar): zeigt das zuletzt geladene bzw.
|
||||
gespeicherte Profil; ein „*" hinter dem Namen bedeutet, dass seitdem profil-relevante
|
||||
Einstellungen geändert wurden. Lange Namen werden gekürzt; ohne bekanntes Profil
|
||||
(oder mit älterer S3-Firmware) bleibt der Chip unsichtbar.
|
||||
- Antippen des Chips öffnet die Profil-Schnellwahl: ein Overlay mit allen gespeicherten
|
||||
Profilen, das aktive mit Häkchen und Akzentfarbe hervorgehoben. Ein Tap lädt das Profil
|
||||
direkt (Toast bestätigt, Chip aktualisiert sich mit dem nächsten State) — zwei Berührungen
|
||||
vom Dashboard zum Profilwechsel statt Umweg über die Profile-Seite.
|
||||
- Profile-Seite: das aktive Profil wird in der Liste mit Häkchen-Symbol und Akzentfarbe
|
||||
markiert.
|
||||
|
||||
Version 1.0.12:
|
||||
- Verlauf-Chart: Flackernde Heizleistungs-Kurven in den großen Zeitfenstern behoben. Die
|
||||
Dezimierung pickte pro Chart-Punkt ein Einzelsample, dessen Abtast-Raster mit jedem
|
||||
Sekundentick um eine Position wanderte — die schnell schaltende Heizleistung (PWM)
|
||||
sprang dadurch sichtbar zwischen zwei Kurvenbildern hin und her. Jetzt wird über den
|
||||
gesamten Zeitabschnitt eines Chart-Punkts gemittelt: das Bild steht ruhig, und die
|
||||
Leistungs-Kurve zeigt die tatsächliche mittlere Heizleistung statt zufälliger
|
||||
Momentwerte. Im 2-min-Fenster (1 Sample je Punkt) ändert sich nichts.
|
||||
|
||||
Version 1.0.11:
|
||||
- Verlauf-Seite ausgebaut (nur P4, keine S3-/Protokolländerung nötig):
|
||||
- Umschaltbares Zeitfenster: Buttons „2 min / 10 min / 30 min / 60 min" in der Kopfzeile.
|
||||
@@ -14,6 +36,8 @@ Version 1.0.11:
|
||||
ebenfalls P4-lokal im NVS.
|
||||
- Feinere Kurven: Die Temperatur-Historie wird jetzt in Zehntelgrad geführt und gezeichnet
|
||||
(vorher ganzzahlig gerundet) — PID-Schwingungen um ±1 °C sind damit sauber ablesbar.
|
||||
- Die ~29 KB Historie liegen im PSRAM (heap_caps_malloc, wie die LVGL-Framebuffer) —
|
||||
als statische Arrays sprengten sie den internen RAM (Linker: 107 % belegt).
|
||||
- Shot-Zusammenfassung: Karte auf 560 px verbreitert und Spaltenabstand zwischen
|
||||
Dauer/Gewicht/Flow deutlich vergrößert (28 px statt 10 px) — die drei Werte standen
|
||||
zu nahe beisammen und waren schlecht lesbar.
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
// -------------------------------------------------------------------------------------
|
||||
// Firmware
|
||||
// -------------------------------------------------------------------------------------
|
||||
#define DISPLAY_FW_VERSION "1.0.11" // Firmware-Stand der P4-Display-Steuerung (Info-Seite)
|
||||
#define DISPLAY_FW_VERSION "1.0.13" // Firmware-Stand der P4-Display-Steuerung (Info-Seite)
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// Protokoll
|
||||
|
||||
@@ -50,6 +50,8 @@ struct MachineState {
|
||||
long heatUpRemainSec = -1; // verbleibende Sekunden bis "durchgewaermt" (-1 = aus)
|
||||
bool lightOn = false;
|
||||
bool piezoEnabled = false;
|
||||
String activeProfile; // zuletzt geladenes/gespeichertes Profil (leer = keines; seit S3 5.1.1)
|
||||
bool profileDirty = false; // Einstellungen weichen seit dem Laden vom Profil ab
|
||||
|
||||
// --- Waage ---
|
||||
float weight = 0, targetWeight = 0;
|
||||
|
||||
@@ -192,6 +192,8 @@ void ProtocolClient::applyState(const String& json) {
|
||||
s.heatUpRemainSec = doc["heatUpRemainSec"] | (long)-1;
|
||||
s.lightOn = doc["lightOn"] | false;
|
||||
s.piezoEnabled = doc["piezoEnabled"] | false;
|
||||
s.activeProfile = String((const char*)(doc["profile"] | "")); // fehlt bei aelterer S3-FW -> leer
|
||||
s.profileDirty = doc["profDirty"] | false;
|
||||
|
||||
s.weight = doc["weight"] | s.weight;
|
||||
s.targetWeight = doc["targetWeight"] | s.targetWeight;
|
||||
|
||||
+209
-26
@@ -17,6 +17,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <Preferences.h> // Dashboard-Design P4-lokal merken (NVS)
|
||||
#include <esp_heap_caps.h> // Verlaufs-Historie im PSRAM allozieren (interner RAM ist knapp)
|
||||
#include "ui.h"
|
||||
#include "theme.h"
|
||||
#include "config.h"
|
||||
@@ -103,6 +104,12 @@ static lv_obj_t* bulbTempW = nullptr; static lv_obj_t* bulbTempD = nullptr;
|
||||
static lv_obj_t* g_designBtn[TD_DESIGN_COUNT] = {}; // Umschalter auf der Info-Seite
|
||||
static lv_obj_t* g_readyPill = nullptr; // "BEREIT"-Pille im Header (Kessel im Zielband)
|
||||
static bool g_readyState = false; // mit Hysterese, gegen Flackern an der Bandgrenze
|
||||
// Profil-Chip im Header (zuletzt geladenes Profil; "*" = danach geaenderte Einstellungen).
|
||||
// Antippen oeffnet die Profil-Schnellwahl (Overlay mit allen Profilen zum Direkt-Laden).
|
||||
static lv_obj_t* g_profChip = nullptr;
|
||||
static lv_obj_t* g_profPicker = nullptr; // Schnellwahl-Overlay (Vollbild-Abdunkelung)
|
||||
static lv_obj_t* g_profPickerList = nullptr; // Button-Liste im Overlay
|
||||
static lv_obj_t* g_profPickerInfo = nullptr; // "Lade Profile..."-Hinweis im Overlay
|
||||
static lv_obj_t* cellShot; static lv_obj_t* lblShotTimer; static lv_obj_t* g_bbtBar = nullptr;
|
||||
static lv_obj_t* cellSteam; static lv_obj_t* lblSteamTimer; static lv_obj_t* g_sbtBar = nullptr;
|
||||
static lv_obj_t* cellBezug; static lv_obj_t* lblBezug; static lv_obj_t* g_bbwBar = nullptr;
|
||||
@@ -124,11 +131,17 @@ static lv_obj_t* g_axHi = nullptr; static lv_obj_t* g_axMid = nullptr; static lv
|
||||
static const uint16_t CHART_WIN_MIN[4] = { 2, 10, 30, 60 }; // waehlbare Fenster (Minuten)
|
||||
#define CHART_HIST_MAX 3600 // Historie: 60 min à 1 s
|
||||
#define CHART_HIST_NONE INT16_MIN // Markierung "keine Probe"
|
||||
static int16_t g_histW[CHART_HIST_MAX]; // Zehntelgrad
|
||||
static int16_t g_histD[CHART_HIST_MAX];
|
||||
static int16_t g_histC[CHART_HIST_MAX];
|
||||
static uint8_t g_histDutyW[CHART_HIST_MAX]; // Heizleistung (%)
|
||||
static uint8_t g_histDutyD[CHART_HIST_MAX];
|
||||
// Die ~29 KB Historie liegen im PSRAM (heap_caps_malloc in ui_init, wie die LVGL-
|
||||
// Framebuffer) - als statische Arrays wuerden sie den knappen internen RAM sprengen
|
||||
// (Board-Limit war vor diesem Feature bereits zu ~98 % belegt).
|
||||
struct ChartHist {
|
||||
int16_t w[CHART_HIST_MAX]; // Wasser (Zehntelgrad)
|
||||
int16_t d[CHART_HIST_MAX]; // Dampf (Zehntelgrad)
|
||||
int16_t c[CHART_HIST_MAX]; // Zusatzsensor (Zehntelgrad; CHART_HIST_NONE = aus)
|
||||
uint8_t dutyW[CHART_HIST_MAX]; // Heizleistung Wasser (%)
|
||||
uint8_t dutyD[CHART_HIST_MAX]; // Heizleistung Dampf (%)
|
||||
};
|
||||
static ChartHist* g_hist = nullptr;
|
||||
static uint16_t g_histPos = 0, g_histFill = 0;
|
||||
static uint8_t g_chartWin = 0; // Index in CHART_WIN_MIN (P4-lokal in NVS, "chartwin")
|
||||
static bool g_chartDuty = false; // Heizleistung als Zusatzkurven (NVS "chartduty")
|
||||
@@ -1471,25 +1484,44 @@ static void build_chart(lv_obj_t* p) {
|
||||
// Y-Achse ueber das sichtbare Fenster (Werte < 30 Grad = kalter/inaktiver Sensor werden
|
||||
// fuer die Skala ignoriert) und positioniert die gestrichelten Soll-Linien.
|
||||
static void chart_redraw() {
|
||||
if (!g_chart) return;
|
||||
if (!g_chart || !g_hist) return;
|
||||
const int stride = (int)CHART_WIN_MIN[g_chartWin] * 60 / 120; // Sekunden je Chart-Punkt
|
||||
int32_t lo = INT32_MAX, hi = INT32_MIN; // Zehntelgrad
|
||||
bool anyW = false, anyD = false;
|
||||
for (int i = 0; i < 120; i++) {
|
||||
int age = (119 - i) * stride; // Alter der Probe (Sekunden)
|
||||
int ageStart = (119 - i) * stride; // juengstes Alter im Bucket (Sekunden)
|
||||
int32_t vW = LV_CHART_POINT_NONE, vD = LV_CHART_POINT_NONE, vC = LV_CHART_POINT_NONE;
|
||||
int32_t dW = LV_CHART_POINT_NONE, dD = LV_CHART_POINT_NONE;
|
||||
if (age < (int)g_histFill) {
|
||||
int idx = (int)g_histPos - 1 - age;
|
||||
if (idx < 0) idx += CHART_HIST_MAX;
|
||||
vW = g_histW[idx];
|
||||
vD = g_histD[idx];
|
||||
if (g_histC[idx] != CHART_HIST_NONE) vC = g_histC[idx];
|
||||
dW = g_histDutyW[idx];
|
||||
dD = g_histDutyD[idx];
|
||||
if (vW > 300) { anyW = true; if (vW < lo) lo = vW; if (vW > hi) hi = vW; }
|
||||
if (vD > 300) { anyD = true; if (vD < lo) lo = vD; if (vD > hi) hi = vD; }
|
||||
if (vC != LV_CHART_POINT_NONE && vC > 300) { if (vC < lo) lo = vC; if (vC > hi) hi = vC; }
|
||||
if (ageStart < (int)g_histFill) {
|
||||
// Ueber den ganzen Bucket mitteln statt ein Einzelsample zu picken: das
|
||||
// Abtast-Raster haengt an g_histPos und wandert sonst mit jedem Sekundentick,
|
||||
// wodurch schnell schaltende Werte (Duty-PWM) sichtbar zwischen zwei
|
||||
// Kurvenbildern hin- und herspringen. Der Mittelwert ist zudem bei der
|
||||
// Heizleistung die ehrlichere Aussage als ein zufaelliger Momentwert.
|
||||
int32_t sW = 0, sD = 0, sC = 0, sDW = 0, sDD = 0;
|
||||
int nT = 0, nC = 0;
|
||||
for (int s = 0; s < stride; s++) {
|
||||
int age = ageStart + s;
|
||||
if (age >= (int)g_histFill) break;
|
||||
int idx = (int)g_histPos - 1 - age;
|
||||
if (idx < 0) idx += CHART_HIST_MAX;
|
||||
sW += g_hist->w[idx];
|
||||
sD += g_hist->d[idx];
|
||||
sDW += g_hist->dutyW[idx];
|
||||
sDD += g_hist->dutyD[idx];
|
||||
nT++;
|
||||
if (g_hist->c[idx] != CHART_HIST_NONE) { sC += g_hist->c[idx]; nC++; }
|
||||
}
|
||||
if (nT > 0) {
|
||||
vW = (sW + nT / 2) / nT;
|
||||
vD = (sD + nT / 2) / nT;
|
||||
dW = (sDW + nT / 2) / nT;
|
||||
dD = (sDD + nT / 2) / nT;
|
||||
if (nC > 0) vC = (sC + nC / 2) / nC;
|
||||
if (vW > 300) { anyW = true; if (vW < lo) lo = vW; if (vW > hi) hi = vW; }
|
||||
if (vD > 300) { anyD = true; if (vD < lo) lo = vD; if (vD > hi) hi = vD; }
|
||||
if (vC != LV_CHART_POINT_NONE && vC > 300) { if (vC < lo) lo = vC; if (vC > hi) hi = vC; }
|
||||
}
|
||||
}
|
||||
lv_chart_set_value_by_id(g_chart, g_serW, i, vW);
|
||||
lv_chart_set_value_by_id(g_chart, g_serD, i, vD);
|
||||
@@ -1540,15 +1572,15 @@ static void chart_redraw() {
|
||||
lv_chart_refresh(g_chart);
|
||||
}
|
||||
static void chart_sample_cb(lv_timer_t*) {
|
||||
if (!g_chart) return;
|
||||
if (!g_chart || !g_hist) return;
|
||||
// 1-s-Probe in die 60-min-Historie (Ringpuffer); Anzeige zeichnet chart_redraw
|
||||
bool caseOn = g_state.caseSensorEnabled && g_state.hasCaseTemp;
|
||||
g_histW[g_histPos] = (int16_t)(g_state.tempW * 10.0f + 0.5f);
|
||||
g_histD[g_histPos] = (int16_t)(g_state.tempD * 10.0f + 0.5f);
|
||||
g_histC[g_histPos] = caseOn ? (int16_t)(g_state.caseTemp * 10.0f + 0.5f) : CHART_HIST_NONE;
|
||||
g_hist->w[g_histPos] = (int16_t)(g_state.tempW * 10.0f + 0.5f);
|
||||
g_hist->d[g_histPos] = (int16_t)(g_state.tempD * 10.0f + 0.5f);
|
||||
g_hist->c[g_histPos] = caseOn ? (int16_t)(g_state.caseTemp * 10.0f + 0.5f) : CHART_HIST_NONE;
|
||||
float dw = g_state.dutyW, dd = g_state.dutyD;
|
||||
g_histDutyW[g_histPos] = (uint8_t)(dw < 0.0f ? 0 : (dw > 100.0f ? 100 : (int)(dw + 0.5f)));
|
||||
g_histDutyD[g_histPos] = (uint8_t)(dd < 0.0f ? 0 : (dd > 100.0f ? 100 : (int)(dd + 0.5f)));
|
||||
g_hist->dutyW[g_histPos] = (uint8_t)(dw < 0.0f ? 0 : (dw > 100.0f ? 100 : (int)(dw + 0.5f)));
|
||||
g_hist->dutyD[g_histPos] = (uint8_t)(dd < 0.0f ? 0 : (dd > 100.0f ? 100 : (int)(dd + 0.5f)));
|
||||
g_histPos = (uint16_t)((g_histPos + 1) % CHART_HIST_MAX);
|
||||
if (g_histFill < CHART_HIST_MAX) g_histFill++;
|
||||
|
||||
@@ -2349,6 +2381,112 @@ static void prof_save_cb(lv_event_t*) {
|
||||
}
|
||||
static void prof_refresh_cb(lv_event_t*) { if (g_client) g_client->sendListProfiles(); }
|
||||
|
||||
// --- Profil-Schnellwahl: Overlay mit allen Profilen zum Direkt-Laden ------------------
|
||||
// Geoeffnet ueber den Profil-Chip im Header; ein Tap laedt das Profil sofort (die
|
||||
// Bestaetigung uebernimmt der Toast + der aktualisierte Chip aus dem naechsten State).
|
||||
static void prof_picker_close() {
|
||||
if (!g_profPicker) return;
|
||||
lv_obj_delete(g_profPicker);
|
||||
g_profPicker = nullptr;
|
||||
g_profPickerList = nullptr;
|
||||
g_profPickerInfo = nullptr;
|
||||
}
|
||||
static void prof_picker_bg_cb(lv_event_t* e) {
|
||||
// nur ein Tap auf die Abdunkelung selbst schliesst (Karte bubbelt nicht)
|
||||
if (lv_event_get_target(e) == lv_event_get_current_target(e)) prof_picker_close();
|
||||
}
|
||||
static void prof_picker_close_cb(lv_event_t*) { prof_picker_close(); }
|
||||
static void prof_picker_load_cb(lv_event_t* e) {
|
||||
lv_obj_t* btn = (lv_obj_t*)lv_event_get_current_target(e);
|
||||
lv_obj_t* lbl = lv_obj_get_child(btn, 0); // Kind 0 = Name (pur), Kind 1 = optionales Haekchen
|
||||
if (!lbl || !g_client) return;
|
||||
String name = lv_label_get_text(lbl);
|
||||
prof_picker_close();
|
||||
if (name == g_state.activeProfile && !g_state.profileDirty) {
|
||||
showToast(("Profil ist bereits aktiv: " + name).c_str(), false);
|
||||
return;
|
||||
}
|
||||
g_client->sendLoadProfile(name);
|
||||
showToast(("Lade Profil: " + name).c_str(), false);
|
||||
}
|
||||
static void prof_picker_fill(const String profiles[], int count) {
|
||||
if (!g_profPickerList) return;
|
||||
lv_obj_clean(g_profPickerList);
|
||||
if (g_profPickerInfo) {
|
||||
if (count == 0) {
|
||||
lv_label_set_text(g_profPickerInfo, "Keine Profile gespeichert.");
|
||||
lv_obj_remove_flag(g_profPickerInfo, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
lv_obj_add_flag(g_profPickerInfo, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
bool active = (profiles[i] == g_state.activeProfile);
|
||||
lv_obj_t* b = lv_button_create(g_profPickerList);
|
||||
lv_obj_set_width(b, LV_PCT(100));
|
||||
lv_obj_set_style_bg_color(b, active ? COL_ACCENT : COL_CARD2, 0);
|
||||
lv_obj_set_style_radius(b, 10, 0);
|
||||
lv_obj_set_style_pad_ver(b, 12, 0);
|
||||
lv_obj_set_style_pad_hor(b, 14, 0);
|
||||
lv_obj_set_style_shadow_width(b, 0, 0);
|
||||
lv_obj_t* l = lv_label_create(b); // Kind 0: purer Profilname (prof_picker_load_cb liest ihn)
|
||||
lv_label_set_text(l, profiles[i].c_str());
|
||||
lv_obj_set_style_text_color(l, active ? lv_color_hex(0x000000) : COL_TEXT, 0);
|
||||
lv_obj_align(l, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
if (active) {
|
||||
lv_obj_t* chk = lv_label_create(b);
|
||||
lv_label_set_text(chk, LV_SYMBOL_OK);
|
||||
lv_obj_set_style_text_color(chk, lv_color_hex(0x000000), 0);
|
||||
lv_obj_align(chk, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
}
|
||||
lv_obj_add_event_cb(b, prof_picker_load_cb, LV_EVENT_CLICKED, nullptr);
|
||||
}
|
||||
}
|
||||
static void prof_picker_open() {
|
||||
if (g_profPicker) return;
|
||||
g_profPicker = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(g_profPicker, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_pos(g_profPicker, 0, 0);
|
||||
lv_obj_set_style_bg_color(g_profPicker, lv_color_hex(0x000000), 0);
|
||||
lv_obj_set_style_bg_opa(g_profPicker, LV_OPA_60, 0);
|
||||
lv_obj_set_style_border_width(g_profPicker, 0, 0);
|
||||
lv_obj_set_style_radius(g_profPicker, 0, 0);
|
||||
lv_obj_set_style_pad_all(g_profPicker, 0, 0);
|
||||
lv_obj_clear_flag(g_profPicker, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_add_event_cb(g_profPicker, prof_picker_bg_cb, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* card = th_card(g_profPicker);
|
||||
lv_obj_set_size(card, 460, 400);
|
||||
lv_obj_center(card);
|
||||
lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(card, 8, 0);
|
||||
lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* hdr = row(card, nullptr);
|
||||
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_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);
|
||||
|
||||
g_profPickerInfo = lv_label_create(card);
|
||||
lv_label_set_text(g_profPickerInfo, "Lade Profile...");
|
||||
lv_obj_set_style_text_color(g_profPickerInfo, COL_TEXT_DIM, 0);
|
||||
|
||||
g_profPickerList = lv_obj_create(card);
|
||||
lv_obj_set_width(g_profPickerList, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(g_profPickerList, 1);
|
||||
lv_obj_set_style_bg_opa(g_profPickerList, LV_OPA_TRANSP, 0);
|
||||
lv_obj_set_style_border_width(g_profPickerList, 0, 0);
|
||||
lv_obj_set_style_pad_all(g_profPickerList, 0, 0);
|
||||
lv_obj_set_style_pad_row(g_profPickerList, 6, 0);
|
||||
lv_obj_set_flex_flow(g_profPickerList, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
if (g_client) g_client->sendListProfiles(); // Antwort fuellt via ui_set_profiles/prof_picker_fill
|
||||
}
|
||||
static void prof_chip_cb(lv_event_t*) { prof_picker_open(); }
|
||||
|
||||
static void build_profiles(lv_obj_t* p) {
|
||||
lv_obj_clear_flag(p, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
@@ -2789,6 +2927,13 @@ void ui_init(ProtocolClient* client) {
|
||||
g_client = client;
|
||||
|
||||
// Gespeicherte Darstellungs-Einstellungen laden (P4-lokal; Design-Standard: Rundinstrumente)
|
||||
// Verlaufs-Historie (60 min à 1 s, ~29 KB) im PSRAM anlegen - wie die LVGL-Framebuffer.
|
||||
// Schlaegt die Allokation fehl, bleibt das Chart schlicht leer (alle Zugriffe geprueft).
|
||||
if (!g_hist) {
|
||||
g_hist = (ChartHist*)heap_caps_malloc(sizeof(ChartHist), MALLOC_CAP_SPIRAM);
|
||||
if (!g_hist) g_hist = (ChartHist*)heap_caps_malloc(sizeof(ChartHist), MALLOC_CAP_8BIT);
|
||||
}
|
||||
|
||||
{ Preferences prefs; prefs.begin("ui", false);
|
||||
g_tempDesign = prefs.getUChar("tempdsgn", TD_GAUGE);
|
||||
g_brewLiveEnabled = prefs.getBool("brewlive", true);
|
||||
@@ -2826,6 +2971,22 @@ void ui_init(ProtocolClient* client) {
|
||||
lv_obj_set_flex_grow(g_hdrTitle, 1);
|
||||
lv_obj_set_style_text_font(g_hdrTitle, &lv_font_maven_pro_18, 0);
|
||||
|
||||
// Profil-Chip: zuletzt geladenes Profil ("*" = seitdem geaenderte Einstellungen).
|
||||
// Antippen oeffnet die Profil-Schnellwahl. Unsichtbar, solange die S3 kein Profil meldet.
|
||||
g_profChip = lv_label_create(header);
|
||||
lv_label_set_text(g_profChip, "");
|
||||
lv_obj_set_style_bg_color(g_profChip, COL_CARD2, 0);
|
||||
lv_obj_set_style_bg_opa(g_profChip, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(g_profChip, COL_TEXT, 0);
|
||||
lv_obj_set_style_radius(g_profChip, 12, 0);
|
||||
lv_obj_set_style_pad_hor(g_profChip, 10, 0);
|
||||
lv_obj_set_style_pad_ver(g_profChip, 3, 0);
|
||||
lv_obj_set_style_margin_right(g_profChip, 10, 0);
|
||||
lv_obj_add_flag(g_profChip, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_ext_click_area(g_profChip, 8);
|
||||
lv_obj_add_event_cb(g_profChip, prof_chip_cb, LV_EVENT_CLICKED, nullptr);
|
||||
lv_obj_add_flag(g_profChip, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
g_readyPill = lv_label_create(header); // "BEREIT": Kessel im Zielband (auf allen Seiten sichtbar)
|
||||
lv_label_set_text(g_readyPill, "BEREIT");
|
||||
lv_obj_set_style_bg_color(g_readyPill, COL_OK, 0);
|
||||
@@ -3404,6 +3565,24 @@ void ui_update(const MachineState& st) {
|
||||
else ui_fade_out_hide(g_readyPill, UI_FADE_MS);
|
||||
}
|
||||
}
|
||||
// Profil-Chip im Header: Name des zuletzt geladenen Profils, "*" wenn seitdem
|
||||
// profil-relevante Einstellungen geaendert wurden. Lange Namen werden gekuerzt,
|
||||
// damit der Header nicht ueberlaeuft. Leer (alte S3-FW / kein Profil) -> versteckt.
|
||||
if (g_profChip) {
|
||||
if (st.activeProfile.length() > 0) {
|
||||
String t = st.activeProfile;
|
||||
if (t.length() > 18) {
|
||||
int cut = 17; // nicht mitten in einem UTF-8-Mehrbyte-Zeichen (Umlaut) schneiden
|
||||
while (cut > 0 && ((uint8_t)t[cut] & 0xC0) == 0x80) cut--;
|
||||
t = t.substring(0, cut) + "...";
|
||||
}
|
||||
if (st.profileDirty) t += " *";
|
||||
label_set_if_changed(g_profChip, t.c_str());
|
||||
lv_obj_remove_flag(g_profChip, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
lv_obj_add_flag(g_profChip, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
// Timer-Synchronisation (die laufende Anzeige macht der 100-ms-Timer dash_timers_cb)
|
||||
// Tarier-Phase vor Brew-by-Weight-Bezug -> dash_timers_cb zeigt "Tariere..." im Shot-Timer
|
||||
g_scaleTaring = st.scaleTaring;
|
||||
@@ -3596,12 +3775,16 @@ void ui_update(const MachineState& st) {
|
||||
void ui_toast(const char* txt, bool error) { showToast(txt, error); }
|
||||
|
||||
void ui_set_profiles(const String profiles[], int count) {
|
||||
// Schnellwahl-Overlay (falls offen) mit derselben Antwort befuellen
|
||||
prof_picker_fill(profiles, count);
|
||||
if (!profList) return;
|
||||
lv_obj_clean(profList);
|
||||
for (int i = 0; i < count; i++) {
|
||||
lv_obj_t* b = lv_list_add_button(profList, LV_SYMBOL_FILE, profiles[i].c_str());
|
||||
// aktives Profil markieren (Haekchen + Akzentfarbe statt Datei-Symbol)
|
||||
bool active = (profiles[i] == g_state.activeProfile);
|
||||
lv_obj_t* b = lv_list_add_button(profList, active ? LV_SYMBOL_OK : LV_SYMBOL_FILE, profiles[i].c_str());
|
||||
lv_obj_set_style_bg_color(b, COL_CARD2, 0);
|
||||
lv_obj_set_style_text_color(b, COL_TEXT, 0);
|
||||
lv_obj_set_style_text_color(b, active ? COL_ACCENT : COL_TEXT, 0);
|
||||
lv_obj_add_event_cb(b, prof_select_cb, LV_EVENT_CLICKED, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user