add vehichle force on next cycle

This commit is contained in:
gitGnome
2026-04-01 13:29:47 +02:00
parent 7495a44596
commit 541f2ff09c
2 changed files with 27 additions and 3 deletions
+20
View File
@@ -13,6 +13,7 @@ state = {
'program_top_text_enabled': True,
'program_bottom_text_enabled': True,
'program_vehicles_enabled': True,
'force_vehicles': False,
}
_lock = threading.Lock()
@@ -46,6 +47,11 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
.brightness-row { display: flex; align-items: center; gap: 12px; }
.brightness-row input[type=range] { flex: 1; accent-color: #4CAF50; }
.brightness-row span { min-width: 32px; text-align: right; }
.btn { display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
font-size: 1em; cursor: pointer; margin-bottom: 12px; transition: 0.2s; }
.btn-vehicles { background: #2a4a7f; color: #eee; }
.btn-vehicles:hover { background: #3a5a9f; }
.btn-vehicles:active { background: #1a3a6f; }
</style>
</head>
<body>
@@ -74,6 +80,7 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
<span id="brightnessValue">100</span>
</div>
</div>
<button class="btn btn-vehicles" onclick="forceVehicles()">Force Vehicles Next Cycle</button>
</div>
</div>
<script>
@@ -110,6 +117,12 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
}
setInterval(pollDisplay, 100);
function forceVehicles() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/force-vehicles", true);
xhr.send();
}
function toggle(program, enabled) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/toggle-program", true);
@@ -191,6 +204,13 @@ def handle_toggle():
return 'OK'
@app.route('/force-vehicles', methods=['POST'])
def handle_force_vehicles():
with _lock:
state['force_vehicles'] = True
return 'OK'
@app.route('/program-status', methods=['GET'])
def handle_status():
with _lock: