Skip to content

feat(BaseUI): show 'GPS Time Only' when GNSS has time but no position fix - #11361

Queued
jp-bennett wants to merge 1 commit into
developfrom
claude/gps-time-only-baseui-0lujqj
Queued

feat(BaseUI): show 'GPS Time Only' when GNSS has time but no position fix#11361
jp-bennett wants to merge 1 commit into
developfrom
claude/gps-time-only-baseui-0lujqj

Conversation

@jp-bennett

@jp-bennett jp-bennett commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

The position frame's drawGpsCoordinates() only distinguished 'No GPS
present' / 'No GPS Lock' / coordinates, so a GNSS that had decoded
valid time but no fix displayed identically to a cold chip.

  • GPSStatus: add per-acquisition hasTime flag (5th ctor param,
    accessor, matches() term, updateStatus() copy)
  • GPS::runOnce(): publish immediately on the gotTime rising edge so
    the flag reaches observers on the time-only path, which previously
    never published; done directly rather than via the end-of-loop
    block so fixHoldEnds is preserved and hold/power behavior is
    unchanged. Safe without a location: PositionModule ignores invalid
    positions. gotTime is already cleared on each GPS_ACTIVE entry, so
    the state is not sticky across acquisitions.
  • UIRenderer::drawGpsCoordinates(): the 'No GPS Lock' line becomes
    'GPS Time Only' when time is valid.

The drawGps() header renderer is intentionally untouched (its
branches need separate de-clobbering work).

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01CcrasD4QsatunDreANDgCx

Summary by CodeRabbit

  • New Features

    • GPS status now reports when valid time data is available, even without a position lock.
    • GPS time is published immediately when first received.
    • The interface displays “GPS Time Only” when time is available before location lock.
  • Bug Fixes

    • Improved GPS status updates so time-only availability is reflected promptly.

… fix

The position frame's drawGpsCoordinates() only distinguished 'No GPS
present' / 'No GPS Lock' / coordinates, so a GNSS that had decoded
valid time but no fix displayed identically to a cold chip.

- GPSStatus: add per-acquisition hasTime flag (5th ctor param,
  accessor, matches() term, updateStatus() copy)
- GPS::runOnce(): publish immediately on the gotTime rising edge so
  the flag reaches observers on the time-only path, which previously
  never published; done directly rather than via the end-of-loop
  block so fixHoldEnds is preserved and hold/power behavior is
  unchanged. Safe without a location: PositionModule ignores invalid
  positions. gotTime is already cleared on each GPS_ACTIVE entry, so
  the state is not sticky across acquisitions.
- UIRenderer::drawGpsCoordinates(): the 'No GPS Lock' line becomes
  'GPS Time Only' when time is valid.

The drawGps() header renderer is intentionally untouched (its
branches need separate de-clobbering work).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CcrasD4QsatunDreANDgCx
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

GPSStatus now tracks valid GPS time independently from position lock. GPS publishes the first valid time immediately. The UI displays GPS Time Only when time is available without a position lock.

Changes

GPS time status

Layer / File(s) Summary
GPS status time tracking
src/GPSStatus.h
GPSStatus stores hasTime, accepts it in the constructor, exposes getHasTime(), detects changes, and copies the value during updates.
Time publication and GPS display
src/gps/GPS.cpp, src/graphics/draw/UIRenderer.cpp
GPS includes gotTime in status publication and publishes the first valid time immediately. The UI displays GPS Time Only when time exists without position lock.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GPS
  participant GPSStatus
  participant UIRenderer
  GPS->>GPSStatus: Construct status with gotTime
  GPS->>GPS: Detect first valid GPS time
  GPS->>GPSStatus: Publish status update
  UIRenderer->>GPSStatus: Read getHasTime()
  GPSStatus-->>UIRenderer: Return time availability
Loading

Suggested reviewers: caveman99, harukitoreda, thebentern

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: showing GPS time-only status when GNSS has no position fix.
Description check ✅ Passed The description clearly explains the implementation, behavior, scope, and intentional exclusions, although it does not include testing attestations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/gps-time-only-baseui-0lujqj

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/gps/GPS.cpp (1)

1539-1541: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the new rationale within the C++ comment-length guideline.

The explanation at Lines [1539]-[1541] uses three physical comment lines. The repository guideline limits comments to one or two lines. Keep the non-obvious reason, but condense the block.

Proposed two-line comment
-            // Publish immediately (rather than via the block below, which would clear fixHoldEnds) so the
-            // time-only state reaches the UI without waiting for a location. Safe without a valid location:
-            // PositionModule::handleNewPosition ignores invalid positions.
+            // Publish immediately so the UI sees time-only status without waiting for a location.
+            // Preserve fixHoldEnds; the position module must ignore invalid positions.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gps/GPS.cpp` around lines 1539 - 1541, Condense the explanatory comment
immediately above the immediate publish call to no more than two physical C++
comment lines, preserving both the reason for bypassing the block that clears
fixHoldEnds and the safety of publishing without a valid location.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/GPSStatus.h`:
- Line 20: Resolve the missing copy operations declared in GPSStatus by either
defining its copy constructor and copy assignment operator or removing those
declarations when compiler-generated copying is sufficient. Keep the class
copyable and ensure all existing GPSStatus fields, including hasTime, are copied
correctly.

---

Nitpick comments:
In `@src/gps/GPS.cpp`:
- Around line 1539-1541: Condense the explanatory comment immediately above the
immediate publish call to no more than two physical C++ comment lines,
preserving both the reason for bypassing the block that clears fixHoldEnds and
the safety of publishing without a valid location.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 98a2be77-6b86-4115-b506-db4536457c22

📥 Commits

Reviewing files that changed from the base of the PR and between 32c3b62 and eb15055.

📒 Files selected for processing (3)
  • src/GPSStatus.h
  • src/gps/GPS.cpp
  • src/graphics/draw/UIRenderer.cpp

Comment thread src/GPSStatus.h

bool hasLock = false; // default to false, until we complete our first read
bool isConnected = false; // Do we have a GPS we are talking to
bool hasTime = false; // GPS has decoded a valid time this acquisition, even without a position fix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Expected: every custom GPSStatus copy implementation propagates hasTime.
rg -n -C 12 \
  'GPSStatus\s*\(const\s+GPSStatus\s*&|GPSStatus::GPSStatus\s*\(|GPSStatus::operator\s*=|hasTime' \
  src -g '*.cpp' -g '*.h' -g '*.hpp'

Repository: meshtastic/firmware

Length of output: 6173


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- matching GPSStatus custom copy symbols across tracked files ---\n'
rg -n -C 16 \
  'GPSStatus\s*\(\s*const\s+GPSStatus\s*&|::GPSStatus\s*\([^{\w]*const\s+.*\)|::operator\s*=\s*\(|operator\s*=\s*\(\s*const\s+GPSStatus|hasTime' \
  . -g '*.cpp' -g '*.h' -g '*.hpp' | sed -n '1,220p'

printf '\n--- all GPSStatus operator symbols ---\n'
rg -n 'GPSStatus::operator\s*=|GPSStatus\s*::\s*::operator\s*=' . -g '*.cpp' -g '*.h' -g '*.hpp' || true

Repository: meshtastic/firmware

Length of output: 248


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- matching GPSStatus custom copy symbols across tracked files ---'
rg -n -C 16 \
  'GPSStatus[[:space:]]*\([[:space:]]*const[[:space:]]+GPSStatus[[:space:]]*&|::GPSStatus[[:space:]]*\(.*const[[:space:]]+.*\)|::operator[[:space:]]*=[[:space:]]*\(|operator[[:space:]]*=[[:space:]]*([^(]*|[^(0-9a-zA-Z_])*\([[:space:]]*const[[:space:]]+GPSStatus|hasTime' \
  . -g '*.cpp' -g '*.h' -g '*.hpp' | sed -n '1,220p'

printf '%s\n' ''
printf '%s\n' '--- all GPSStatus operator symbols ---'
rg -n 'GPSStatus::operator[[:space:]]*=|GPSStatus[[:space:]]*::[[:space:]]*operator[[:space:]]*=' . -g '*.cpp' -g '*.h' -g '*.hpp' || true

Repository: meshtastic/firmware

Length of output: 7221


Link the declared GPSStatus copy operations.

src/GPSStatus.h declares the copy constructor and copy assignment operator but the definitions are missing, so this no longer builds. Add the definitions or remove the declarations if the default copy operators are sufficient.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/GPSStatus.h` at line 20, Resolve the missing copy operations declared in
GPSStatus by either defining its copy constructor and copy assignment operator
or removing those declarations when compiler-generated copying is sufficient.
Keep the class copyable and ensure all existing GPSStatus fields, including
hasTime, are copied correctly.

@Xaositek Xaositek added enhancement New feature or request baseui Issues directly related to BaseUI labels Aug 7, 2026
@jp-bennett
jp-bennett added this pull request to the merge queue Aug 8, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baseui Issues directly related to BaseUI enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants