added rx Quality

This commit is contained in:
2026-06-15 11:41:39 +03:00
parent 23eb7ffb91
commit 012947fd99
+45 -4
View File
@@ -220,6 +220,7 @@
<label class="muted">Целевое устройство</label>
<select id="cmdTargetSelect"><option value=""></option></select>
<div id="cmdCurrentValues" class="muted" style="margin-top:4px;font-size:0.75rem"></div>
<div id="cmdDraftHint" class="muted" style="display:none;margin-top:4px;font-size:0.7rem;color:#ffc107">Черновик — значения с устройства не подставляются</div>
<div class="cmd-row" style="margin-top:6px">
<label class="muted" style="flex:1">FQ MHz<input type="number" id="cmdFq" step="0.001" placeholder="433" /></label>
<label class="muted" style="flex:1">PW dBm<input type="number" id="cmdPw" min="-9" max="22" placeholder="22" /></label>
@@ -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();
</script>