From 8771460fe704e0ee8d3edc594e3cc2e215f1b1b3 Mon Sep 17 00:00:00 2001 From: francois <francois@clever.amilab.irit.fr> Date: Fri, 26 May 2023 22:30:25 +0200 Subject: [PATCH] update --- .../libraries/neocampus/wifiParametersMgt.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/neosensor/libraries/neocampus/wifiParametersMgt.cpp b/neosensor/libraries/neocampus/wifiParametersMgt.cpp index 3158c4ec..a88e7546 100644 --- a/neosensor/libraries/neocampus/wifiParametersMgt.cpp +++ b/neosensor/libraries/neocampus/wifiParametersMgt.cpp @@ -29,6 +29,8 @@ #include <WiFi.h> #endif /* ESP8266 */ +#include "Preferences.h" // NVS storage (instead of the DEPRECATED eeprom) + #include "neocampus.h" #include "neocampus_debug.h" @@ -53,6 +55,9 @@ extern bool _need2reboot; #define CONFIG_JSON_SIZE (JSON_OBJECT_SIZE(20)) +// NVS namespace for WiFi credentials +#define WIFI_NVS_NAMESPACE "wifiCredentials" // 15 chars max. + // constructor wifiParametersMgt::wifiParametersMgt( void ) { @@ -342,6 +347,17 @@ void wifiParametersMgt::_applyDefaults( void ) { // Whole destruction option _opt_eraseALL = false; + /* + * [may.23] now trying to access wifi credentias NVS namespace + */ + Preferences nvs_area; + if( nvs_area.begin(WIFI_NVS_NAMESPACE,true) ) { // readonly mode + log_debug(F("\n[wifiParams] opened NVS WiFi credentials namespace ..."));log_flush(); + + // TO BE CONTINUED + + } + /* * finally structure is initialized */ -- GitLab