From f3e07b547d8597c5b13547af2a4ffa292bc960c0 Mon Sep 17 00:00:00 2001 From: MaxineMuster <146550015+MaxineMuster@users.noreply.github.com> Date: Tue, 10 Feb 2026 09:00:33 +0100 Subject: [PATCH] Try fix flash restrictions for W600 and W800 (#1936) * Try fix flash restrictions for W600 and W800 by moving start of FLASH_VARS (changing FLASH_VARS_STRUCTURE_ADDR) So restrictions in new_pins.h should be obsolete (allowing e.g. second SSID for W600 and W800) For W800 restriction should be no longer present since some time, because it was moved to easyflash some time ago... * Fix code in new_cfg.c, too Removed special handling for W600 and updated config version. * Tried an "update" mechanism: move flash_vars to new location if config is version 3 * Fix overwriting configSize in CFG_CalcChecksum() in case of V3 config * I try fixing error for XR platforms for conflicting SSD1306_Init by excluding local "components" dir * Try fixig build by removing "-lcomponent" * Try fix for XR806, too * try zeroing new space in config * Try fixing zero memory Add some more debug output * Removed test code for fixing XRadio devices - nothing to do with this PR Removed debug output * Change to reflect moving flashvars from local structure to easyflash in latest commit --- src/new_cfg.c | 13 +++++++++---- src/new_pins.h | 6 ------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/new_cfg.c b/src/new_cfg.c index 389c93a7c..9e288c0cf 100644 --- a/src/new_cfg.c +++ b/src/new_cfg.c @@ -26,11 +26,7 @@ int g_cfg_pendingChanges = 0; #define MAIN_CFG_VERSION_V3 3 // version 4 - bumped size by 1024, // added alternate ssid fields -#if PLATFORM_W600 -#define MAIN_CFG_VERSION 3 -#else #define MAIN_CFG_VERSION 5 -#endif static byte CFG_CalcChecksum(mainConfig_t *inf) { int header_size; @@ -871,7 +867,16 @@ void CFG_InitAndLoad() { #if ALLOW_WEB_PASSWORD // add web admin password configuration if (g_cfg.version<5) { +#if defined(PLATFORM_W600) + // W600 changed from V3 to V5, so at this point + // we read a valid V3 config but need a V5 config. + // Memory might contain old data (from flash_vars) + // so let's zero complete additional memory (including g_cfg.webPassword, making it empty). + memset((char*)(&g_cfg) + MAGIC_CONFIG_SIZE_V3, 0, sizeof(mainConfig_t) - MAGIC_CONFIG_SIZE_V3); + g_cfg_pendingChanges ++; +#else strcpy_safe(g_cfg.webPassword, "", sizeof(g_cfg.webPassword)); +#endif } #endif g_cfg.version = MAIN_CFG_VERSION; diff --git a/src/new_pins.h b/src/new_pins.h index 6b24b9654..ebb44fbcd 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -1553,11 +1553,6 @@ typedef struct mainConfig_s { char ping_host[64]; // ofs 0x000005E0 (dec 1504) //char initCommandLine[512]; -#if PLATFORM_W600 || PLATFORM_W800 -#define ALLOW_SSID2 0 -#define ALLOW_WEB_PASSWORD 0 - char initCommandLine[512]; -#else #define ALLOW_SSID2 1 #define ALLOW_WEB_PASSWORD 1 char initCommandLine[1568]; @@ -1577,7 +1572,6 @@ typedef struct mainConfig_s { byte disable_web_server; // offset 0x00000CBC (3260 decimal) char unused[324]; -#endif } mainConfig_t; // one sector is 4096 so it we still have some expand possibility