Skip to content

Commit 493e50f

Browse files
author
francois
committed
Realease 231027
1 parent f4685cd commit 493e50f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

ChangeLog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
# devices BUT not set as globally available for firmware upgrades
55
# (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
66

7+
8+
=== Release 231027 for esp32 only (Arduino Core ESP32 2.0.11)
9+
Added support to save WiFi credentials retrieved from JSON file to get automatically
10+
saved in NVS WiFi credentials area if this later does not already exists
11+
712
=== [jul.23] SDK upgrade ===
813
Updated to latest esp32 core Arduino (i.e 2.0.11)
914

neosensor/libraries/boards/neosensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
*/
4545
#define BOARD_NAME "neOSensor"
4646
#define BOARD_REVISION 1.2
47-
#define BOARD_FWREV 230528 // Firmware revision <year><month><day> in 2 digits each
47+
#define BOARD_FWREV 231027 // Firmware revision <year><month><day> in 2 digits each
4848

4949

5050

neosensor/libraries/neocampus/wifiParametersMgt.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,18 +569,19 @@ for (JsonObject::iterator it=root.begin(); it!=root.end(); ++it) {
569569
* their wifi credentials in the NVS area
570570
*/
571571
Preferences _nvs;
572-
if( _nvs.begin(WIFI_NVS_NAMESPACE,false) ) { // readwrite mode
573-
if( ! _nvs.isKey(WIFI_NVS_SSID_KEY) and ! _nvs.isKey(WIFI_NVS_PASS_KEY) ) {
574-
log_debug(F("\n[wifiParams] copying SSID credentials to NVS WiFi namespace ..."));log_flush();
572+
if( ! _nvs.begin(WIFI_NVS_NAMESPACE,true) ) { // read-only to check if it exists
573+
log_debug(F("\n[wifiParams] copying SSID credentials to NVS WiFi namespace ..."));log_flush();
574+
if( _nvs.begin(WIFI_NVS_NAMESPACE,false) ) { // open NVS WiFi credentials area in RW mode
575+
575576
if( _nvs.putBytes(WIFI_NVS_SSID_KEY,_ssid,strlen(_ssid)+1) != strlen(_ssid)+1 ) {
576577
log_error(F("\n[wifiParams] ERROR while saving SSID to NVS ?!?!"));log_flush();
577578
}
578579
if( _nvs.putBytes(WIFI_NVS_PASS_KEY,_pass,strlen(_pass)+1) != strlen(_pass)+1 ) {
579580
log_error(F("\n[wifiParams] ERROR while saving PASS to NVS ?!?!"));log_flush();
580581
}
582+
// close NVS namespace
583+
_nvs.end();
581584
}
582-
// close NVS namespace
583-
_nvs.end();
584585
}
585586
#endif /* ESP32 */
586587
return true;

0 commit comments

Comments
 (0)