mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-26 20:56:37 +00:00
fix(prefs): snap legacy gps_interval values to a valid duty-cycle preset
The pre-v1.13 "GPS Interval" setting (hidden from Settings ever since, but its byte kept "for backwards compatibility") used a different option set than today's duty-cycle presets -- its old 30s choice isn't one of them. A device that had it set to 30 would load that value straight into the new duty-cycle scheduler while "GPS pwr" in Settings showed OFF (gpsDutyIndex() found no matching preset), silently cycling GPS on a setting nobody could see or change. Unrecognised values now reset to OFF on load, same as the existing out-of-range clamp this replaces. Also refreshes MyMesh.h's FIRMWARE_VERSION/FIRMWARE_BUILD_DATE fallback (only ever used by a `pio run` that bypasses build.sh entirely) -- it was still "v1.17-solo.0" from 12 tags ago. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
71c39bab4f
commit
6c7c9f3f83
@@ -264,7 +264,18 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
|||||||
file.read((uint8_t *)&_prefs.buzzer_quiet, sizeof(_prefs.buzzer_quiet));
|
file.read((uint8_t *)&_prefs.buzzer_quiet, sizeof(_prefs.buzzer_quiet));
|
||||||
file.read((uint8_t *)&_prefs.gps_enabled, sizeof(_prefs.gps_enabled));
|
file.read((uint8_t *)&_prefs.gps_enabled, sizeof(_prefs.gps_enabled));
|
||||||
file.read((uint8_t *)&_prefs.gps_interval, sizeof(_prefs.gps_interval));
|
file.read((uint8_t *)&_prefs.gps_interval, sizeof(_prefs.gps_interval));
|
||||||
if (_prefs.gps_interval > 86400) _prefs.gps_interval = 0; // now a duty-cycle sleep window (secs); 0 = disabled
|
// Only today's duty-cycle presets are meaningful now (see SettingsScreen's
|
||||||
|
// GPS_DUTY_OPTS). Anything else -- out of range, or a leftover value from
|
||||||
|
// the pre-v1.13 "GPS Interval" setting this byte used to hold (its own
|
||||||
|
// 30s option isn't one of today's presets) -- wouldn't match a Settings
|
||||||
|
// choice, so "GPS pwr" would misleadingly show OFF while still silently
|
||||||
|
// duty-cycling GPS on that stale value. Snap anything unrecognised to OFF.
|
||||||
|
{
|
||||||
|
static const uint32_t GPS_DUTY_PRESETS[] = { 0, 60, 300, 900, 1800, 3600 };
|
||||||
|
bool known = false;
|
||||||
|
for (uint32_t v : GPS_DUTY_PRESETS) { if (_prefs.gps_interval == v) { known = true; break; } }
|
||||||
|
if (!known) _prefs.gps_interval = 0;
|
||||||
|
}
|
||||||
file.read((uint8_t *)&_prefs.autoadd_config, sizeof(_prefs.autoadd_config));
|
file.read((uint8_t *)&_prefs.autoadd_config, sizeof(_prefs.autoadd_config));
|
||||||
file.read((uint8_t *)&_prefs.autoadd_max_hops, sizeof(_prefs.autoadd_max_hops));
|
file.read((uint8_t *)&_prefs.autoadd_max_hops, sizeof(_prefs.autoadd_max_hops));
|
||||||
file.read((uint8_t *)&_prefs.rx_boosted_gain, sizeof(_prefs.rx_boosted_gain));
|
file.read((uint8_t *)&_prefs.rx_boosted_gain, sizeof(_prefs.rx_boosted_gain));
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ class UITask;
|
|||||||
#define FIRMWARE_VER_CODE 13
|
#define FIRMWARE_VER_CODE 13
|
||||||
|
|
||||||
#ifndef FIRMWARE_BUILD_DATE
|
#ifndef FIRMWARE_BUILD_DATE
|
||||||
#define FIRMWARE_BUILD_DATE "11 Aug 2026"
|
#define FIRMWARE_BUILD_DATE "12 Aug 2026"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Versioning: vX.Y = upstream base, solo.N = fork revision
|
// Fallback only -- every real build (local or CI) goes through build.sh, which
|
||||||
|
// always injects FIRMWARE_VERSION itself (the pushed tag name for a release,
|
||||||
|
// "dev-<commit>" otherwise; see build-solo-firmwares.yml). This default only
|
||||||
|
// shows up for a `pio run` invoked directly, bypassing build.sh entirely.
|
||||||
#ifndef FIRMWARE_VERSION
|
#ifndef FIRMWARE_VERSION
|
||||||
#define FIRMWARE_VERSION "v1.17-solo.0"
|
#define FIRMWARE_VERSION "v1.24-dev"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||||
|
|||||||
Reference in New Issue
Block a user