mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
feat(trail): record altitude in trail points
Each point keeps the GPS altitude in what was padding, so a point stays 16 bytes. The save format goes to version 2; version 1 files still load, with the altitude unknown. GPX export writes <ele>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Current GPS altitude in metres, false without a fix.
|
||||
bool currentAltitude(int16_t& m) const {
|
||||
LocationProvider* loc = _sensors ? _sensors->getLocationProvider() : nullptr;
|
||||
if (!loc || !loc->isValid()) return false;
|
||||
long a = loc->getAltitude() / 1000; // the provider reports millimetres
|
||||
m = (int16_t)(a < -32000 ? -32000 : a > 32000 ? 32000 : a);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Current course over ground in degrees (0..359), or false if not enough
|
||||
// recent movement to derive a stable heading. Holds the last good heading
|
||||
// while standing still.
|
||||
|
||||
@@ -47,8 +47,10 @@ public:
|
||||
} else if (_trail.isPaused()) {
|
||||
_trail.setPaused(false); // feature turned off → resume
|
||||
}
|
||||
int16_t alt = TRAIL_ALT_NONE;
|
||||
_course->currentAltitude(alt);
|
||||
if (!_trail.isPaused())
|
||||
_trail.addPoint(la, lo, (uint32_t)rtc_clock.getCurrentTime(), md);
|
||||
_trail.addPoint(la, lo, (uint32_t)rtc_clock.getCurrentTime(), md, alt);
|
||||
}
|
||||
|
||||
// True while a trail is recording and not auto-paused (needs live GPS).
|
||||
|
||||
Reference in New Issue
Block a user