Add ignition-based screen sleep simulation

This commit is contained in:
root
2026-06-03 00:18:56 -06:00
parent 06ef856210
commit fbac6063b9
2 changed files with 58 additions and 0 deletions
+24
View File
@@ -268,3 +268,27 @@ nav button {
font-size: 1rem;
color: #ccc;
}
.sleep-overlay {
position: fixed;
inset: 0;
background: #000;
color: #777;
z-index: 10000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 2rem;
}
.sleep-overlay.hidden {
display: none;
}
.sleep-overlay small {
margin-top: 10px;
font-size: 1rem;
color: #555;
}
+34
View File
@@ -14,6 +14,11 @@
</div>
</div>
<div id="sleepOverlay" class="sleep-overlay hidden" onclick="wakeScreen()">
<div>Screen Off</div>
<small>Tap to wake</small>
</div>
<div id="warningBanner" class="warning-banner hidden"></div>
<main>
@@ -129,6 +134,7 @@
let relayState = {};
let activeAlarmKey = null;
let acknowledgedAlarms = new Set();
let screenWakeTimeout = null;
let alarmConfig = {
rear_seat_warning: 85,
@@ -289,6 +295,7 @@ async function loadStatus() {
document.getElementById('sysWifi').textContent = data.network.wifi_enabled ? 'Enabled' : 'Disabled';
document.getElementById('sysWifiOverride').textContent = data.network.wifi_override_active ? 'Active' : 'Inactive';
document.getElementById('sysIgnition').textContent = data.vehicle.ignition_on ? 'ON' : 'OFF';
updateSleepOverlay(data.vehicle.ignition_on);
checkAlarms(data);
}
@@ -303,6 +310,33 @@ async function toggleRelay(name) {
loadStatus();
}
function updateSleepOverlay(ignitionOn) {
const overlay = document.getElementById('sleepOverlay');
if (ignitionOn) {
overlay.classList.add('hidden');
return;
}
if (!screenWakeTimeout) {
overlay.classList.remove('hidden');
}
}
function wakeScreen() {
const overlay = document.getElementById('sleepOverlay');
overlay.classList.add('hidden');
if (screenWakeTimeout) {
clearTimeout(screenWakeTimeout);
}
screenWakeTimeout = setTimeout(() => {
screenWakeTimeout = null;
overlay.classList.remove('hidden');
}, 10000);
}
async function toggleIgnition() {
await fetch('/vehicle/ignition', {
method: 'POST',