Set the time from GPS every 30 minutes#10737
Merged
Merged
Conversation
Contributor
⚡ Try this PR in the Web FlasherWarning This is an automated, unreviewed CI test build. Back up your device configuration Supported boards built by this PR (22)
Build artifacts expire on 2026-07-17. Updated for |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to restore periodic RTC time updates from GPS after a prior security change prevented re-updating time beyond first boot, and it reduces the external time (NTP/phone-provided) reapply interval to 30 minutes to better correct RTC drift.
Changes:
- Reduced the NTP/phone “reapply external time” throttle window from 12 hours to 30 minutes in
perhapsSetRTC(). - Added a
GPS::gotTimemember and reset logic so GPS time acquisition can occur again after the initial boot-time set. - Adjusted
GPS::setPowerState()andGPS::runOnce()flow to treat “got time” as a per-cycle state rather than a local, recomputed variable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/gps/RTC.cpp | Shortens the NTP/phone time reapply throttle from 12h to 30m. |
| src/gps/GPS.h | Introduces gotTime state to persist “time acquired” across runOnce() iterations. |
| src/gps/GPS.cpp | Resets/uses gotTime to allow GPS time setting beyond first boot. |
Comment on lines
+1148
to
1151
| // 1. Got a time for the first time this cycle | ||
| if (!gotTime && lookForTime()) { // Note: we count on this && short-circuiting and not resetting the RTC time | ||
| gotTime = true; | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
I think it missed the stuff in rtc.cpp.
thebentern
approved these changes
Jun 17, 2026
jp-bennett
added a commit
that referenced
this pull request
Jun 17, 2026
raghumad
pushed a commit
to raghumad/mezulla-firmware
that referenced
this pull request
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our security work with disallowing loopback to modules unintentionally meant that we were never updating time from GPS after first boot. This corrects that problem, and further decreases the update time to 30 minutes.