Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db1b080dc4 | ||
|
|
5a1e8d4b50 | ||
|
|
4f840173a9 | ||
|
|
6371b22683 | ||
|
|
de2d0635b2 | ||
|
|
801a659b0c | ||
|
|
d97e4c34d5 | ||
|
|
00a4c80b13 | ||
|
|
a1431a9d42 | ||
|
|
d9bc31b555 | ||
|
|
5691a4c04f | ||
|
|
f8df6f85cd | ||
|
|
f43375e991 | ||
|
|
92ef4fbfb6 | ||
|
|
fd6ec5371b | ||
|
|
ea64e7de04 | ||
|
|
7d240cd13e | ||
|
|
27dabd884a |
@@ -1,3 +1,74 @@
|
|||||||
|
Version 5.3.0:
|
||||||
|
- Neu: Cold Extraction (kalte Extraktion). Die Maschine hat keinen Bypass um den Wasserkessel, kaltes Wasser
|
||||||
|
kommt also nur bei kaltem Kessel am Puck an. Die Funktion wird deshalb über eine Temperaturschwelle
|
||||||
|
freigegeben (Standard 30 °C, einstellbar 10–40 °C) und ist praktisch aus dem kalten Zustand heraus nutzbar.
|
||||||
|
- Solange der Modus aktiv ist, heizt der Wasserkreis nicht (SSR gesperrt, Stellgröße und damit auch die
|
||||||
|
dutyW-Telemetrie auf 0, I-Anteil der Wasser-PID eingefroren, Feed-Forward-Boost deaktiviert). Der
|
||||||
|
Dampfkreis bleibt unberührt und darf weiter heizen.
|
||||||
|
- Die Freigabe wird vor jedem Bezug neu geprüft, nicht nur beim Aktivieren: Da der Dampfkessel weiter heizt,
|
||||||
|
kann der Wasserkessel über die Zeit über die Schwelle steigen. In diesem Fall wird der nächste Bezug
|
||||||
|
abgewiesen (Meldung auf OLED, Touch-Display und im Web-Dashboard) - ein laufender Bezug wird nie abgebrochen.
|
||||||
|
Hysterese von 5 °C, damit die Anzeige an der Schwelle nicht flattert; Sensorfehler sperrt die Funktion.
|
||||||
|
- Der Fluss wird über Pumpen-Pulsung reduziert (Pulsperiode 200–5000 ms, Pumpenleistung 5–100 %), davor läuft
|
||||||
|
eine einstellbare Vorbenetzung mit voller Pumpenleistung. Bezugsende über Zielgewicht oder Sicherheits-Timeout;
|
||||||
|
Brew-by-Time/Brew-by-Weight und FlowGuard sind während einer kalten Extraktion bewusst außer Kraft (FlowGuard
|
||||||
|
und Cold Extraction würden sonst um denselben Pumpen-Ausgang konkurrieren).
|
||||||
|
- Pumpenschutz: Die Steuerung zählt die kumulierte Pumpen-Einschaltzeit und legt nach der eingestellten
|
||||||
|
Laufzeit eine Zwangspause ein (Standard 60 s Laufzeit / 20 s Pause). Zusätzlich Stillstands-Erkennung -
|
||||||
|
läuft die Pumpe bei aktiver Waage 15 s ohne Zulauf, wird der Bezug beendet (dichter Puck oder ausgelöster
|
||||||
|
Pumpen-Thermoschutz).
|
||||||
|
- Bedienung: Parameter auf der Seite /Brew-Control, Ein-/Ausschalten über das Web-Dashboard oder das
|
||||||
|
UART-Touch-Display (neue Aktionen "startColdExtraction"/"stopColdExtraction"/"toggleColdExtraction").
|
||||||
|
Cold Extraction ist bewusst kein Profilfeld (maschinen- und situationsabhängig, wie der Feed-Forward);
|
||||||
|
der Modus selbst wird nicht persistiert und ist nach einem Neustart immer aus. Standby beendet ihn.
|
||||||
|
- Statistik: Kalte Bezüge werden im Log mit einem vierten CSV-Feld "C" gekennzeichnet, zählen in allen
|
||||||
|
Stückzahlen mit, gehen aber NICHT in die durchschnittliche Bezugsdauer ein (Minuten statt Sekunden würden
|
||||||
|
den Wert verzerren). Die Info-Seite weist die Anzahl separat aus, der Verlaufs-Download hat eine neue
|
||||||
|
Spalte "Art". Ältere Logzeilen bleiben unverändert lesbar.
|
||||||
|
- Neue additive State-Felder im UART-JSON (Protokoll bleibt v2): cxEnabled, cxActive, cxShot, cxAllowed,
|
||||||
|
cxResting, cxMaxTemp, cxTarget, cxMaxSecs, cxMessage sowie "cx" pro Eintrag in usageStats; neuer
|
||||||
|
statusKey "coldextraction". Ältere Display-Firmware ignoriert die Felder.
|
||||||
|
|
||||||
|
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:
|
Version 5.0.12:
|
||||||
- Neues additives Feld "piState" im State-JSON für das UART-Touch-Display (0=inaktiv, 1=Pre-Infusion,
|
- 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
|
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 |
|
| `steamHeatDisabled` | bool | Dampfheizung per Nutzer deaktiviert |
|
||||||
| `lightOn` | bool | Beleuchtung an |
|
| `lightOn` | bool | Beleuchtung an |
|
||||||
| `piezoEnabled` | bool | Piezo-Summer aktiv |
|
| `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) |
|
| `weight` | float | aktuelles Waagengewicht (UI) |
|
||||||
| `targetWeight` | float | Ziel-Gewicht (Brew-by-Weight) |
|
| `targetWeight` | float | Ziel-Gewicht (Brew-by-Weight) |
|
||||||
| `scaleEnabled` | bool | Waage aktiviert |
|
| `scaleEnabled` | bool | Waage aktiviert |
|
||||||
@@ -313,6 +315,23 @@ Alle gültigen `action`-Strings aus `executeDashboardAction()` (Stand v4.8.1, Ze
|
|||||||
| `disableSteamHeat` | — | Dampf-Heizung abschalten |
|
| `disableSteamHeat` | — | Dampf-Heizung abschalten |
|
||||||
| `enableSteamHeat` | — | Dampf-Heizung wieder aktivieren |
|
| `enableSteamHeat` | — | Dampf-Heizung wieder aktivieren |
|
||||||
|
|
||||||
|
**Cold Extraction (kalte Extraktion, ab S3 5.3.0)**
|
||||||
|
|
||||||
|
| `action` | `value` | Wirkung |
|
||||||
|
|---|---|---|
|
||||||
|
| `startColdExtraction` | — | Modus aktivieren (Wasserkreis heizt nicht, Dampf bleibt möglich) |
|
||||||
|
| `stopColdExtraction` | — | Modus beenden |
|
||||||
|
| `toggleColdExtraction` | — | Modus umschalten |
|
||||||
|
|
||||||
|
Alle drei Aktionen werden abgewiesen (`ok:false` + `message`), solange die Bedingungen nicht
|
||||||
|
erfüllt sind — Hauptfall ist ein zu warmer Wasserkessel (`cxAllowed:false`). Der Modus wird
|
||||||
|
**nicht** persistiert und ist nach jedem Neustart aus; Standby beendet ihn. Ein laufender
|
||||||
|
Bezug wird nie abgebrochen, `stopColdExtraction` schlägt dann fehl.
|
||||||
|
|
||||||
|
Die Parameter der kalten Extraktion (Schwelle, Vorbenetzung, Pulsperiode, Pumpenleistung,
|
||||||
|
Zielgewicht, Timeout, Pumpenschutz) sind bewusst **nicht** über `saveBrew` erreichbar, sondern
|
||||||
|
nur über die Web-Seite `/Brew-Control`. Das Display schaltet den Modus, konfiguriert ihn nicht.
|
||||||
|
|
||||||
**Persistente Toggles**
|
**Persistente Toggles**
|
||||||
|
|
||||||
| `action` | `value` | Wirkung |
|
| `action` | `value` | Wirkung |
|
||||||
@@ -352,7 +371,28 @@ Aus `getTouchUartStatus()`. Für sprach-unabhängige UI-Logik/Icons auf dem P4 v
|
|||||||
(statt `statusText` zu parsen):
|
(statt `statusText` zu parsen):
|
||||||
|
|
||||||
`ready`, `error`, `standby`, `maintenance`, `tuning`, `brewing`, `eco`, `fastheatup`,
|
`ready`, `error`, `standby`, `maintenance`, `tuning`, `brewing`, `eco`, `fastheatup`,
|
||||||
`heating`, `ready_eco_pending`.
|
`heating`, `ready_eco_pending`, `coldextraction` (ab S3 5.3.0).
|
||||||
|
|
||||||
|
### Cold-Extraction-Felder im `state` (ab S3 5.3.0, additiv — Protokoll bleibt v2)
|
||||||
|
|
||||||
|
| Feld | Typ | Bedeutung |
|
||||||
|
|---|---|---|
|
||||||
|
| `cxEnabled` | bool | Funktion in der Web-UI freigeschaltet (sonst Bedienelement ausblenden) |
|
||||||
|
| `cxActive` | bool | Modus scharf: Wasserkreis heizt nicht |
|
||||||
|
| `cxShot` | bool | Der laufende Bezug ist eine kalte Extraktion |
|
||||||
|
| `cxAllowed` | bool | Freigabe **jetzt** (Wasserkessel kalt genug, kein Standby/Wartung/Tuning) |
|
||||||
|
| `cxResting` | bool | Zwangspause des Pumpenschutzes läuft (Bezug läuft weiter) |
|
||||||
|
| `cxMaxTemp` | float | Freigabeschwelle in °C (für eigene Hinweistexte am Display) |
|
||||||
|
| `cxTarget` | float | Zielgewicht in g |
|
||||||
|
| `cxMaxSecs` | float | Sicherheits-Timeout des Bezugs in s |
|
||||||
|
| `cxMessage` | string | Sperr-/Abbruchmeldung, leer = keine (läuft nach ~6 s selbst ab) |
|
||||||
|
|
||||||
|
Während `cxShot` folgt die Phase weiterhin `piState`: `1` = Vorbenetzung, `3` = Hauptbezug
|
||||||
|
(gepulst). Eine Pause-Phase (`2`) gibt es bei der kalten Extraktion nicht.
|
||||||
|
|
||||||
|
In der Antwort auf `getUsageStats` trägt jeder Eintrag in `shots[]` zusätzlich `cx` (bool) —
|
||||||
|
kalte Bezüge zählen in `total`/`today`/`week` mit, sind aber in der durchschnittlichen
|
||||||
|
Bezugsdauer der S3-Statistik ausgenommen.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1342
-134
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:
|
Version 1.0.11:
|
||||||
- Verlauf-Seite ausgebaut (nur P4, keine S3-/Protokolländerung nötig):
|
- 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.
|
- Umschaltbares Zeitfenster: Buttons „2 min / 10 min / 30 min / 60 min" in der Kopfzeile.
|
||||||
@@ -14,6 +36,11 @@ Version 1.0.11:
|
|||||||
ebenfalls P4-lokal im NVS.
|
ebenfalls P4-lokal im NVS.
|
||||||
- Feinere Kurven: Die Temperatur-Historie wird jetzt in Zehntelgrad geführt und gezeichnet
|
- 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.
|
(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.
|
||||||
- PID-AutoTune sichtbar gemacht: Während eines Tuning-Laufs erscheint auf der Verlauf-Seite
|
- PID-AutoTune sichtbar gemacht: Während eines Tuning-Laufs erscheint auf der Verlauf-Seite
|
||||||
eine Live-Karte (mit Spinner) — je Kreis Laufzeit, aktuelle Phase (heizt/kühlt ab) und
|
eine Live-Karte (mit Spinner) — je Kreis Laufzeit, aktuelle Phase (heizt/kühlt ab) und
|
||||||
Schwingungshub samt Mittelpunkt (Min/Max der Ist-Temperatur seit Start). Nach dem Ende
|
Schwingungshub samt Mittelpunkt (Min/Max der Ist-Temperatur seit Start). Nach dem Ende
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
// Firmware
|
// 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
|
// Protokoll
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ struct MachineState {
|
|||||||
long heatUpRemainSec = -1; // verbleibende Sekunden bis "durchgewaermt" (-1 = aus)
|
long heatUpRemainSec = -1; // verbleibende Sekunden bis "durchgewaermt" (-1 = aus)
|
||||||
bool lightOn = false;
|
bool lightOn = false;
|
||||||
bool piezoEnabled = 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 ---
|
// --- Waage ---
|
||||||
float weight = 0, targetWeight = 0;
|
float weight = 0, targetWeight = 0;
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ void ProtocolClient::applyState(const String& json) {
|
|||||||
s.heatUpRemainSec = doc["heatUpRemainSec"] | (long)-1;
|
s.heatUpRemainSec = doc["heatUpRemainSec"] | (long)-1;
|
||||||
s.lightOn = doc["lightOn"] | false;
|
s.lightOn = doc["lightOn"] | false;
|
||||||
s.piezoEnabled = doc["piezoEnabled"] | 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.weight = doc["weight"] | s.weight;
|
||||||
s.targetWeight = doc["targetWeight"] | s.targetWeight;
|
s.targetWeight = doc["targetWeight"] | s.targetWeight;
|
||||||
|
|||||||
+211
-28
@@ -17,6 +17,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <Preferences.h> // Dashboard-Design P4-lokal merken (NVS)
|
#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 "ui.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "config.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_designBtn[TD_DESIGN_COUNT] = {}; // Umschalter auf der Info-Seite
|
||||||
static lv_obj_t* g_readyPill = nullptr; // "BEREIT"-Pille im Header (Kessel im Zielband)
|
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
|
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* 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* 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;
|
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)
|
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_MAX 3600 // Historie: 60 min à 1 s
|
||||||
#define CHART_HIST_NONE INT16_MIN // Markierung "keine Probe"
|
#define CHART_HIST_NONE INT16_MIN // Markierung "keine Probe"
|
||||||
static int16_t g_histW[CHART_HIST_MAX]; // Zehntelgrad
|
// Die ~29 KB Historie liegen im PSRAM (heap_caps_malloc in ui_init, wie die LVGL-
|
||||||
static int16_t g_histD[CHART_HIST_MAX];
|
// Framebuffer) - als statische Arrays wuerden sie den knappen internen RAM sprengen
|
||||||
static int16_t g_histC[CHART_HIST_MAX];
|
// (Board-Limit war vor diesem Feature bereits zu ~98 % belegt).
|
||||||
static uint8_t g_histDutyW[CHART_HIST_MAX]; // Heizleistung (%)
|
struct ChartHist {
|
||||||
static uint8_t g_histDutyD[CHART_HIST_MAX];
|
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 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 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")
|
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
|
// Y-Achse ueber das sichtbare Fenster (Werte < 30 Grad = kalter/inaktiver Sensor werden
|
||||||
// fuer die Skala ignoriert) und positioniert die gestrichelten Soll-Linien.
|
// fuer die Skala ignoriert) und positioniert die gestrichelten Soll-Linien.
|
||||||
static void chart_redraw() {
|
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
|
const int stride = (int)CHART_WIN_MIN[g_chartWin] * 60 / 120; // Sekunden je Chart-Punkt
|
||||||
int32_t lo = INT32_MAX, hi = INT32_MIN; // Zehntelgrad
|
int32_t lo = INT32_MAX, hi = INT32_MIN; // Zehntelgrad
|
||||||
bool anyW = false, anyD = false;
|
bool anyW = false, anyD = false;
|
||||||
for (int i = 0; i < 120; i++) {
|
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 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;
|
int32_t dW = LV_CHART_POINT_NONE, dD = LV_CHART_POINT_NONE;
|
||||||
if (age < (int)g_histFill) {
|
if (ageStart < (int)g_histFill) {
|
||||||
int idx = (int)g_histPos - 1 - age;
|
// Ueber den ganzen Bucket mitteln statt ein Einzelsample zu picken: das
|
||||||
if (idx < 0) idx += CHART_HIST_MAX;
|
// Abtast-Raster haengt an g_histPos und wandert sonst mit jedem Sekundentick,
|
||||||
vW = g_histW[idx];
|
// wodurch schnell schaltende Werte (Duty-PWM) sichtbar zwischen zwei
|
||||||
vD = g_histD[idx];
|
// Kurvenbildern hin- und herspringen. Der Mittelwert ist zudem bei der
|
||||||
if (g_histC[idx] != CHART_HIST_NONE) vC = g_histC[idx];
|
// Heizleistung die ehrlichere Aussage als ein zufaelliger Momentwert.
|
||||||
dW = g_histDutyW[idx];
|
int32_t sW = 0, sD = 0, sC = 0, sDW = 0, sDD = 0;
|
||||||
dD = g_histDutyD[idx];
|
int nT = 0, nC = 0;
|
||||||
if (vW > 300) { anyW = true; if (vW < lo) lo = vW; if (vW > hi) hi = vW; }
|
for (int s = 0; s < stride; s++) {
|
||||||
if (vD > 300) { anyD = true; if (vD < lo) lo = vD; if (vD > hi) hi = vD; }
|
int age = ageStart + s;
|
||||||
if (vC != LV_CHART_POINT_NONE && vC > 300) { if (vC < lo) lo = vC; if (vC > hi) hi = vC; }
|
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_serW, i, vW);
|
||||||
lv_chart_set_value_by_id(g_chart, g_serD, i, vD);
|
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);
|
lv_chart_refresh(g_chart);
|
||||||
}
|
}
|
||||||
static void chart_sample_cb(lv_timer_t*) {
|
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
|
// 1-s-Probe in die 60-min-Historie (Ringpuffer); Anzeige zeichnet chart_redraw
|
||||||
bool caseOn = g_state.caseSensorEnabled && g_state.hasCaseTemp;
|
bool caseOn = g_state.caseSensorEnabled && g_state.hasCaseTemp;
|
||||||
g_histW[g_histPos] = (int16_t)(g_state.tempW * 10.0f + 0.5f);
|
g_hist->w[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_hist->d[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->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;
|
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_hist->dutyW[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->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);
|
g_histPos = (uint16_t)((g_histPos + 1) % CHART_HIST_MAX);
|
||||||
if (g_histFill < CHART_HIST_MAX) g_histFill++;
|
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(); }
|
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) {
|
static void build_profiles(lv_obj_t* p) {
|
||||||
lv_obj_clear_flag(p, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(p, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
|
||||||
@@ -2789,6 +2927,13 @@ void ui_init(ProtocolClient* client) {
|
|||||||
g_client = client;
|
g_client = client;
|
||||||
|
|
||||||
// Gespeicherte Darstellungs-Einstellungen laden (P4-lokal; Design-Standard: Rundinstrumente)
|
// 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);
|
{ Preferences prefs; prefs.begin("ui", false);
|
||||||
g_tempDesign = prefs.getUChar("tempdsgn", TD_GAUGE);
|
g_tempDesign = prefs.getUChar("tempdsgn", TD_GAUGE);
|
||||||
g_brewLiveEnabled = prefs.getBool("brewlive", true);
|
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_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, &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)
|
g_readyPill = lv_label_create(header); // "BEREIT": Kessel im Zielband (auf allen Seiten sichtbar)
|
||||||
lv_label_set_text(g_readyPill, "BEREIT");
|
lv_label_set_text(g_readyPill, "BEREIT");
|
||||||
lv_obj_set_style_bg_color(g_readyPill, COL_OK, 0);
|
lv_obj_set_style_bg_color(g_readyPill, COL_OK, 0);
|
||||||
@@ -3034,7 +3195,7 @@ void ui_init(ProtocolClient* client) {
|
|||||||
|
|
||||||
// Shot-Zusammenfassung (zentrierte Karte mit grossen Werten, antippbar zum Schliessen)
|
// Shot-Zusammenfassung (zentrierte Karte mit grossen Werten, antippbar zum Schliessen)
|
||||||
g_shotSum = lv_obj_create(lv_layer_top());
|
g_shotSum = lv_obj_create(lv_layer_top());
|
||||||
lv_obj_set_size(g_shotSum, 460, LV_SIZE_CONTENT);
|
lv_obj_set_size(g_shotSum, 560, LV_SIZE_CONTENT); // breit genug, damit die drei Werte nicht zusammenruecken
|
||||||
lv_obj_set_style_bg_color(g_shotSum, COL_CARD, 0);
|
lv_obj_set_style_bg_color(g_shotSum, COL_CARD, 0);
|
||||||
lv_obj_set_style_bg_opa(g_shotSum, LV_OPA_COVER, 0);
|
lv_obj_set_style_bg_opa(g_shotSum, LV_OPA_COVER, 0);
|
||||||
lv_obj_set_style_border_color(g_shotSum, COL_ACCENT, 0);
|
lv_obj_set_style_border_color(g_shotSum, COL_ACCENT, 0);
|
||||||
@@ -3060,7 +3221,7 @@ void ui_init(ProtocolClient* client) {
|
|||||||
lv_obj_set_style_bg_opa(sumRow, LV_OPA_TRANSP, 0);
|
lv_obj_set_style_bg_opa(sumRow, LV_OPA_TRANSP, 0);
|
||||||
lv_obj_set_style_border_width(sumRow, 0, 0);
|
lv_obj_set_style_border_width(sumRow, 0, 0);
|
||||||
lv_obj_set_style_pad_all(sumRow, 0, 0);
|
lv_obj_set_style_pad_all(sumRow, 0, 0);
|
||||||
lv_obj_set_style_pad_column(sumRow, 10, 0);
|
lv_obj_set_style_pad_column(sumRow, 28, 0); // deutlicher Abstand zwischen Dauer/Gewicht/Flow
|
||||||
lv_obj_set_flex_flow(sumRow, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(sumRow, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_clear_flag(sumRow, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(sumRow, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
lv_obj_clear_flag(sumRow, LV_OBJ_FLAG_CLICKABLE); // Tipp faellt auf die Karte durch
|
lv_obj_clear_flag(sumRow, LV_OBJ_FLAG_CLICKABLE); // Tipp faellt auf die Karte durch
|
||||||
@@ -3404,6 +3565,24 @@ void ui_update(const MachineState& st) {
|
|||||||
else ui_fade_out_hide(g_readyPill, UI_FADE_MS);
|
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)
|
// 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
|
// Tarier-Phase vor Brew-by-Weight-Bezug -> dash_timers_cb zeigt "Tariere..." im Shot-Timer
|
||||||
g_scaleTaring = st.scaleTaring;
|
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_toast(const char* txt, bool error) { showToast(txt, error); }
|
||||||
|
|
||||||
void ui_set_profiles(const String profiles[], int count) {
|
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;
|
if (!profList) return;
|
||||||
lv_obj_clean(profList);
|
lv_obj_clean(profList);
|
||||||
for (int i = 0; i < count; i++) {
|
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_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);
|
lv_obj_add_event_cb(b, prof_select_cb, LV_EVENT_CLICKED, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user