Merge pull request 'Standby' (#1) from Standby into main

Reviewed-on: #1
This commit is contained in:
2025-07-24 18:04:26 +02:00
3 changed files with 79 additions and 18 deletions

View File

@@ -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);

View File

@@ -57,14 +57,14 @@
<div id="name1" class="swimmer-name" style="display: none"></div>
<h2>🏊‍♀️ Bahn 1</h2>
<div id="time1" class="time-display">00.00</div>
<div id="status1" class="status ready">Bereit</div>
<div id="status1" class="status standby">Standby: Bitte beide 1x betätigen</div>
</div>
<div class="lane">
<div id="name2" class="swimmer-name" style="display: none"></div>
<h2>🏊‍♂️ Bahn 2</h2>
<div id="time2" class="time-display">00.00</div>
<div id="status2" class="status ready">Bereit</div>
<div id="status2" class="status standby">Standby: Bitte beide 1x betätigen</div>
</div>
</div>
@@ -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" : "--.-";

View File

@@ -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