M2 step 6: Tracks, recorded to GPX in the background

`r` in the GNSS App (or `gnss track start|stop`) records a Track to
/gnss/tracks/YYYYMMDD-HHMMSS.gpx: a point every 5 s once moved 5 m
(lib/gnss/track, 7 tests: haversine, the rule, GPX text, the file name).
It keeps recording with the App closed, shows REC in the Status Bar, and
announces start and stop with a Toast. It needs a card and the time;
switching GNSS off stops it. Tracks are written like Captures: past 90 %
card usage, until full. Storage Clean-up gets a GNSS tracks category.

A Track cut short by a reset or power loss has no GPX footer; the GNSS
Service closes such files at the next boot.

Verified on the device: a recorded Track and one interrupted by a reset
both parse as GPX 1.1 on the PC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-04 22:46:57 +02:00
co-authored by Claude Opus 5.5
parent 463ed2dda8
commit d7952612dd
13 changed files with 335 additions and 11 deletions
+3 -2
View File
@@ -32,10 +32,11 @@ StorageState StorageService::state() const {
return copy;
}
void StorageService::appendLine(const std::string& path, const std::string& line) {
void StorageService::appendLine(const std::string& path, const std::string& line, bool capture) {
lock();
size_t bytes = path.size() + line.size();
bool accept = monitor_.state().logsAllowed && pendingBytes_ + bytes <= kMaxPendingBytes;
bool allowed = capture ? monitor_.state().capturesAllowed : monitor_.state().logsAllowed;
bool accept = allowed && pendingBytes_ + bytes <= kMaxPendingBytes;
if (accept) {
pending_.emplace_back(path, line);
pendingBytes_ += bytes;