File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 4
4
# devices BUT not set as globally available for firmware upgrades
5
5
# (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
6
6
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
+
7
12
=== [jul.23] SDK upgrade ===
8
13
Updated to latest esp32 core Arduino (i.e 2.0.11)
9
14
Original file line number Diff line number Diff line change 44
44
*/
45
45
#define BOARD_NAME "neOSensor"
46
46
#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
48
48
49
49
50
50
Original file line number Diff line number Diff line change @@ -569,18 +569,19 @@ for (JsonObject::iterator it=root.begin(); it!=root.end(); ++it) {
569
569
* their wifi credentials in the NVS area
570
570
*/
571
571
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
+
575
576
if ( _nvs.putBytes (WIFI_NVS_SSID_KEY,_ssid,strlen (_ssid)+1 ) != strlen (_ssid)+1 ) {
576
577
log_error (F (" \n [wifiParams] ERROR while saving SSID to NVS ?!?!" ));log_flush ();
577
578
}
578
579
if ( _nvs.putBytes (WIFI_NVS_PASS_KEY,_pass,strlen (_pass)+1 ) != strlen (_pass)+1 ) {
579
580
log_error (F (" \n [wifiParams] ERROR while saving PASS to NVS ?!?!" ));log_flush ();
580
581
}
582
+ // close NVS namespace
583
+ _nvs.end ();
581
584
}
582
- // close NVS namespace
583
- _nvs.end ();
584
585
}
585
586
#endif /* ESP32 */
586
587
return true ;
You can’t perform that action at this time.
0 commit comments