Bug fixed, Wettkampfmodus Done. TODO: Zeitstempel der Statusampel im Master verwenden

This commit is contained in:
Carsten Graf
2025-08-06 22:47:31 +02:00
parent 4a04565878
commit ba1b86a053
7 changed files with 102 additions and 87 deletions

View File

@@ -107,56 +107,7 @@ int checkLicence() {
return tier;
}
String getTimerDataJSON() {
DynamicJsonDocument doc(1024);
unsigned long currentTime = millis();
// Bahn 1
if (timerData.isRunning1) {
doc["time1"] = (currentTime - timerData.localStartTime1) / 1000.0;
doc["status1"] = "running";
} else if (timerData.endTime1 > 0) {
doc["time1"] = (timerData.endTime1 - timerData.startTime1) / 1000.0;
doc["status1"] = "finished";
} else if (timerData.isArmed1) {
doc["time1"] = 0;
doc["status1"] = "armed"; // Status für Bahn 1, wenn sie armiert ist
} else {
doc["time1"] = 0;
doc["status1"] = "ready";
}
// Bahn 2
if (timerData.isRunning2) {
doc["time2"] = (currentTime - timerData.localStartTime2) / 1000.0;
doc["status2"] = "running";
} else if (timerData.endTime2 > 0) {
doc["time2"] = (timerData.endTime2 - timerData.startTime2) / 1000.0;
doc["status2"] = "finished";
} else if (timerData.isArmed2) {
doc["time2"] = 0;
doc["status2"] = "armed"; // Status für Bahn 2, wenn sie armiert ist
} else {
doc["time2"] = 0;
doc["status2"] = "ready";
}
// Beste Zeiten
doc["best1"] = timerData.bestTime1 / 1000.0;
doc["best2"] = timerData.bestTime2 / 1000.0;
// Lernmodus
doc["learningMode"] = learningMode;
if (learningMode) {
String buttons[] = {"Start Bahn 1", "Stop Bahn 1", "Start Bahn 2",
"Stop Bahn 2"};
doc["learningButton"] = buttons[learningStep];
}
String result;
serializeJson(doc, result);
return result;
}
void setup() {
Serial.begin(115200);
@@ -180,6 +131,7 @@ void setup() {
loadWifiSettings();
loadLocationSettings();
setupWifi(); // WiFi initialisieren
setupOTA(&server);