MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / scanSingleHostEnhanced

Function scanSingleHostEnhanced

web/scripts/ragnar_modern.js:4070–4090  ·  view source on GitHub ↗
(ip)

Source from the content-addressed store, hash-verified

4068
4069function _wifiSyncEnvPreset() {
4070 // Reflect a manually-typed n back into the preset dropdown (custom if no match).
4071 // Compare numerically so 5, 5.0 and "5.0" all match the same option.
4072 const sel = document.getElementById('wifi-env-preset'); if (!sel) return;
4073 const n = parseFloat(document.getElementById('wifi-ple').value);
4074 const match = [...sel.options].find(o => o.value !== 'custom' && parseFloat(o.value) === n);
4075 sel.value = match ? match.value : 'custom';
4076}
4077
4078function wifiCalibrate() {
4079 const g = id => document.getElementById(id).value;
4080 const st = document.getElementById('wifi-cal-status');
4081 const qs = `d1=${g('wifi-cal-d1')}&rssi1=${g('wifi-cal-r1')}&d2=${g('wifi-cal-d2')}&rssi2=${g('wifi-cal-r2')}`;
4082 fetch(`/api/net/wifi/calibrate?${qs}`).then(r => r.json()).then(d => {
4083 if (d.error) { st.textContent = '⚠ ' + d.error; return; }
4084 _wifiState.calRssi0 = d.rssi_at_1m;
4085 document.getElementById('wifi-ple').value = d.path_loss_exponent;
4086 _wifiSyncEnvPreset();
4087 st.innerHTML = `n=<b>${d.path_loss_exponent}</b>, ref <b>${d.rssi_at_1m}</b> dBm@1m — applied`;
4088 if (_wifiState.selected) wifiSelectAp(_wifiState.selected);
4089 }).catch(() => { st.textContent = 'calibration failed'; });
4090}
4091
4092function wifiCalibrateReset() {
4093 _wifiState.calRssi0 = null;

Callers

nothing calls this directly

Calls 4

errorMethod · 0.80
addConsoleMessageFunction · 0.70
postAPIFunction · 0.70

Tested by

no test coverage detected