diff --git a/data/index.css b/data/index.css index 9c33321..ec193af 100644 --- a/data/index.css +++ b/data/index.css @@ -382,6 +382,33 @@ body { } } +.status.standby { + background-color: rgba(255, 193, 7, 0.3); + border: 2px solid #ffc107; + animation: standbyBlink 2s infinite; +} + +@keyframes pulse { + 0% { + opacity: 1; + } + 50% { + opacity: 0.7; + } + 100% { + opacity: 1; + } +} + +@keyframes standbyBlink { + 0%, 70% { + opacity: 1; + } + 85%, 100% { + opacity: 0.6; + } +} + .best-times { background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); diff --git a/data/index.html b/data/index.html index 70b3310..18659f9 100644 --- a/data/index.html +++ b/data/index.html @@ -57,14 +57,14 @@

🏊‍♀️ Bahn 1

00.00
-
Bereit
+
Standby: Bitte beide 1x betätigen

🏊‍♂️ Bahn 2

00.00
-
Bereit
+
Standby: Bitte beide 1x betätigen
@@ -113,6 +113,23 @@ document.getElementById(id).classList.remove("active"); }); + // Funktion um zu prßfen ob beide Buttons einer Bahn verbunden sind + function areBothButtonsConnected(laneNumber) { + const now = Date.now(); + if (laneNumber === 1) { + return ( + now - heartbeatTimeouts.start1 <= 10000 && + now - heartbeatTimeouts.stop1 <= 10000 + ); + } else if (laneNumber === 2) { + return ( + now - heartbeatTimeouts.start2 <= 10000 && + now - heartbeatTimeouts.stop2 <= 10000 + ); + } + return false; + } + // Handle WebSocket events ws.onopen = () => { console.log("WebSocket connected"); @@ -315,24 +332,42 @@ } document.getElementById("time1").textContent = formatTime(display1); + + // Status fßr Bahn 1 const s1 = document.getElementById("status1"); - s1.className = `status ${status1}`; - s1.textContent = - status1 === "ready" - ? "Bereit" - : status1 === "running" - ? "Läuft..." - : "Beendet"; + const lane1Connected = areBothButtonsConnected(1); + + if (status1 === "ready" && !lane1Connected) { + s1.className = "status standby"; + s1.textContent = "Standby: Bitte beide 1x betätigen"; + } else { + s1.className = `status ${status1}`; + s1.textContent = + status1 === "ready" + ? "Bereit" + : status1 === "running" + ? "Läuft..." + : "Beendet"; + } document.getElementById("time2").textContent = formatTime(display2); + + // Status fßr Bahn 2 const s2 = document.getElementById("status2"); - s2.className = `status ${status2}`; - s2.textContent = - status2 === "ready" - ? "Bereit" - : status2 === "running" - ? "Läuft..." - : "Beendet"; + const lane2Connected = areBothButtonsConnected(2); + + if (status2 === "ready" && !lane2Connected) { + s2.className = "status standby"; + s2.textContent = "Standby: Bitte beide 1x betätigen"; + } else { + s2.className = `status ${status2}`; + s2.textContent = + status2 === "ready" + ? "Bereit" + : status2 === "running" + ? "Läuft..." + : "Beendet"; + } document.getElementById("best1").textContent = best1 > 0 ? formatTime(best1) + "s" : "--.-"; @@ -413,4 +448,4 @@ syncFromBackend(); - + \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 128deac..514cdc5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -74,7 +74,6 @@ board_upload.flash_size = 16MB board_build.partitions = default_16MB.csv targets = uploadfs board_build.psram = disabled -upload_port = COM12 lib_deps = bblanchon/ArduinoJson@^7.4.1 esp32async/ESPAsyncWebServer@^3.7.7