Standby
This commit is contained in:
@@ -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 {
|
.best-times {
|
||||||
background: rgba(255, 255, 255, 0.15);
|
background: rgba(255, 255, 255, 0.15);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
|
|||||||
@@ -57,14 +57,14 @@
|
|||||||
<div id="name1" class="swimmer-name" style="display: none"></div>
|
<div id="name1" class="swimmer-name" style="display: none"></div>
|
||||||
<h2>🏊♀️ Bahn 1</h2>
|
<h2>🏊♀️ Bahn 1</h2>
|
||||||
<div id="time1" class="time-display">00.00</div>
|
<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>
|
||||||
|
|
||||||
<div class="lane">
|
<div class="lane">
|
||||||
<div id="name2" class="swimmer-name" style="display: none"></div>
|
<div id="name2" class="swimmer-name" style="display: none"></div>
|
||||||
<h2>🏊♂️ Bahn 2</h2>
|
<h2>🏊♂️ Bahn 2</h2>
|
||||||
<div id="time2" class="time-display">00.00</div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -113,6 +113,23 @@
|
|||||||
document.getElementById(id).classList.remove("active");
|
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
|
// Handle WebSocket events
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.log("WebSocket connected");
|
console.log("WebSocket connected");
|
||||||
@@ -315,7 +332,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("time1").textContent = formatTime(display1);
|
document.getElementById("time1").textContent = formatTime(display1);
|
||||||
|
|
||||||
|
// Status für Bahn 1
|
||||||
const s1 = document.getElementById("status1");
|
const s1 = document.getElementById("status1");
|
||||||
|
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.className = `status ${status1}`;
|
||||||
s1.textContent =
|
s1.textContent =
|
||||||
status1 === "ready"
|
status1 === "ready"
|
||||||
@@ -323,9 +348,18 @@
|
|||||||
: status1 === "running"
|
: status1 === "running"
|
||||||
? "Läuft..."
|
? "Läuft..."
|
||||||
: "Beendet";
|
: "Beendet";
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("time2").textContent = formatTime(display2);
|
document.getElementById("time2").textContent = formatTime(display2);
|
||||||
|
|
||||||
|
// Status für Bahn 2
|
||||||
const s2 = document.getElementById("status2");
|
const s2 = document.getElementById("status2");
|
||||||
|
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.className = `status ${status2}`;
|
||||||
s2.textContent =
|
s2.textContent =
|
||||||
status2 === "ready"
|
status2 === "ready"
|
||||||
@@ -333,6 +367,7 @@
|
|||||||
: status2 === "running"
|
: status2 === "running"
|
||||||
? "Läuft..."
|
? "Läuft..."
|
||||||
: "Beendet";
|
: "Beendet";
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("best1").textContent =
|
document.getElementById("best1").textContent =
|
||||||
best1 > 0 ? formatTime(best1) + "s" : "--.-";
|
best1 > 0 ? formatTime(best1) + "s" : "--.-";
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ board_upload.flash_size = 16MB
|
|||||||
board_build.partitions = default_16MB.csv
|
board_build.partitions = default_16MB.csv
|
||||||
targets = uploadfs
|
targets = uploadfs
|
||||||
board_build.psram = disabled
|
board_build.psram = disabled
|
||||||
upload_port = COM12
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
bblanchon/ArduinoJson@^7.4.1
|
bblanchon/ArduinoJson@^7.4.1
|
||||||
esp32async/ESPAsyncWebServer@^3.7.7
|
esp32async/ESPAsyncWebServer@^3.7.7
|
||||||
|
|||||||
Reference in New Issue
Block a user