Skip to content

Commit ae92ced

Browse files
authored
Merge pull request #163 from MrAlders0n/copilot/fix-auto-mode-button-issues
Fix auto mode button states and RX logging subscription behavior
2 parents 88d2297 + 988342a commit ae92ced

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

content/wardrive.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,16 @@ async function handlePassiveRxLogging(packet, data) {
23582358
try {
23592359
debugLog(`[PASSIVE RX] Processing packet for passive logging`);
23602360

2361+
// Check if any auto mode is subscribed to RX events
2362+
// Only log observations when TX/RX Auto OR RX Auto is active
2363+
// Manual TX pings (mode='txPing') should NOT enable passive RX logging
2364+
if (!rxSubscription.mode || rxSubscription.mode === 'txPing') {
2365+
debugLog(`[PASSIVE RX] No RX subscription active or manual ping mode - skipping observation (auto modes OFF)`);
2366+
return;
2367+
}
2368+
2369+
debugLog(`[PASSIVE RX] RX subscription active (mode=${rxSubscription.mode}) - processing observation`);
2370+
23612371
// VALIDATION: Check path length (need at least one hop)
23622372
// A packet's path array contains the sequence of repeater IDs that forwarded the message.
23632373
// Packets with no path are direct transmissions (node-to-node) and don't provide
@@ -3981,6 +3991,7 @@ function stopTxRxAuto(stopGps = false) {
39813991

39823992
state.txRxAutoRunning = false;
39833993
updateAutoButton();
3994+
updateControlsForCooldown(); // Re-enable RX Auto button
39843995
releaseWakeLock();
39853996
enableIntervalAndPowerControls();
39863997
debugLog("[TX/RX AUTO] Auto ping stopped");
@@ -4041,6 +4052,7 @@ function startTxRxAuto() {
40414052

40424053
state.txRxAutoRunning = true;
40434054
updateAutoButton();
4055+
updateControlsForCooldown(); // Disable RX Auto button while TX/RX Auto is running
40444056
disableIntervalAndPowerControls();
40454057

40464058
// Subscribe to RX events for TX/RX Auto mode
@@ -4082,6 +4094,7 @@ function stopRxAuto(stopGps = false) {
40824094

40834095
state.rxAutoRunning = false;
40844096
updateAutoButton();
4097+
updateControlsForCooldown(); // Re-enable TX/RX Auto button
40854098
releaseWakeLock();
40864099
enableIntervalAndPowerControls();
40874100
debugLog("[RX AUTO] RX Auto stopped");
@@ -4109,6 +4122,7 @@ function startRxAuto() {
41094122

41104123
state.rxAutoRunning = true;
41114124
updateAutoButton();
4125+
updateControlsForCooldown(); // Disable TX/RX Auto button while RX Auto is running
41124126
disableIntervalAndPowerControls();
41134127

41144128
// Acquire wake lock for RX Auto mode

0 commit comments

Comments
 (0)