Skip to content

Commit

Permalink
Realease 231027
Browse files Browse the repository at this point in the history
  • Loading branch information
francois committed Oct 27, 2023
1 parent f4685cd commit 493e50f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# devices BUT not set as globally available for firmware upgrades
# (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 ===
Updated to latest esp32 core Arduino (i.e 2.0.11)

Expand Down
2 changes: 1 addition & 1 deletion neosensor/libraries/boards/neosensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
#define BOARD_NAME "neOSensor"
#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



Expand Down
11 changes: 6 additions & 5 deletions neosensor/libraries/neocampus/wifiParametersMgt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,18 +569,19 @@ for (JsonObject::iterator it=root.begin(); it!=root.end(); ++it) {
* their wifi credentials in the NVS area
*/
Preferences _nvs;
if( _nvs.begin(WIFI_NVS_NAMESPACE,false) ) { // readwrite mode
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();
if( ! _nvs.begin(WIFI_NVS_NAMESPACE,true) ) { // read-only to check if it exists
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 ) {
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 ) {
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 */
return true;
Expand Down

0 comments on commit 493e50f

Please sign in to comment.