BugFix: Status Unknown
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
Carsten Graf
2026-04-12 14:50:33 +02:00
parent 9d958c94f1
commit 48ae556949
2 changed files with 10 additions and 5 deletions

View File

@@ -177,10 +177,10 @@
const now = Date.now(); const now = Date.now();
if (data.button === "stop1" && status1 === "running") { if (data.button === "stop1" && status1 === "running") {
timer1 += (now - lastSync) / 1000; timer1 += (now - lastSync) / 1000;
status1 = "stopped"; status1 = "finished";
} else if (data.button === "stop2" && status2 === "running") { } else if (data.button === "stop2" && status2 === "running") {
timer2 += (now - lastSync) / 1000; timer2 += (now - lastSync) / 1000;
status2 = "stopped"; status2 = "finished";
} }
kickDisplayScheduler(); kickDisplayScheduler();
syncFromBackend(); syncFromBackend();
@@ -820,14 +820,19 @@
} }
} }
const validStatuses = ["ready", "running", "finished", "armed"];
function syncFromBackend() { function syncFromBackend() {
fetch("/api/data") fetch("/api/data")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
timer1 = data.time1; timer1 = data.time1;
timer2 = data.time2; timer2 = data.time2;
status1 = data.status1; // Status nur übernehmen, wenn der Wert gültig ist.
status2 = data.status2; // Bei unvollständiger ESP-Response (Last) bleibt der
// bisherige Status erhalten statt "Status unbekannt".
if (validStatuses.includes(data.status1)) status1 = data.status1;
if (validStatuses.includes(data.status2)) status2 = data.status2;
best1 = data.best1; best1 = data.best1;
best2 = data.best2; best2 = data.best2;
learningMode = data.learningMode; learningMode = data.learningMode;

View File

@@ -24,7 +24,7 @@
#include <webserverrouter.h> #include <webserverrouter.h>
#include <wificlass.h> #include <wificlass.h>
const char *firmwareversion = "1.1.0"; // Version der Firmware const char *firmwareversion = "1.1.1"; // Version der Firmware
// moved to preferencemanager.h // moved to preferencemanager.h