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:
Jakub
2026-10-02 19:24:36 +02:00
co-authored by Claude Opus 5.5
parent 2589fe95ce
commit 0bbf2fa2b3
5 changed files with 43 additions and 21 deletions
+6 -2
View File
@@ -23,7 +23,10 @@ inline bool writeHeader(F& file, uint32_t magic, uint8_t version, uint16_t count
// reject against its own capacity) and reads any table-specific fields that
// follow the count.
template <typename F>
inline bool readHeader(F& file, uint32_t expect_magic, uint8_t expect_version, uint16_t& count_out) {
// `min_version` > 0 also takes the older versions from it up to expect_version,
// the one read going to *version_out.
inline bool readHeader(F& file, uint32_t expect_magic, uint8_t expect_version, uint16_t& count_out,
uint8_t min_version = 0, uint8_t* version_out = nullptr) {
uint32_t magic = 0;
if (file.read((uint8_t*)&magic, sizeof(magic)) != (int)sizeof(magic)) return false;
if (magic != expect_magic) return false;
@@ -32,7 +35,8 @@ inline bool readHeader(F& file, uint32_t expect_magic, uint8_t expect_version, u
if (file.read(&ver, 1) != 1) return false;
if (file.read(&res, 1) != 1) return false;
if (file.read((uint8_t*)&cnt, sizeof(cnt)) != (int)sizeof(cnt)) return false;
if (ver != expect_version) return false;
if (ver > expect_version || ver < (min_version ? min_version : expect_version)) return false;
if (version_out) *version_out = ver;
count_out = cnt;
return true;
}