Speed Max einstellbar
This commit is contained in:
@@ -101,6 +101,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin_section">
|
||||
<div class="admin_section_header">
|
||||
<p class="eyebrow">Geschwindigkeit</p>
|
||||
</div>
|
||||
<div class="admin_quick_link_card">
|
||||
<div>
|
||||
<strong>Maximale Geschwindigkeit</strong>
|
||||
<p>Begrenzt die Höchstgeschwindigkeit des Rovers für Controller und Web-GUI.</p>
|
||||
</div>
|
||||
<div class="delay_control">
|
||||
<select id="speed_limit_select" class="delay_select" onchange="setSpeedLimit(parseInt(this.value))">
|
||||
<option value="10">10 %</option>
|
||||
<option value="20">20 %</option>
|
||||
<option value="30">30 %</option>
|
||||
<option value="40">40 %</option>
|
||||
<option value="50">50 %</option>
|
||||
<option value="60">60 %</option>
|
||||
<option value="70">70 %</option>
|
||||
<option value="80">80 %</option>
|
||||
<option value="90">90 %</option>
|
||||
<option value="100" selected>100 % – keine Begrenzung</option>
|
||||
</select>
|
||||
<span id="speed_limit_status" class="delay_status_text"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin_section">
|
||||
<div class="admin_section_header">
|
||||
<p class="eyebrow">Systemstatus</p>
|
||||
@@ -304,6 +331,33 @@
|
||||
if (sel) sel.value = String(seconds);
|
||||
}
|
||||
|
||||
async function fetchSpeedLimit() {
|
||||
try {
|
||||
var response = await fetch(adminApiBase + '/api/speed-limit');
|
||||
if (!response.ok) return;
|
||||
var data = await response.json();
|
||||
var sel = document.getElementById('speed_limit_select');
|
||||
if (sel) sel.value = String(data.speed_limit_percent);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function setSpeedLimit(percent) {
|
||||
var statusEl = document.getElementById('speed_limit_status');
|
||||
if (statusEl) statusEl.textContent = 'Setze…';
|
||||
try {
|
||||
var response = await fetch(adminApiBase + '/api/speed-limit', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({speed_limit_percent: percent})
|
||||
});
|
||||
var data = await response.json();
|
||||
if (statusEl) statusEl.textContent = data.status || 'Gesetzt';
|
||||
window.setTimeout(function() { if (statusEl) statusEl.textContent = ''; }, 2000);
|
||||
} catch (e) {
|
||||
if (statusEl) statusEl.textContent = 'Fehler';
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchDelay() {
|
||||
try {
|
||||
var response = await fetch(adminApiBase + '/api/delay');
|
||||
@@ -351,8 +405,10 @@
|
||||
|
||||
fetchStatus();
|
||||
fetchDelay();
|
||||
fetchSpeedLimit();
|
||||
window.setInterval(fetchStatus, 10000);
|
||||
window.setInterval(fetchDelay, 5000);
|
||||
window.setInterval(fetchSpeedLimit, 5000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user