From dac272e90381f572a615b94127a12ab15e832513 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 26 Aug 2020 22:49:59 +0300 Subject: [PATCH 1/3] ci: restore PIO caching --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 07daa892..21cb2c86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: cache: directories: - ~/.npm + - ~/.platformio env: global: - BUILDER_TOTAL_THREADS=4 From 844d0b4c53c2c194d24c0f021379fe3f6fce7544 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 26 Aug 2020 22:54:38 +0300 Subject: [PATCH 2/3] pio: remove the note about PIO incompatibility ref. https://github.com/platformio/platformio-core/commit/6af2bad12320bc264a8ea3f070d25d5c09f4b75a 2.3.0 is still not supported, but at least buildable --- code/platformio.ini | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/platformio.ini b/code/platformio.ini index d269e14f..61623769 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -34,10 +34,6 @@ extra_configs = # arduino core 2.7.1 = espressif8266@2.5.3 (platform) # arduino core 2.7.4 = espressif8266@2.6.2 (platform_latest) # -# Arduino Core 2.3.0: -# "Error: Development platform 'espressif8266' is not compatible with PlatformIO Core v4.4.0-b.1 and depends on PlatformIO Core ^3.0.0" -# ref. https://docs.platformio.org/en/latest/core/history.html -# # ------------------------------------------------------------------------------ platform = espressif8266@2.5.3 From 17814d8003e4ad4ba6a41061ad0cee2c5a8c8cd6 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 26 Aug 2020 22:56:17 +0300 Subject: [PATCH 3/3] settings: fix migrate routine never working with empty settings --- code/espurna/migrate.cpp | 14 ++++++++++++-- code/espurna/settings.h | 8 +++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/espurna/migrate.cpp b/code/espurna/migrate.cpp index 9890c333..5884e9af 100644 --- a/code/espurna/migrate.cpp +++ b/code/espurna/migrate.cpp @@ -27,13 +27,23 @@ void _cmpMoveIndexDown(const char * key, int offset = 0) { // 3: based on Embedis, with board definitions 0-based // 4: based on Embedis, no board definitions +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; + const auto version = migrateVersion(); setSetting("cfg", CFG_VERSION); + if (!version) return; + switch (version) { // migrate old version with 1-based indices case 2: diff --git a/code/espurna/settings.h b/code/espurna/settings.h index cf4dc130..26781c7e 100644 --- a/code/espurna/settings.h +++ b/code/espurna/settings.h @@ -225,9 +225,15 @@ void settingsProcessConfig(const settings_cfg_list_t& config, settings_filter_t size_t settingsSize(); -void migrate(); void settingsSetup(); +// ----------------------------------------------------------------------------- +// Configuration updates +// ----------------------------------------------------------------------------- + +int migrateVersion(); +void migrate(); + // ----------------------------------------------------------------------------- // Deprecated implementation // -----------------------------------------------------------------------------