Stop reading the old settings format

The display has stored its settings as version 8 since 2.22.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-04 02:45:24 +01:00
1 parent 48e29096c0
commit ad9fd062a8
2 files changed
+3 -17

No files matched your search

+1 -1
View File
@@ -118,7 +118,7 @@ const uint32_t SETUP_AP_DELAY = 20000; // open the AP when WiFi fails thi
const uint32_t WIFI_CONNECT_TIMEOUT = 30000;
const uint32_t WIFI_RESTART_TIME = 10UL * 60 * 1000;
#define FIRMWARE_VERSION "2.22.0"
#define FIRMWARE_VERSION "2.22.1"
// Home Assistant device id (do not change: Home Assistant's entities are linked to it)
const uint8_t HA_DEVICE_ID[] = {0x34, 0x86, 0x5d, 0x3a, 0x08, 0x28};
+2 -16
View File
@@ -7,14 +7,9 @@
static const char *NAMESPACE = "flipdot";
static const char *KEY = "settings";
// Increase when the Settings struct changes; records of other versions are ignored
// (defaults). 2.15.0 stored all older records again in version 7. To keep the settings over
// a change, add a frozen copy of the old layout and convert it (see git history).
// (defaults). To keep the settings over a change, read or convert the old layout for one
// release (see git history: 2.22.0 read version 7, a prefix of version 8).
static const uint16_t VERSION = 8;
// Version 7 is version 8 without random_effects at the end, so no frozen copy is needed. It
// becomes version 8 with the next save. Remove this once the device has saved.
static const uint16_t OLD_VERSION = 7;
static const size_t OLD_SIZE = offsetof(Settings, random_effects);
static_assert(alignof(Settings) == alignof(uint16_t), "no padding before random_effects");
struct StoredSettings
{
@@ -33,15 +28,6 @@ void loadSettings(Settings &settings)
size_t read = prefs.getBytes(KEY, &stored, sizeof(stored));
prefs.end();
if (read == offsetof(StoredSettings, settings) + OLD_SIZE && stored.version == OLD_VERSION &&
stored.size == OLD_SIZE)
{
stored.settings.random_effects = RANDOM_EFFECTS_ALL;
if (validateSettings(stored.settings) == nullptr)
settings = stored.settings;
return;
}
if (read == offsetof(StoredSettings, settings) + sizeof(Settings) && stored.version == VERSION &&
stored.size == sizeof(Settings) && validateSettings(stored.settings) == nullptr)
settings = stored.settings;