From cea3c30f31f991ad867d451d19eefd60c540775d Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Tue, 26 May 2026 08:05:05 +0200 Subject: [PATCH] =?UTF-8?q?fix(build):=20trail=20=E2=80=94=20::=20prefixes?= =?UTF-8?q?=20on=20DataStore's=20openWrite=20+=20Trail.h=20gmtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding the public DataStore::openWrite(const char*) member shadowed the file-static openWrite(FILESYSTEM*, const char*) helper inside DataStore.cpp's method bodies, so every internal call broke ("no matching function" with two args). Qualify each internal call with ::openWrite so name lookup picks the static helper. The new public member's own implementation already does that. Trail.h's gpxPoint template called gmtime unqualified; ADL couldn't find it from the template definition because no argument was template-dependent. Include and call ::gmtime — both passes the dependency rule and avoids the -fpermissive-only acceptance. Co-Authored-By: Claude Sonnet 4.6 --- examples/companion_radio/DataStore.cpp | 22 +++++++++++----------- examples/companion_radio/Trail.h | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/companion_radio/DataStore.cpp b/examples/companion_radio/DataStore.cpp index b2edb34e..77ccc686 100644 --- a/examples/companion_radio/DataStore.cpp +++ b/examples/companion_radio/DataStore.cpp @@ -333,7 +333,7 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no } void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_lon) { - File file = openWrite(_fs, "/new_prefs"); + File file = ::openWrite(_fs, "/new_prefs"); if (file) { uint8_t pad[8]; memset(pad, 0, sizeof(pad)); @@ -425,7 +425,7 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_ void DataStore::saveRTCTime() { uint32_t t = _clock->getCurrentTime(); if (t < 1000000000UL) return; // don't save if time not yet synced - File file = openWrite(_fs, "/rtc_save"); + File file = ::openWrite(_fs, "/rtc_save"); if (file) { file.write((uint8_t *)&t, sizeof(t)); file.close(); @@ -474,7 +474,7 @@ File file = openRead(_getContactsChannelsFS(), "/contacts3"); } void DataStore::saveContacts(DataStoreHost* host) { - File file = openWrite(_getContactsChannelsFS(), "/contacts3"); + File file = ::openWrite(_getContactsChannelsFS(), "/contacts3"); if (file) { uint32_t idx = 0; ContactInfo c; @@ -528,7 +528,7 @@ void DataStore::loadChannels(DataStoreHost* host) { } void DataStore::saveChannels(DataStoreHost* host) { - File file = openWrite(_getContactsChannelsFS(), "/channels2"); + File file = ::openWrite(_getContactsChannelsFS(), "/channels2"); if (file) { uint8_t channel_idx = 0; ChannelDetails ch; @@ -560,7 +560,7 @@ struct BlobRec { void DataStore::checkAdvBlobFile() { if (!_getContactsChannelsFS()->exists("/adv_blobs")) { - File file = openWrite(_getContactsChannelsFS(), "/adv_blobs"); + File file = ::openWrite(_getContactsChannelsFS(), "/adv_blobs"); if (file) { BlobRec zeroes; memset(&zeroes, 0, sizeof(zeroes)); @@ -577,7 +577,7 @@ void DataStore::migrateToSecondaryFS() { if (!_fsExtra->exists("/adv_blobs")) { if (_fs->exists("/adv_blobs")) { File oldAdvBlobs = openRead(_fs, "/adv_blobs"); - File newAdvBlobs = openWrite(_fsExtra, "/adv_blobs"); + File newAdvBlobs = ::openWrite(_fsExtra, "/adv_blobs"); if (oldAdvBlobs && newAdvBlobs) { BlobRec rec; @@ -598,7 +598,7 @@ void DataStore::migrateToSecondaryFS() { if (!_fsExtra->exists("/contacts3")) { if (_fs->exists("/contacts3")) { File oldFile = openRead(_fs, "/contacts3"); - File newFile = openWrite(_fsExtra, "/contacts3"); + File newFile = ::openWrite(_fsExtra, "/contacts3"); if (oldFile && newFile) { uint8_t buf[64]; @@ -615,7 +615,7 @@ void DataStore::migrateToSecondaryFS() { if (!_fsExtra->exists("/channels2")) { if (_fs->exists("/channels2")) { File oldFile = openRead(_fs, "/channels2"); - File newFile = openWrite(_fsExtra, "/channels2"); + File newFile = ::openWrite(_fsExtra, "/channels2"); if (oldFile && newFile) { uint8_t buf[64]; @@ -633,7 +633,7 @@ void DataStore::migrateToSecondaryFS() { if (_fsExtra->exists("/_main.id")) { if (_fs->exists("/_main.id")) {_fs->remove("/_main.id");} File oldFile = openRead(_fsExtra, "/_main.id"); - File newFile = openWrite(_fs, "/_main.id"); + File newFile = ::openWrite(_fs, "/_main.id"); if (oldFile && newFile) { uint8_t buf[64]; @@ -649,7 +649,7 @@ void DataStore::migrateToSecondaryFS() { if (_fsExtra->exists("/new_prefs")) { if (_fs->exists("/new_prefs")) {_fs->remove("/new_prefs");} File oldFile = openRead(_fsExtra, "/new_prefs"); - File newFile = openWrite(_fs, "/new_prefs"); + File newFile = ::openWrite(_fs, "/new_prefs"); if (oldFile && newFile) { uint8_t buf[64]; @@ -764,7 +764,7 @@ bool DataStore::putBlobByKey(const uint8_t key[], int key_len, const uint8_t src char path[64]; makeBlobPath(key, key_len, path, sizeof(path)); - File f = openWrite(_fs, path); + File f = ::openWrite(_fs, path); if (f) { int n = f.write(src_buf, len); f.close(); diff --git a/examples/companion_radio/Trail.h b/examples/companion_radio/Trail.h index cbf6a317..d8abb10a 100644 --- a/examples/companion_radio/Trail.h +++ b/examples/companion_radio/Trail.h @@ -3,6 +3,7 @@ #include #include #include +#include // RAM-only GPS trail ring buffer. // Storage cost: 256 × 12 B = 3 KB. The trail survives auto-off (only the @@ -251,7 +252,7 @@ public: } char buf[120]; time_t t = (time_t)p.ts; - struct tm* gt = gmtime(&t); + struct tm* gt = ::gmtime(&t); int len = snprintf(buf, sizeof(buf), "\n", p.lat_1e6 / 1.0e6, p.lon_1e6 / 1.0e6,