diff --git a/content/wardrive.js b/content/wardrive.js index 65f5a84..abcfc7c 100644 --- a/content/wardrive.js +++ b/content/wardrive.js @@ -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; @@ -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; } @@ -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(); @@ -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(); diff --git a/docs/STATUS_MESSAGES.md b/docs/STATUS_MESSAGES.md index d44ecc9..5098d10 100644 --- a/docs/STATUS_MESSAGES.md +++ b/docs/STATUS_MESSAGES.md @@ -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