generated from Grigo/AndroidTemplate
added rx Quality
This commit is contained in:
@@ -220,6 +220,7 @@
|
|||||||
<label class="muted">Целевое устройство</label>
|
<label class="muted">Целевое устройство</label>
|
||||||
<select id="cmdTargetSelect"><option value="">—</option></select>
|
<select id="cmdTargetSelect"><option value="">—</option></select>
|
||||||
<div id="cmdCurrentValues" class="muted" style="margin-top:4px;font-size:0.75rem">—</div>
|
<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">
|
<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">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>
|
<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 mapInitialFitDone = false;
|
||||||
let userMovedMap = false;
|
let userMovedMap = false;
|
||||||
let programmaticMove = false;
|
let programmaticMove = false;
|
||||||
|
let cmdFormDirty = false;
|
||||||
|
|
||||||
|
const CMD_INPUT_IDS = ['cmdFq', 'cmdPw', 'cmdSf', 'cmdPl', 'cmdBw', 'cmdCr', 'cmdTm', 'cmdRole'];
|
||||||
|
|
||||||
let trackTxLayer = null;
|
let trackTxLayer = null;
|
||||||
let trackRxLayer = 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;
|
if (!d) return;
|
||||||
const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi);
|
const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi);
|
||||||
document.getElementById('cmdCurrentValues').innerHTML =
|
setPanelHtml(
|
||||||
|
document.getElementById('cmdCurrentValues'),
|
||||||
RadioUI.formatRadioPanel(
|
RadioUI.formatRadioPanel(
|
||||||
snap,
|
snap,
|
||||||
new Set(),
|
new Set(),
|
||||||
isRadioStaticOpen(document.getElementById('cmdCurrentValues'))
|
isRadioStaticOpen(document.getElementById('cmdCurrentValues'))
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillCmdInputsFromDevice(d) {
|
||||||
|
if (!d) return;
|
||||||
|
const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi);
|
||||||
if (snap.frequencyMhz != null) {
|
if (snap.frequencyMhz != null) {
|
||||||
document.getElementById('cmdFq').value = snap.frequencyMhz.toFixed(3);
|
document.getElementById('cmdFq').value = snap.frequencyMhz.toFixed(3);
|
||||||
}
|
}
|
||||||
@@ -549,6 +578,14 @@
|
|||||||
if (snap.role) document.getElementById('cmdRole').value = snap.role;
|
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() {
|
function buildMacroLines() {
|
||||||
const lines = ['S'];
|
const lines = ['S'];
|
||||||
const fq = document.getElementById('cmdFq').value.trim();
|
const fq = document.getElementById('cmdFq').value.trim();
|
||||||
@@ -2065,6 +2102,7 @@
|
|||||||
document.getElementById('btnCmdApply').onclick = () => {
|
document.getElementById('btnCmdApply').onclick = () => {
|
||||||
const lines = buildMacroLines();
|
const lines = buildMacroLines();
|
||||||
postCommand(document.getElementById('cmdTargetSelect').value, 'at', { lines });
|
postCommand(document.getElementById('cmdTargetSelect').value, 'at', { lines });
|
||||||
|
setCmdFormDirty(false);
|
||||||
};
|
};
|
||||||
document.getElementById('btnMapTx').onclick = () => centerMapOnRole('TX');
|
document.getElementById('btnMapTx').onclick = () => centerMapOnRole('TX');
|
||||||
document.getElementById('btnMapRx').onclick = () => centerMapOnRole('RX');
|
document.getElementById('btnMapRx').onclick = () => centerMapOnRole('RX');
|
||||||
@@ -2281,12 +2319,14 @@
|
|||||||
document.getElementById('cmdTargetSelect').onchange = () => {
|
document.getElementById('cmdTargetSelect').onchange = () => {
|
||||||
const id = document.getElementById('cmdTargetSelect').value;
|
const id = document.getElementById('cmdTargetSelect').value;
|
||||||
const d = lastDevices.find(x => x.device_id === id);
|
const d = lastDevices.find(x => x.device_id === id);
|
||||||
if (d) fillCmdFormFromDevice(d);
|
setCmdFormDirty(false);
|
||||||
|
if (d) fillCmdFormFromDevice(d, { force: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
function selectDevice(d) {
|
function selectDevice(d) {
|
||||||
selectedId = d.device_id;
|
selectedId = d.device_id;
|
||||||
fillCmdFormFromDevice(d);
|
setCmdFormDirty(false);
|
||||||
|
fillCmdFormFromDevice(d, { force: true });
|
||||||
document.querySelectorAll('#deviceList li').forEach(li => {
|
document.querySelectorAll('#deviceList li').forEach(li => {
|
||||||
li.classList.toggle('active', li.textContent.startsWith(d.device_id));
|
li.classList.toggle('active', li.textContent.startsWith(d.device_id));
|
||||||
});
|
});
|
||||||
@@ -2452,6 +2492,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
schedulePoll();
|
schedulePoll();
|
||||||
|
setupCmdFormDirtyTracking();
|
||||||
loadAllTracks();
|
loadAllTracks();
|
||||||
refreshPairedStatus();
|
refreshPairedStatus();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user