Skip to content
Snippets Groups Projects
Commit 493e50fe authored by francois's avatar francois
Browse files

Realease 231027

parent f4685cdd
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
# devices BUT not set as globally available for firmware upgrades # devices BUT not set as globally available for firmware upgrades
# (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT # (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
=== Release 231027 for esp32 only (Arduino Core ESP32 2.0.11)
Added support to save WiFi credentials retrieved from JSON file to get automatically
saved in NVS WiFi credentials area if this later does not already exists
=== [jul.23] SDK upgrade === === [jul.23] SDK upgrade ===
Updated to latest esp32 core Arduino (i.e 2.0.11) Updated to latest esp32 core Arduino (i.e 2.0.11)
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
*/ */
#define BOARD_NAME "neOSensor" #define BOARD_NAME "neOSensor"
#define BOARD_REVISION 1.2 #define BOARD_REVISION 1.2
#define BOARD_FWREV 230528 // Firmware revision <year><month><day> in 2 digits each #define BOARD_FWREV 231027 // Firmware revision <year><month><day> in 2 digits each
......
...@@ -569,18 +569,19 @@ for (JsonObject::iterator it=root.begin(); it!=root.end(); ++it) { ...@@ -569,18 +569,19 @@ for (JsonObject::iterator it=root.begin(); it!=root.end(); ++it) {
* their wifi credentials in the NVS area * their wifi credentials in the NVS area
*/ */
Preferences _nvs; Preferences _nvs;
if( _nvs.begin(WIFI_NVS_NAMESPACE,false) ) { // readwrite mode if( ! _nvs.begin(WIFI_NVS_NAMESPACE,true) ) { // read-only to check if it exists
if( ! _nvs.isKey(WIFI_NVS_SSID_KEY) and ! _nvs.isKey(WIFI_NVS_PASS_KEY) ) { log_debug(F("\n[wifiParams] copying SSID credentials to NVS WiFi namespace ..."));log_flush();
log_debug(F("\n[wifiParams] copying SSID credentials to NVS WiFi namespace ..."));log_flush(); if( _nvs.begin(WIFI_NVS_NAMESPACE,false) ) { // open NVS WiFi credentials area in RW mode
if( _nvs.putBytes(WIFI_NVS_SSID_KEY,_ssid,strlen(_ssid)+1) != strlen(_ssid)+1 ) { if( _nvs.putBytes(WIFI_NVS_SSID_KEY,_ssid,strlen(_ssid)+1) != strlen(_ssid)+1 ) {
log_error(F("\n[wifiParams] ERROR while saving SSID to NVS ?!?!"));log_flush(); log_error(F("\n[wifiParams] ERROR while saving SSID to NVS ?!?!"));log_flush();
} }
if( _nvs.putBytes(WIFI_NVS_PASS_KEY,_pass,strlen(_pass)+1) != strlen(_pass)+1 ) { if( _nvs.putBytes(WIFI_NVS_PASS_KEY,_pass,strlen(_pass)+1) != strlen(_pass)+1 ) {
log_error(F("\n[wifiParams] ERROR while saving PASS to NVS ?!?!"));log_flush(); log_error(F("\n[wifiParams] ERROR while saving PASS to NVS ?!?!"));log_flush();
} }
// close NVS namespace
_nvs.end();
} }
// close NVS namespace
_nvs.end();
} }
#endif /* ESP32 */ #endif /* ESP32 */
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment