mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-12 03:07:13 +01:00
... on second thought, just bump the cfg version
This commit is contained in:
@@ -26,15 +26,27 @@ void _cmpMoveIndexDown(const char * key, int offset = 0) {
|
||||
// 2: based on Embedis, with board definitions 1-based
|
||||
// 3: based on Embedis, with board definitions 0-based
|
||||
// 4: based on Embedis, no board definitions
|
||||
// 5: based on Embedis, updated rfb codes format
|
||||
|
||||
int migrateVersion() {
|
||||
const static auto version = getSetting("cfg", CFG_VERSION);
|
||||
if (version == CFG_VERSION) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void migrate() {
|
||||
|
||||
// Update if not on the latest version
|
||||
const auto version = getSetting("cfg", CFG_VERSION);
|
||||
if (version == CFG_VERSION) return;
|
||||
// We either get 0, when version did not change
|
||||
// Or, the version we migrate from
|
||||
const auto version = migrateVersion();
|
||||
setSetting("cfg", CFG_VERSION);
|
||||
|
||||
switch (version) {
|
||||
if (!version) return;
|
||||
|
||||
switch (migrateVersion()) {
|
||||
// migrate old version with 1-based indices
|
||||
case 2:
|
||||
_cmpMoveIndexDown("ledGPIO");
|
||||
|
||||
Reference in New Issue
Block a user