Add selectable ESP-NOW send path for accel/tap input.
Expose best_effort/fast/wait/reliable via UART, dashboard, and CLI so loss vs latency can be compared under real multi-pod load. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -553,6 +553,8 @@
|
||||
<strong>Live-Stream</strong>: UART ≈ <code>CACHE_STATUS</code>-Poll (~16 ms); BLE ≈
|
||||
<code>BLE_STREAM_TICK</code>-Push. Pro Slave <strong>Accel</strong> aktiviert den ESP-NOW-Stream;
|
||||
Tap-Notify (S/D/T) steuert die Tap-Arten auf dem Slave.
|
||||
<strong>Input-Send</strong> wählt den ESP-NOW-TX-Pfad für Accel/Tap auf den Slaves
|
||||
(<code>best_effort</code> Default; <code>wait</code>/<code>reliable</code> blockieren länger).
|
||||
</p>
|
||||
<div class="px-3 pb-2 d-flex flex-wrap gap-2 align-items-center">
|
||||
<button type="button"
|
||||
@@ -564,6 +566,28 @@
|
||||
<span class="text-muted small font-monospace" x-show="isBLEHost() && state.live_stream"
|
||||
x-text="bleTickLabel()"
|
||||
title="Median Δt zwischen BLE_STREAM_TICK (esp_timestamp_us)"></span>
|
||||
<label class="text-muted small mb-0" for="input-send-mode">Input-Send:</label>
|
||||
<select id="input-send-mode" class="form-select form-select-sm"
|
||||
style="width: auto; min-width: 9rem;"
|
||||
x-model.number="inputSendMode"
|
||||
:disabled="busy || !hostUp() || !(state.clients || []).length">
|
||||
<option :value="0">best_effort</option>
|
||||
<option :value="1">fast</option>
|
||||
<option :value="2">wait</option>
|
||||
<option :value="3">reliable</option>
|
||||
</select>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="setInputSendMode(inputSendMode)"
|
||||
:disabled="busy || !hostUp() || !(state.clients || []).length"
|
||||
title="Modus an alle registrierten Slaves pushen">
|
||||
Setzen
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="readInputSendMode()"
|
||||
:disabled="busy || !hostUp()"
|
||||
title="Zuletzt gesetzten Modus vom Master lesen">
|
||||
Lesen
|
||||
</button>
|
||||
<span class="text-muted small">Tap alle Slaves:</span>
|
||||
<label class="tap-toggle"><input type="checkbox" x-model="allTapSingle" :disabled="busy"> S</label>
|
||||
<label class="tap-toggle"><input type="checkbox" x-model="allTapDouble" :disabled="busy"> D</label>
|
||||
@@ -913,6 +937,7 @@
|
||||
masterDz: 100,
|
||||
masterDzSeeded: false,
|
||||
masterLogLevel: 0,
|
||||
inputSendMode: 0,
|
||||
masterTapCfg: {
|
||||
tap_sens_thres: 5,
|
||||
max_gest_dur: 100,
|
||||
@@ -1796,6 +1821,52 @@
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
formatInputSendMode(mode) {
|
||||
const labels = ['best_effort', 'fast', 'wait', 'reliable'];
|
||||
if (mode == null || mode < 0 || mode > 3) return '—';
|
||||
return labels[mode];
|
||||
},
|
||||
async readInputSendMode() {
|
||||
this.busy = true;
|
||||
try {
|
||||
const r = await fetch('/api/input-send-mode');
|
||||
const data = await r.json();
|
||||
if (!r.ok || !data.success) {
|
||||
this.flash(data.error || 'Input-Send lesen fehlgeschlagen', false);
|
||||
return;
|
||||
}
|
||||
this.inputSendMode = data.mode ?? 0;
|
||||
this.flash(`Input-Send: ${data.mode_name || this.formatInputSendMode(data.mode)}`, true);
|
||||
} catch (e) {
|
||||
this.flash(String(e), false);
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
async setInputSendMode(mode) {
|
||||
this.busy = true;
|
||||
try {
|
||||
const r = await fetch('/api/input-send-mode', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ mode, all_clients: true })
|
||||
});
|
||||
const data = await r.json();
|
||||
if (!r.ok || !data.success) {
|
||||
this.flash(data.error || 'Input-Send setzen fehlgeschlagen', false);
|
||||
return;
|
||||
}
|
||||
this.inputSendMode = data.mode ?? mode;
|
||||
this.flash(
|
||||
`Input-Send ${data.mode_name || this.formatInputSendMode(data.mode)} → ${data.slaves_updated || 0} Slaves`,
|
||||
true
|
||||
);
|
||||
} catch (e) {
|
||||
this.flash(String(e), false);
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
patchClientAccelStream(clientId, enabled) {
|
||||
const clients = (this.state.clients || []).map((c) => {
|
||||
if (c.id !== clientId) return c;
|
||||
|
||||
Reference in New Issue
Block a user