Skip to content

Commit 3a4d7b9

Browse files
committed
Enhance debug logging for radio stats retrieval during ping and connection
1 parent f556e88 commit 3a4d7b9

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

content/wardrive.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3967,14 +3967,16 @@ async function sendPing(manual = false) {
39673967
debugLog("[PING] Refreshing radio stats before ping");
39683968
try {
39693969
const stats = await state.connection.getRadioStats(10000);
3970+
debugLog(`[PING] getRadioStats returned: ${JSON.stringify(stats)}`);
39703971
if (stats && typeof stats.noiseFloor !== 'undefined') {
39713972
state.lastNoiseFloor = stats.noiseFloor;
3973+
debugLog(`[PING] Radio stats refreshed before ping: noiseFloor=${state.lastNoiseFloor}`);
39723974
} else {
3975+
debugWarn(`[PING] Radio stats response missing noiseFloor field: ${JSON.stringify(stats)}`);
39733976
state.lastNoiseFloor = null;
39743977
}
3975-
debugLog(`[PING] Radio stats refreshed before ping: noiseFloor=${state.lastNoiseFloor}`);
39763978
} catch (e) {
3977-
debugError(`[BLE] getRadioStats failed before ping: ${e && e.message ? e.message : e}`);
3979+
debugError(`[BLE] getRadioStats failed before ping: ${e && e.message ? e.message : String(e)}`);
39783980
state.lastNoiseFloor = 'ERR';
39793981
}
39803982
debugLog("[UI] Updating device info display after pre-ping stats refresh");
@@ -4432,15 +4434,17 @@ async function connect() {
44324434
// Immediately attempt to read radio stats (noise floor) on connect
44334435
debugLog("[BLE] Requesting radio stats on connect");
44344436
try {
4435-
const stats = await conn.getRadioStats(10000).catch(e => { throw e; });
4437+
const stats = await conn.getRadioStats(10000);
4438+
debugLog(`[BLE] getRadioStats returned: ${JSON.stringify(stats)}`);
44364439
if (stats && typeof stats.noiseFloor !== 'undefined') {
44374440
state.lastNoiseFloor = stats.noiseFloor;
4441+
debugLog(`[BLE] Radio stats acquired on connect: noiseFloor=${state.lastNoiseFloor}`);
44384442
} else {
4443+
debugWarn(`[BLE] Radio stats response missing noiseFloor field: ${JSON.stringify(stats)}`);
44394444
state.lastNoiseFloor = null;
44404445
}
4441-
debugLog(`[BLE] Radio stats acquired on connect: noiseFloor=${state.lastNoiseFloor}`);
44424446
} catch (e) {
4443-
debugError(`[BLE] getRadioStats failed on connect: ${e && e.message ? e.message : e}`);
4447+
debugError(`[BLE] getRadioStats failed on connect: ${e && e.message ? e.message : String(e)}`);
44444448
state.lastNoiseFloor = 'ERR';
44454449
}
44464450
// Update connection bar display (deviceNameEl already set)

0 commit comments

Comments
 (0)