From b27e0320e48a1561c7a36d645d04645224dfe671 Mon Sep 17 00:00:00 2001
From: Francois <thiebolt@irit.fr>
Date: Thu, 11 Aug 2022 09:56:06 +0200
Subject: [PATCH] updated _http_get with WIFIClient newer API

---
 ChangeLog.txt                                 | 23 ++++++++++++++++++-
 ChangeLogHardware.txt                         |  4 +++-
 README.md                                     |  5 ++--
 arduinoIDE_esp8266_boards/boards.local.txt    |  2 ++
 .../libraries/neocampus/neocampus_utils.cpp   | 13 ++++++++---
 5 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index daf8bf8e..2d348cf9 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,25 @@
-(c) F.Thiebolt Université Toulouse3, Laboratoire IRIT
+#
+# neOCampus operation
+# (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
+
+=== upcoming feature-SDKupgrade
+Bumps to esp32 2.0.4
+Bumps to esp8266 3.0.2
+- we're still using the deprecated SPIFFS filesystem
+- updated boards.local.txt
+- _http_get now makes use of newer API involving a WIFIClient variable
+- uniformized sntp includes for all ESP :)
+    TBC that NTP servers sent by the DHCP server are in use
+- WIFImanager now used without mod
+    TBC that options appears valid when setting up the device
+- switched noise ISR from ICACHE_RAM_ATTR to newer IRAM_ATTR
+[esp32]
+- recompiled lwip for NTP server support from DHCP answer (IDF 4.4.2)
+[esp8266]
+- analogWrite now makes use of analogWriteRange set to 1023 to match previous
+defaults
+- setting up defaults parittionning IRAM to 32kb (usual defaults) in
+boards.local.txt
 
 === Release 220328
 - save WiFi credentials even if wrongly typed or end device has not been able
diff --git a/ChangeLogHardware.txt b/ChangeLogHardware.txt
index 85c5b98b..ae4ffde7 100644
--- a/ChangeLogHardware.txt
+++ b/ChangeLogHardware.txt
@@ -1,4 +1,6 @@
-(c) F.Thiebolt Université Toulouse3, Laboratoire IRIT
+#
+# neOCampus operation
+# (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT
 
 === (upcoming) HW Release neOSensorV5.2
 - add 0805 cap for those ESP32 that miss it on EN pin
diff --git a/README.md b/README.md
index 1d8ee1df..b5935cac 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ All this work was undertaken at Université Toulouse 3 / IRIT laboratory in the
 ![neOSensorv5](/images/neOSensorV5.jpg)
 
 ## NEWS ##
+ * **[Aug.22]** bumps to esp8266 3.0.2; bumps to esp32 2.0.4 along with recompiled lwip
  * **[Nov.21]** added support for various serial sensors like PMSx003, SDS011 and IKEA Vindriktning :D
  * **[Aug.21]** added support for digital inputs (PIR & switches)
 introduced the cooldown approach and data integration
@@ -39,8 +40,8 @@ First of all, you ought to install esp32, esp8266 or CubeCell support in your Ar
 
 | Device   | Release | Arduino Board Manager json file                                                                            |
 |----------|---------|------------------------------------------------------------------------------------------------------------|
-| esp8266  | 2.7.1   | https://arduino.esp8266.com/stable/package_esp8266com_index.json                                           |
-| esp32    | 1.0.6   | https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json                |
+| esp8266  | 3.0.2   | https://arduino.esp8266.com/stable/package_esp8266com_index.json                                           |
+| esp32    | 2.0.4   | https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json                |
 | CubeCell | *latest*  | https://github.com/HelTecAutomation/CubeCell-Arduino/releases/download/V1.3.0/package_CubeCell_index.json  |
 | stm32    | *latest*  | https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json             |
 
diff --git a/arduinoIDE_esp8266_boards/boards.local.txt b/arduinoIDE_esp8266_boards/boards.local.txt
index ca2df2a1..cdf2bc2e 100644
--- a/arduinoIDE_esp8266_boards/boards.local.txt
+++ b/arduinoIDE_esp8266_boards/boards.local.txt
@@ -26,6 +26,8 @@ neOSensor.build.vtable_flags=-DVTABLES_IN_FLASH
 neOSensor.build.exception_flags=-fno-exceptions
 neOSensor.build.stdcpp_lib=-lstdc++
 neOSensor.build.sslflags=
+# [aug.22] set default 32KB balanced IRAM / ICACHE
+neOSensor.build.mmuflags=-DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000
 neOSensor.build.debug_port=
 neOSensor.build.debug_level=
 
diff --git a/neosensor/libraries/neocampus/neocampus_utils.cpp b/neosensor/libraries/neocampus/neocampus_utils.cpp
index 64b53c24..429f61fb 100644
--- a/neosensor/libraries/neocampus/neocampus_utils.cpp
+++ b/neosensor/libraries/neocampus/neocampus_utils.cpp
@@ -245,15 +245,21 @@ bool setupWiFi( wifiParametersMgt *wp ) {
   // TM1637 7 segment display parameters
   WiFiManagerParameter p_sevenSegTM1637("sevenSegTM1637", "TM1637 7-seg (DIO=2,CLK=SCL)", "T", 2, _customHtml_checkbox, WFM_LABEL_AFTER);
   if( wp->isEnabled7segTM1637() ) {
-    // [Jun.18] HACK that requires modification in WiFiManager
+    WiFiManagerParameter p_sevenSegTM1637("sevenSegTM1637", "TM1637 7-seg (DIO=2,CLK=SCL)", "T", 2, _customHtml_checkbox_checked, WFM_LABEL_AFTER);
+    #warning "REMOVE HACK below !"
+    /* [Jun.18] HACK that requires modification in WiFiManager
     p_sevenSegTM1637._customHTML = _customHtml_checkbox_checked;
+    */
   }
   
   // PIR sensor
   WiFiManagerParameter p_PIRsensor("PIRsensor", "PIR sensor (pin=5)", "T", 2, _customHtml_checkbox, WFM_LABEL_AFTER);
   if( wp->isEnabledPIR() ) {
-    // [Jun.18] HACK that requires modification in WiFiManager
+    WiFiManagerParameter p_PIRsensor("PIRsensor", "PIR sensor (pin=5)", "T", 2, _customHtml_checkbox_checked, WFM_LABEL_AFTER);
+    #warning "REMOVE HACK below !"
+    /* [Jun.18] HACK that requires modification in WiFiManager
     p_PIRsensor._customHTML = _customHtml_checkbox_checked;
+    */
   }
 
   
@@ -503,9 +509,10 @@ const char *getCurTime( const char *fmt ) {
  */
 bool _http_get( const char *url, char *buf, size_t bufsize, const char *login, const char *passwd ) {
     
+  WiFiClient client;
   HTTPClient http;
 
-  http.begin(url);
+  http.begin(client, url);
   log_debug(F("\n[HTTP] GET url : ")); log_debug(url); log_flush();
   
   // authentication ?
-- 
GitLab