Keep fractional timezones within constrained flash budgets

Deduplicate validation and preserve the published preference bytes and transactional saves. Correct Ikoka Handheld Companion flash bounds and document QSPI Room migration. Qualify STM32 and RAK4631 at the full 1.18.0.1 release version length.
This commit is contained in:
mikecarper committed 2026-10-18 08:46:20 -07:00
1 parent 7088096abf
commit 59b0ab93d0
7 files changed
+164 -16

No files matched your search

+7 -5
View File
@@ -1123,9 +1123,6 @@ bool DataStore::loadPrefsInt(const char *filename,
loaded_prefs.lost_reply = 0;
loaded_prefs.tx_media = mesh::RADIO_TX_AUTO;
loaded_prefs.tx_ssh = mesh::RADIO_TX_AUTO;
// Images predating byte 225 inherit the caller's valid timezone default.
loaded_prefs.tz_offset_legacy = mesh::companion::timezone::valid(_prefs.tz_offset)
? static_cast<int8_t>(_prefs.tz_offset) : 0;
#if defined(RAK_4631)
loaded_prefs.peripherals_shared = 0;
#endif
@@ -1488,10 +1485,13 @@ bool DataStore::savePrefs(const CompanionNodePrefs& _prefs, double node_lat, dou
used = sizeof(image) + 1;
break;
}
memcpy(image + used, prefValue(field, _prefs, node_lat, node_lon, pad, &legacy_tz_offset),
memcpy(image + used, prefValue(field, _prefs, node_lat, node_lon, pad),
field.length);
used += field.length;
}
// STM32 stages the frozen prefix: patch its published integer hour once,
// rather than selecting an alternate source for every table entry.
image[225] = static_cast<uint8_t>(legacy_tz_offset);
bool success = used == sizeof(image)
&& file.write(image, sizeof(image)) == sizeof(image);
#elif defined(NRF52_PLATFORM) && defined(__GNUC__)
@@ -1663,7 +1663,9 @@ bool DataStore::savePrefs(const CompanionNodePrefs& _prefs, double node_lat, dou
_prefs.tx_media, _prefs.tx_ssh);
success = success
&& file.write(traffic_footer, sizeof(traffic_footer)) == sizeof(traffic_footer);
if (mesh::companion::timezone::fractional(_prefs.tz_offset)) {
// Range was checked before opening the transaction. Reuse its integer
// fallback instead of validating and converting the same float again.
if (_prefs.tz_offset != legacy_tz_offset) {
uint8_t timezone_footer[mesh::companion::timezone::FooterSize];
mesh::companion::timezone::encodeFooter(timezone_footer, _prefs.tz_offset);
success = success
+1 -1
View File
@@ -11008,7 +11008,7 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp,
if (savePrefs()) strcpy(reply, "OK");
else {
_prefs.tz_offset = previous;
strcpy(reply, "Error: timezone could not be saved");
strcpy(reply, "Error: setting could not be saved");
}
}
return true;