Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions content/wardrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,28 @@ function resumeAutoCountdown() {
return false;
}

/**
* Handle manual ping blocked during auto mode by resuming the paused countdown
* This ensures the UI returns to showing the auto countdown instead of staying stuck on the skip message
*
* When a manual ping is blocked during auto mode (GPS unavailable, outside geofence, or too close), this function:
* 1. Attempts to resume the paused auto countdown timer with remaining time
* 2. If no paused countdown exists, schedules a new auto ping
* 3. Does nothing if auto mode is not running
*
* @returns {void}
*/
function handleManualPingBlockedDuringAutoMode() {
if (state.running) {
debugLog("Manual ping blocked during auto mode - resuming auto countdown");
const resumed = resumeAutoCountdown();
if (!resumed) {
debugLog("No paused countdown to resume, scheduling new auto ping");
scheduleNextAutoPing();
}
}
}

function startRxListeningCountdown(delayMs) {
debugLog(`Starting RX listening countdown: ${delayMs}ms`);
state.rxListeningEndTime = Date.now() + delayMs;
Expand Down Expand Up @@ -1874,6 +1896,10 @@ async function sendPing(manual = false) {
if (!manual && state.running) {
scheduleNextAutoPing();
}
// For manual ping during auto mode, resume the paused countdown
if (manual) {
handleManualPingBlockedDuringAutoMode();
}
return;
}

Expand All @@ -1890,6 +1916,8 @@ async function sendPing(manual = false) {
if (manual) {
// Manual ping: show skip message that persists
setDynamicStatus("Ping skipped, outside of geofenced region", STATUS_COLORS.warning);
// If auto mode is running, resume the paused countdown
handleManualPingBlockedDuringAutoMode();
} else if (state.running) {
// Auto ping: schedule next ping and show countdown with skip message
scheduleNextAutoPing();
Expand All @@ -1910,6 +1938,8 @@ async function sendPing(manual = false) {
if (manual) {
// Manual ping: show skip message that persists
setDynamicStatus("Ping skipped, too close to last ping", STATUS_COLORS.warning);
// If auto mode is running, resume the paused countdown
handleManualPingBlockedDuringAutoMode();
} else if (state.running) {
// Auto ping: schedule next ping and show countdown with skip message
scheduleNextAutoPing();
Expand Down
6 changes: 6 additions & 0 deletions docs/STATUS_MESSAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,18 @@ These messages appear in the Dynamic App Status Bar. They NEVER include connecti
- **Message**: `"Ping skipped, outside of geofenced region"`
- **Color**: Amber (warning)
- **When**: GPS coordinates outside Ottawa 150km radius
- **Behavior**:
- In manual mode (auto OFF): Message persists until next action
- In manual mode (auto ON): Message shown briefly, then auto countdown resumes
- **Source**: `content/wardrive.js:sendPing()`

##### Ping skipped, too close to last ping
- **Message**: `"Ping skipped, too close to last ping"`
- **Color**: Amber (warning)
- **When**: Current location < 25m from last successful ping
- **Behavior**:
- In manual mode (auto OFF): Message persists until next action
- In manual mode (auto ON): Message shown briefly, then auto countdown resumes
- **Source**: `content/wardrive.js:sendPing()`

##### Wait Xs before sending another ping
Expand Down