From 012947fd9913f240d6652306bfd82b951d4b1d3e Mon Sep 17 00:00:00 2001 From: grigo Date: Mon, 15 Jun 2026 11:41:39 +0300 Subject: [PATCH] added rx Quality --- server/static/index.html | 51 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/server/static/index.html b/server/static/index.html index 42ddda8..62dcb22 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -220,6 +220,7 @@
+
@@ -349,6 +350,9 @@ let mapInitialFitDone = false; let userMovedMap = false; let programmaticMove = false; + let cmdFormDirty = false; + + const CMD_INPUT_IDS = ['cmdFq', 'cmdPw', 'cmdSf', 'cmdPl', 'cmdBw', 'cmdCr', 'cmdTm', 'cmdRole']; let trackTxLayer = null; let trackRxLayer = null; @@ -531,15 +535,40 @@ ); } - function fillCmdFormFromDevice(d) { + function setCmdFormDirty(dirty) { + cmdFormDirty = dirty; + const hint = document.getElementById('cmdDraftHint'); + if (hint) hint.style.display = dirty ? 'block' : 'none'; + } + + function setupCmdFormDirtyTracking() { + const panel = document.getElementById('controlPanel'); + if (!panel) return; + const markDirty = () => setCmdFormDirty(true); + CMD_INPUT_IDS.forEach(id => { + const el = document.getElementById(id); + if (!el) return; + el.addEventListener('input', markDirty); + el.addEventListener('change', markDirty); + }); + } + + function refreshCmdDeviceStatus(d) { if (!d) return; const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi); - document.getElementById('cmdCurrentValues').innerHTML = + setPanelHtml( + document.getElementById('cmdCurrentValues'), RadioUI.formatRadioPanel( snap, new Set(), isRadioStaticOpen(document.getElementById('cmdCurrentValues')) - ); + ) + ); + } + + function fillCmdInputsFromDevice(d) { + if (!d) return; + const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi); if (snap.frequencyMhz != null) { document.getElementById('cmdFq').value = snap.frequencyMhz.toFixed(3); } @@ -549,6 +578,14 @@ if (snap.role) document.getElementById('cmdRole').value = snap.role; } + function fillCmdFormFromDevice(d, opts = {}) { + if (!d) return; + const force = opts.force === true; + refreshCmdDeviceStatus(d); + if (!force && cmdFormDirty) return; + fillCmdInputsFromDevice(d); + } + function buildMacroLines() { const lines = ['S']; const fq = document.getElementById('cmdFq').value.trim(); @@ -2065,6 +2102,7 @@ document.getElementById('btnCmdApply').onclick = () => { const lines = buildMacroLines(); postCommand(document.getElementById('cmdTargetSelect').value, 'at', { lines }); + setCmdFormDirty(false); }; document.getElementById('btnMapTx').onclick = () => centerMapOnRole('TX'); document.getElementById('btnMapRx').onclick = () => centerMapOnRole('RX'); @@ -2281,12 +2319,14 @@ document.getElementById('cmdTargetSelect').onchange = () => { const id = document.getElementById('cmdTargetSelect').value; const d = lastDevices.find(x => x.device_id === id); - if (d) fillCmdFormFromDevice(d); + setCmdFormDirty(false); + if (d) fillCmdFormFromDevice(d, { force: true }); }; function selectDevice(d) { selectedId = d.device_id; - fillCmdFormFromDevice(d); + setCmdFormDirty(false); + fillCmdFormFromDevice(d, { force: true }); document.querySelectorAll('#deviceList li').forEach(li => { li.classList.toggle('active', li.textContent.startsWith(d.device_id)); }); @@ -2452,6 +2492,7 @@ }); schedulePoll(); + setupCmdFormDirtyTracking(); loadAllTracks(); refreshPairedStatus();