move hardbeat handling into backend, add publish lanestate for lighttower
This commit is contained in:
@@ -31,6 +31,7 @@ void handleStart1(uint64_t timestamp = 0) {
|
||||
timerData.localStartTime1 = millis(); // Set local start time
|
||||
timerData.isRunning1 = true;
|
||||
timerData.endTime1 = 0;
|
||||
publishLaneStatus(1, "running");
|
||||
Serial.println("Bahn 1 gestartet");
|
||||
}
|
||||
}
|
||||
@@ -46,6 +47,7 @@ void handleStop1(uint64_t timestamp = 0) {
|
||||
timerData.bestTime1 = currentTime;
|
||||
saveBestTimes();
|
||||
}
|
||||
publishLaneStatus(1, "stopped");
|
||||
Serial.println("Bahn 1 gestoppt - Zeit: " + String(currentTime / 1000.0) +
|
||||
"s");
|
||||
}
|
||||
@@ -58,6 +60,7 @@ void handleStart2(uint64_t timestamp = 0) {
|
||||
timerData.localStartTime2 = millis(); // Set local start time
|
||||
timerData.isRunning2 = true;
|
||||
timerData.endTime2 = 0;
|
||||
publishLaneStatus(2, "running");
|
||||
Serial.println("Bahn 2 gestartet");
|
||||
}
|
||||
}
|
||||
@@ -73,6 +76,7 @@ void handleStop2(uint64_t timestamp = 0) {
|
||||
timerData.bestTime2 = currentTime;
|
||||
saveBestTimes();
|
||||
}
|
||||
publishLaneStatus(2, "stopped");
|
||||
Serial.println("Bahn 2 gestoppt - Zeit: " + String(currentTime / 1000.0) +
|
||||
"s");
|
||||
}
|
||||
@@ -85,6 +89,7 @@ void checkAutoReset() {
|
||||
(currentTime - timerData.localStartTime1 > maxTimeBeforeReset)) {
|
||||
timerData.isRunning1 = false;
|
||||
timerData.startTime1 = 0;
|
||||
publishLaneStatus(1, "ready");
|
||||
Serial.println("Bahn 1 automatisch zurückgesetzt");
|
||||
}
|
||||
|
||||
@@ -92,6 +97,7 @@ void checkAutoReset() {
|
||||
(currentTime - timerData.localStartTime2 > maxTimeBeforeReset)) {
|
||||
timerData.isRunning2 = false;
|
||||
timerData.startTime2 = 0;
|
||||
publishLaneStatus(2, "ready");
|
||||
Serial.println("Bahn 2 automatisch zurückgesetzt");
|
||||
}
|
||||
|
||||
@@ -114,6 +120,7 @@ void checkAutoReset() {
|
||||
|
||||
// Push the message to the frontend
|
||||
pushUpdateToFrontend(message);
|
||||
publishLaneStatus(1, "ready");
|
||||
|
||||
Serial.println("Bahn 1 automatisch auf 'Bereit' zurückgesetzt");
|
||||
}
|
||||
@@ -137,6 +144,7 @@ void checkAutoReset() {
|
||||
|
||||
// Push the message to the frontend
|
||||
pushUpdateToFrontend(message);
|
||||
publishLaneStatus(2, "ready");
|
||||
|
||||
Serial.println("Bahn 2 automatisch auf 'Bereit' zurückgesetzt");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user