Repository navigation
Conversation
Migrate the complete legacy PSON configuration and add persistent WiFiMulti restoration plus list_wifi, remove_wifi, and clear_wifi management APIs. Add host integration tests for ESP32 cores 2.x/3.x and board compilation coverage. Refs thinger-io#58
|
@swinp thanks for this PR! Most of it is already covered by 2.46.0 (#58): The remaining part, persisting the networks added with Closing it, thanks again for all the contributions these days! |
ESP32 WebConfig currently keeps its PSON configuration in SPIFFS, while the WiFiMulti list populated by
add_wifi()lives only in RAM. Persist both in NVS so configuration and the complete registered network list survive a reboot.WiFiManager's native saved AP already uses the ESP32 core's persistence; this change adds an explicit registry for multiple personal networks and migrates the entire WebConfig object rather than assuming that the upstream PSON schema contains Wi-Fi credentials.
Changes
thinger/config, preserving custom, nested, binary and unknown fields. Subsequent portal saves update the loaded object instead of discarding unregistered fields./config.psononly when the NVS record is absent. Validate the file, commit and verify the NVS bytes, reload from NVS, then remove the file. Mount errors never trigger formatting; existing, cleared or invalid NVS records never fall back to a stale file.add_wifi()registry inthinger/wifi. Own credential strings, update existing SSIDs without duplicates, avoid unchanged writes, and lazily reconstruct WiFiMulti before connecting after reboot.list_wifi(ssids),remove_wifi(ssid)andclear_wifi(). Listing returns independent SSID snapshots without passwords. Deletion and clearing commit the remaining list before rebuilding WiFiMulti. An empty saved list blocks native-driver fallback across restarts.clean_credentials()writes a PSON tombstone to prevent stale-file reimport.Compatibility and recovery
add_wifi()retains its void signature;wifi_storage_ok()reports errors. Explicitrestore_wifi_networks()is available.THINGER_ESP32_CONFIG_USE_LITTLEFSfor ESP32 deployments that used LittleFS. New devices without a legacy filesystem must defineTHINGER_ESP32_CONFIG_SKIP_LEGACY_MIGRATION; an unreadable legacy volume otherwise stops loading to preserve its data.add_wifi_enterprise()remains RAM-only. Explicit lateradd_wifi()calls, including unconditional setup calls, register networks again after removal/clearing.clear_wifi()can recover a malformed Wi-Fi registry without erasing other NVS settings.Validation
esp32:esp32:esp32with core 3.3.12 and WiFiManager 2.0.17 (87% flash, 14% static RAM).Fixes #58.