Skip to content

Fix auto countdown not resuming after manual ping blocked during auto mode#110

Merged
MrAlders0n merged 5 commits intodevfrom
copilot/update-status-messages-guideline-again
Dec 21, 2025
Merged

Fix auto countdown not resuming after manual ping blocked during auto mode#110
MrAlders0n merged 5 commits intodevfrom
copilot/update-status-messages-guideline-again

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

When auto mode is active and a manual ping gets blocked (GPS stale, outside geofence, or too close to last ping), the UI gets stuck showing the skip message instead of resuming the auto countdown.

Changes

  • Added helper function handleManualPingBlockedDuringAutoMode() that resumes paused auto countdown when manual ping is blocked
  • Applied fix to three validation failure paths: GPS unavailable, geofence check, distance check
  • Updated STATUS_MESSAGES.md to document the new transient behavior for skip messages during auto mode

Implementation

The fix resumes the paused auto countdown after a manual ping is blocked, allowing the skip reason to be displayed within the countdown message:

/**
 * 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
 */
function handleManualPingBlockedDuringAutoMode() {
  if (state.running) {
    const resumed = resumeAutoCountdown();
    if (!resumed) {
      scheduleNextAutoPing();
    }
  }
}

Applied at all manual ping validation failure points:

if (manual) {
  setDynamicStatus("Ping skipped, too close to last ping", STATUS_COLORS.warning);
  handleManualPingBlockedDuringAutoMode();  // Resumes "Waiting for next auto ping (11s)"
}

Behavior

Before: UI stuck on "Ping skipped, too close to last ping" with no countdown visible

After: UI shows "Ping skipped, too close to last ping, waiting for next ping (11s)" with countdown resuming immediately

The skip reason persists in the countdown message until the next auto ping attempt.

Screenshot

App initial state

Original prompt

MeshCore GOME WarDriver - Development Guidelines

Overview

This document defines the coding standards and requirements for all changes to the MeshCore GOME WarDriver repository. AI agents and contributors must follow these guidelines for every modification.


Code Style & Standards

Debug Logging

  • ALWAYS include debug console logging for significant operations
  • Use the existing debug helper functions:
    • debugLog(message, ...args) - For general debug information
    • debugWarn(message, ... args) - For warning conditions
    • debugError(message, ... args) - For error conditions
  • Debug logging is controlled by the DEBUG_ENABLED flag (URL parameter ? debug=true)
  • Log at key points: function entry, API calls, state changes, errors, and decision branches

Status Messages

  • ALWAYS update STATUS_MESSAGES.md when adding or modifying user-facing status messages
  • Use the setStatus(message, color) function for all UI status updates
  • Use appropriate STATUS_COLORS constants:
    • STATUS_COLORS.idle - Default/waiting state
    • STATUS_COLORS. success - Successful operations
    • STATUS_COLORS.warning - Warning conditions
    • STATUS_COLORS.error - Error states
    • STATUS_COLORS.info - Informational/in-progress states

Documentation Requirements

Code Comments

  • Document complex logic with inline comments
  • Use JSDoc-style comments for functions:
    • @param for parameters
    • @returns for return values
    • Brief description of purpose

STATUS_MESSAGES.md Updates

When adding new status messages, include:

  • The exact status message text
  • When it appears (trigger condition)
  • The status color used
  • Any follow-up actions or states


## Requested Changes

When Auto Ping mode is enabled, sending a Manual Ping that gets skipped (because the GPS coordinates are stale and/or the device is “too close to last ping”) leaves the UI stuck showing:

  • “Ping skipped, too close to last ping”

In Auto mode, that skipped/manual status should be temporary. After the manual ping attempt resolves (even if it’s blocked), the UI should return to displaying the Auto Ping countdown (e.g., “Waiting for next auto ping (Xs)”) since the auto timer is still running in the background.

Observed behavior (from logs)

  • Auto countdown is active and updating:
    • Status applied: "Waiting for next auto ping (14s)"
    • Status applied: "Waiting for next auto ping (13s)"
  • User clicks Manual Ping during Auto mode:
    • Manual ping during auto mode - pausing auto countdown
    • Pausing auto countdown with 12921ms remaining
  • Manual ping is blocked by minimum distance check:
    • Ping blocked: too close to last ping
    • Status applied: "Ping skipped, too close to last ping"
  • After this, the auto ping countdown continues (timer still fires later), but the countdown text is no longer shown—the “Ping skipped…” message remains visible instead of reverting back to the auto countdown display.

Expected behavior

  • If Auto Ping is enabled, any “manual ping skipped/blocked” status message should clear automatically and the UI should resume showing the “Waiting for next auto ping (Xs)” countdown using the remaining auto timer time.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits December 21, 2025 14:37
When a manual ping is blocked (GPS stale, outside geofence, or too close to last ping) during auto mode, the UI now resumes the auto ping countdown instead of staying stuck on the skip message.

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Created handleManualPingFailureDuringAutoMode() helper function to eliminate code duplication across three manual ping failure paths.

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Added comprehensive JSDoc comments to handleManualPingFailureDuringAutoMode() following codebase conventions.

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Renamed handleManualPingFailureDuringAutoMode to handleManualPingBlockedDuringAutoMode to better reflect that it handles blocked pings, not failures. Updated JSDoc to clarify it handles GPS unavailable, geofence, and distance checks.

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Update guidelines for status messages and logging Fix auto countdown not resuming after manual ping blocked during auto mode Dec 21, 2025
Copilot AI requested a review from MrAlders0n December 21, 2025 14:46
@MrAlders0n
Copy link
Collaborator

@copilot You said this and I just want to confirm you understood and did not make unnessary changes

However, the problem is that when manual ping is blocked during auto mode, the auto countdown was already paused at line 858. The paused auto countdown needs to be resumed after the manual ping is blocked, but this doesn't happen. Let me check the flow more carefully:

No no, it looks to me like the auto ping is resumed because then later on an auto ping is sent however the resumed countdown is not displayed to the user

Copy link
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot You said this and I just want to confirm you understood and did not make unnessary changes

However, the problem is that when manual ping is blocked during auto mode, the auto countdown was a...

You're correct! I understood the issue properly:

Before the fix: The auto ping timer continued running in the background (so auto pings were eventually sent), but the countdown display was not shown to the user - the UI stayed stuck on "Ping skipped, too close to last ping".

After the fix: When a manual ping is blocked during auto mode, handleManualPingBlockedDuringAutoMode() calls resumeAutoCountdown() which calls startAutoCountdown(), and this immediately updates the UI to show the countdown: "Ping skipped, too close to last ping, waiting for next ping (Xs)".

The key was resuming the countdown display (via autoCountdownTimer.start()), not just the timer itself. The fix ensures users can see both the skip reason and the countdown timer.

Commit: 8491055

@MrAlders0n MrAlders0n marked this pull request as ready for review December 21, 2025 14:52
@MrAlders0n MrAlders0n merged commit eb16fac into dev Dec 21, 2025
1 check passed
@MrAlders0n MrAlders0n deleted the copilot/update-status-messages-guideline-again branch December 21, 2025 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants