From 80f215b66d0e0465ec824a7000046996813aa19d Mon Sep 17 00:00:00 2001
From: Francois <thiebolt@irit.fr>
Date: Mon, 29 May 2023 17:29:30 +0200
Subject: [PATCH] update

---
 ChangeLog.txt                                 |  3 ++-
 neosensor/libraries/neocampus/sensocampus.cpp | 19 ++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index c1de034c..606c0d59 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -5,7 +5,8 @@
 # (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
 
 
-=== Release 221225 / feature-NVSbackport (ESP32 NVS WiFiCredentials backport)
+=== Release 221225 / backport-NVSnamespace
+Note: temporary release only intended to neOSensors with FW <= 220815
 Based on Release 220815 / esp32 2.0.4 (because later releases broke the SPIFFS partitioning)
 - backport NVS namespace for WiFi credentials
 
diff --git a/neosensor/libraries/neocampus/sensocampus.cpp b/neosensor/libraries/neocampus/sensocampus.cpp
index 415f8cba..d55d42dd 100644
--- a/neosensor/libraries/neocampus/sensocampus.cpp
+++ b/neosensor/libraries/neocampus/sensocampus.cpp
@@ -10,10 +10,11 @@
  * ---
  * Notes:
  * ---
- * F.Thiebolt  aug.20   removed EEPROM support
+ * F.Thiebolt   may.23  add NVS support to save sensOCampus given credentials
+ * F.Thiebolt   aug.20  removed EEPROM support
  *                      added SPIFFS support to load/save config file
- * Thiebolt F. Nov.19   migrate to Arduino Json 6
- * Thiebolt F. July 17
+ * Thiebolt F.  Nov.19  migrate to Arduino Json 6
+ * Thiebolt F.  July 17
  * 
  */
 
@@ -27,6 +28,14 @@
   #include "SPIFFS.h"
 #endif
 
+/* NVS namespace @ EPS32 */
+#ifdef ESP32
+  #include "Preferences.h"          // NVS storage (instead of the DEPRECATED eeprom)
+#elif defined (ESP8266)
+  #warning "[esp8266] no NVS namespace available ... grab WiFi ssid/psk from last connection"
+#endif
+
+/* neOCampus related includes */
 #include "sensocampus.h"
 
 #include "neocampus_utils.h"
@@ -42,6 +51,10 @@
                                                         // note that config of various modules is NOT saved
 #define CONFIG_JSON_SIZE        (JSON_OBJECT_SIZE(20))  // used to parse sensOCampus config FILE
 
+// NVS namespace for WiFi credentials
+#define SENCO_NVS_NAMESPACE     "sensOCampus"  // 15 chars max.
+#define SENSO_MQTT_LOGIN_KEY    xxxxxxx
+#define SENSO_MQTT_PASS_KEY     yyyyyy
 
 
 
-- 
GitLab