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();
if (data.button === "stop1" && status1 === "running") {
timer1 += (now - lastSync) / 1000;
status1 = "stopped";
status1 = "finished";
} else if (data.button === "stop2" && status2 === "running") {
timer2 += (now - lastSync) / 1000;
status2 = "stopped";
status2 = "finished";
}
kickDisplayScheduler();
syncFromBackend();
@@ -820,14 +820,19 @@
}
}
const validStatuses = ["ready", "running", "finished", "armed"];
function syncFromBackend() {
fetch("/api/data")
.then((response) => response.json())
.then((data) => {
timer1 = data.time1;
timer2 = data.time2;
status1 = data.status1;
status2 = data.status2;
// Status nur übernehmen, wenn der Wert gültig ist.
// 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;
best2 = data.best2;
learningMode = data.learningMode;

View File

@@ -24,7 +24,7 @@
#include <webserverrouter.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