diff --git a/lib/I2Cdevlib/I2Cdev.h b/lib/I2Cdevlib/I2Cdev.h index 64fd942bd..500d49b5a 100644 --- a/lib/I2Cdevlib/I2Cdev.h +++ b/lib/I2Cdevlib/I2Cdev.h @@ -297,11 +297,11 @@ class I2Cdev { //#define _SFR_BYTE(sfr) _MMIO_BYTE(_SFR_ADDR(sfr)) #ifndef sbi // set bit - #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= (1 << bit)) + #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= (1 << (bit))) #endif // sbi #ifndef cbi // clear bit - #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~(1 << bit)) + #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~(1 << (bit))) #endif // cbi extern TwoWire Wire; diff --git a/platformio.ini b/platformio.ini index 507868fe2..2b21f42eb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -82,7 +82,6 @@ extra_scripts = tools/pio/gzip-firmware.py [common] -lib_ldf_mode = deep+ lib_archive = false framework = arduino upload_speed = 115200 diff --git a/platformio_core_defs.ini b/platformio_core_defs.ini index 998988baf..bf2984204 100644 --- a/platformio_core_defs.ini +++ b/platformio_core_defs.ini @@ -68,6 +68,7 @@ build_flags = ${esp82xx_2_6_x.build_flags} -DCORE_POST_3_0_0 -Wno-deprecated-declarations -Werror=return-type + -DFS_NO_GLOBALS lib_ignore = ${esp82xx_defaults.lib_ignore} @@ -116,6 +117,7 @@ platform_packages = build_flags = ${esp82xx_2_6_x.build_flags} -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 -Wno-deprecated-declarations +lib_ignore = ${esp82xx_defaults.lib_ignore}, IRremoteESP8266, HeatpumpIR, LittleFS(esp8266), ServoESP32, TinyWireM ; Core with alternative WiFi for nodes not running stable wifi or slow network response ; e.g. Sonoff Basic R2. @@ -127,6 +129,7 @@ platform_packages = build_flags = ${esp82xx_2_6_x.build_flags} -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191122 -Wno-deprecated-declarations +lib_ignore = ${esp82xx_defaults.lib_ignore}, IRremoteESP8266, HeatpumpIR, LittleFS(esp8266), ServoESP32, TinyWireM [core_3_0_2] extends = esp82xx_3_0_x diff --git a/platformio_esp82xx_base.ini b/platformio_esp82xx_base.ini index bc8e62e79..0178b768c 100644 --- a/platformio_esp82xx_base.ini +++ b/platformio_esp82xx_base.ini @@ -34,7 +34,7 @@ lib_ignore = ${core_stage.lib_ignore} lib_ignore = IRremoteESP8266, HeatpumpIR [no_sd] -lib_ignore = SD(esp8266), SDFS +lib_ignore = SD(esp8266), SD, SDFS [no_littlefs] lib_ignore = LittleFS(esp8266) @@ -49,7 +49,7 @@ build_flags = ${debug_flags.build_flags} -DHTTPCLIENT_1_1_COMPATIBLE=0 build_unflags = -DDEBUG_ESP_PORT -fexceptions -lib_deps = td-er/ESPeasySerial @ 2.0.8, I2Cdevlib-Core, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, adafruit/Adafruit BusIO @ ^1.10.0, bblanchon/ArduinoJson @ ^6.17.2, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/RABurton ESP8266 Mutex @ ^1.0.2, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1, ESP8266HTTPUpdateServer, FrogmoreScd30, Multi Channel Relay Arduino Library, SparkFun ADXL345 Arduino Library, ITG3205 +lib_deps = td-er/ESPeasySerial @ 2.0.8, I2Cdevlib-Core, ESP8266WebServer, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, adafruit/Adafruit BusIO @ ^1.10.0, bblanchon/ArduinoJson @ ^6.17.2, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/RABurton ESP8266 Mutex @ ^1.0.2, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1, ESP8266HTTPUpdateServer, FrogmoreScd30, Multi Channel Relay Arduino Library, SparkFun ADXL345 Arduino Library, ITG3205 lib_ignore = ${esp82xx_defaults.lib_ignore}, IRremoteESP8266, HeatpumpIR, LittleFS(esp8266), ServoESP32, TinyWireM monitor_filters = esp8266_exception_decoder extra_scripts = pre:tools/pio/pre_default_check.py @@ -65,20 +65,20 @@ extra_scripts = pre:tools/pio/pre_default_check.py platform = ${regular_platform.platform} platform_packages = ${regular_platform.platform_packages} build_flags = ${regular_platform.build_flags} -lib_ignore = ${regular_platform.lib_ignore} SD(esp8266), SDFS +lib_ignore = ${regular_platform.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) [normal_alt_wifi] platform = ${regular_platform_alt_wifi.platform} platform_packages = ${regular_platform_alt_wifi.platform_packages} build_flags = ${regular_platform_alt_wifi.build_flags} -lib_ignore = ${regular_platform_alt_wifi.lib_ignore} SD(esp8266), SDFS +lib_ignore = ${regular_platform_alt_wifi.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) [normal_beta] platform = ${beta_platform.platform} platform_packages = ${beta_platform.platform_packages} build_flags = ${beta_platform.build_flags} -lib_ignore = ${beta_platform.lib_ignore} SD(esp8266), SDFS +lib_ignore = ${beta_platform.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) ;;; TEST ************************************************************* @@ -116,13 +116,13 @@ lib_ignore = ${beta_platform.lib_ignore} platform = ${regular_platform.platform} platform_packages = ${regular_platform.platform_packages} build_flags = ${regular_platform.build_flags} -lib_ignore = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, SD(esp8266), SDFS, LittleFS(esp8266) +lib_ignore = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, SD(esp8266), SD, SDFS, LittleFS(esp8266) [ir_alt_wifi] platform = ${regular_platform_alt_wifi.platform} platform_packages = ${regular_platform_alt_wifi.platform_packages} build_flags = ${regular_platform_alt_wifi.build_flags} -lib_ignore = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, SD(esp8266), SDFS, LittleFS(esp8266) +lib_ignore = ${ir.lib_ignore} [minimal_ir] diff --git a/platformio_esp82xx_envs.ini b/platformio_esp82xx_envs.ini index 16fa23038..28dcf0761 100644 --- a/platformio_esp82xx_envs.ini +++ b/platformio_esp82xx_envs.ini @@ -199,6 +199,8 @@ platform = ${regular_platform_alt_wifi.platform} platform_packages = ${regular_platform_alt_wifi.platform_packages} build_flags = ${regular_platform_alt_wifi.build_flags} ${esp8266_1M.build_flags} +lib_ignore = ${regular_platform_alt_wifi.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) + ;[env:normal_302_ESP8266_1M] ;extends = esp8266_1M @@ -223,6 +225,8 @@ platform_packages = ${regular_platform_alt_wifi.platform_packages} build_flags = ${regular_platform_alt_wifi.build_flags} ${esp8266_1M.build_flags} -D FEATURE_ADC_VCC=true +lib_ignore = ${regular_platform_alt_wifi.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) + ; NORMAL: 1024k for esp8285 ---------------------- @@ -265,6 +269,8 @@ platform = ${regular_platform_alt_wifi.platform} platform_packages = ${regular_platform_alt_wifi.platform_packages} build_flags = ${regular_platform_alt_wifi.build_flags} ${esp8266_4M1M.build_flags} +lib_ignore = ${regular_platform_alt_wifi.lib_ignore}, SD(esp8266), SD, SDFS, LittleFS(esp8266) + @@ -274,6 +280,7 @@ platform = ${core_3_0_2.platform} platform_packages = ${core_3_0_2.platform_packages} build_flags = ${core_3_0_2.build_flags} ${esp8266_4M1M.build_flags} +lib_ignore = ${core_3_0_2.lib_ignore}, SD, SDFS, LittleFS(esp8266) [env:normal_beta_ESP8266_4M1M] extends = esp8266_4M1M @@ -281,6 +288,7 @@ platform = ${normal_beta.platform} platform_packages = ${normal_beta.platform_packages} build_flags = ${normal_beta.build_flags} ${esp8266_4M1M.build_flags} +lib_ignore = ${normal_beta.lib_ignore}, SD, SDFS, LittleFS(esp8266) ; NORMAL: 16M version --- LittleFS -------------- ; LittleFS is determined by using "LittleFS" in the pio env name @@ -291,7 +299,7 @@ platform_packages = ${normal_beta.platform_packages} build_flags = ${normal_beta.build_flags} ${esp8266_16M.build_flags} -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y -lib_ignore = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, IRremoteESP8266, HeatpumpIR +lib_ignore = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, IRremoteESP8266, HeatpumpIR, SD, SDFS @@ -384,9 +392,9 @@ build_flags = ${core_3_0_2.build_flags} ; Minimal set of other plugins [env:minimal_IRext_ESP8266_1M] extends = esp8266_1M -platform = ${minimal_ir_extended.platform} -platform_packages = ${minimal_ir_extended.platform_packages} -lib_ignore = ${minimal_ir_extended.lib_ignore} +platform = ${ir.platform} +platform_packages = ${ir.platform_packages} +lib_ignore = ${ir.lib_ignore} build_flags = ${minimal_ir_extended.build_flags} ${esp8266_1M.build_flags} build_unflags = ${esp8266_1M_OTA.build_unflags} -DPLUGIN_BUILD_NORMAL_IR @@ -398,18 +406,18 @@ build_unflags = ${esp8266_1M_OTA.build_unflags} -DPLUGIN_BUILD_NORMA ; 4M flash, 1M SPIFFS [env:minimal_IRext_ESP8266_4M1M] extends = esp8266_4M1M -platform = ${minimal_ir_extended.platform} -platform_packages = ${minimal_ir_extended.platform_packages} -lib_ignore = ${minimal_ir_extended.lib_ignore} +platform = ${ir.platform} +platform_packages = ${ir.platform_packages} +lib_ignore = ${ir.lib_ignore} build_flags = ${minimal_ir_extended.build_flags} ${esp8266_4M1M.build_flags} ; 4M flash, 2M SPIFFS [env:minimal_IRext_ESP8266_4M2M] extends = esp8266_4M2M -platform = ${minimal_ir_extended.platform} -platform_packages = ${minimal_ir_extended.platform_packages} -lib_ignore = ${minimal_ir_extended.lib_ignore} +platform = ${ir.platform} +platform_packages = ${ir.platform_packages} +lib_ignore = ${ir.lib_ignore} build_flags = ${minimal_ir_extended.build_flags} ${esp8266_4M2M.build_flags} @@ -420,9 +428,9 @@ build_flags = ${minimal_ir_extended.build_flags} ; 4M flash, 2M SPIFFS [env:normal_IRext_no_rx_ESP8266_4M2M] extends = esp8266_4M2M -platform = ${normal_ir_extended_no_rx.platform} -platform_packages = ${normal_ir_extended_no_rx.platform_packages} -lib_ignore = ${normal_ir_extended_no_rx.lib_ignore} +platform = ${ir.platform} +platform_packages = ${ir.platform_packages} +lib_ignore = ${ir.lib_ignore} build_flags = ${normal_ir_extended_no_rx.build_flags} ${esp8266_4M2M.build_flags} -DLIMIT_BUILD_SIZE diff --git a/platformio_special_envs.ini b/platformio_special_envs.ini index 3b351aa56..5f82f904b 100644 --- a/platformio_special_envs.ini +++ b/platformio_special_envs.ini @@ -43,7 +43,7 @@ build_flags = ${beta_platform.build_flags} ${debug_pio.build_flags} ${esp8266_4M1M.build_flags} -DPLUGIN_BUILD_CUSTOM -lib_ignore = ${regular_platform.lib_ignore}, IRremoteESP8266, HeatpumpIR, SD(esp8266), SDFS, LittleFS(esp8266) +lib_ignore = ${regular_platform.lib_ignore}, IRremoteESP8266, HeatpumpIR, SD(esp8266), SD, SDFS, LittleFS(esp8266) extra_scripts = ${extra_scripts_esp8266.extra_scripts} diff --git a/src/ESPEasy_common.h b/src/ESPEasy_common.h index dce90ef0d..57a257ad8 100644 --- a/src/ESPEasy_common.h +++ b/src/ESPEasy_common.h @@ -66,7 +66,9 @@ namespace std #include "src/Globals/RamTracker.h" -#define FS_NO_GLOBALS +#ifndef FS_NO_GLOBALS + #define FS_NO_GLOBALS +#endif #if defined(ESP8266) #ifndef CORE_POST_3_0_0 @@ -142,7 +144,6 @@ namespace std #include // Needed to call ESP-IDF functions like esp_wifi_.... #endif - #ifdef USE_LITTLEFS #ifdef ESP32 #if ESP_IDF_VERSION_MAJOR >= 4 diff --git a/src/_P099_XPT2046Touch.ino b/src/_P099_XPT2046Touch.ino index 1e9494680..3f71f5158 100644 --- a/src/_P099_XPT2046Touch.ino +++ b/src/_P099_XPT2046Touch.ino @@ -360,7 +360,7 @@ boolean Plugin_099(uint8_t function, struct EventStruct *event, String& string) addHtmlError(error); } #ifdef PLUGIN_099_DEBUG - if (logLevelActiveFor(LOG_LEVEL_INFO)) { + if (loglevelActiveFor(LOG_LEVEL_INFO)) { String log = F("p099_data save size: "); log += sizeof(P099_data->StoredSettings); addLogMove(LOG_LEVEL_INFO, log); diff --git a/src/_P118_Itho.ino b/src/_P118_Itho.ino index d98c8b413..cb8e5de5b 100644 --- a/src/_P118_Itho.ino +++ b/src/_P118_Itho.ino @@ -99,9 +99,22 @@ volatile bool PLUGIN_118_Int = false; #define PLUGIN_VALUENAME3_118 "LastIDindex" // Timer values for hardware timer in Fan in seconds -#define PLUGIN_118_Time1 10 * 60 -#define PLUGIN_118_Time2 20 * 60 -#define PLUGIN_118_Time3 30 * 60 +#define PLUGIN_118_Time1 (10 * 60) +#define PLUGIN_118_Time2 (20 * 60) +#define PLUGIN_118_Time3 (30 * 60) + +// Forward declarations +void PLUGIN_118_ITHOcheck(); +void PLUGIN_118_Publishdata(struct EventStruct *event); +void PLUGIN_118_PluginWriteLog(const String& command); + +ICACHE_RAM_ATTR void PLUGIN_118_ITHOinterrupt() +{ + PLUGIN_118_Int = true; // flag + // PLUGIN_118_Int_time = millis(); //used to register time since interrupt, to make sure we don't read within 10 ms as the RX buffer needs + // some time to get ready. Update: Disabled as it appear not necessary +} + boolean Plugin_118(byte function, struct EventStruct *event, String& string) { @@ -420,13 +433,6 @@ boolean Plugin_118(byte function, struct EventStruct *event, String& string) return success; } -ICACHE_RAM_ATTR void PLUGIN_118_ITHOinterrupt() -{ - PLUGIN_118_Int = true; // flag - // PLUGIN_118_Int_time = millis(); //used to register time since interrupt, to make sure we don't read within 10 ms as the RX buffer needs - // some time to get ready. Update: Disabled as it appear not necessary -} - void PLUGIN_118_ITHOcheck() { #ifndef BUILD_NO_DEBUG @@ -564,7 +570,7 @@ void PLUGIN_118_Publishdata(struct EventStruct *event) #ifndef BUILD_NO_DEBUG - if (logLevelActiveFor(LOG_LEVEL_DEBUG)) { + if (loglevelActiveFor(LOG_LEVEL_DEBUG)) { String log = F("State: "); log += UserVar[event->BaseVarIndex]; addLogMove(LOG_LEVEL_DEBUG, log); diff --git a/src/_Plugin_Helper.h b/src/_Plugin_Helper.h index 15663ca96..3d4b0e5c3 100644 --- a/src/_Plugin_Helper.h +++ b/src/_Plugin_Helper.h @@ -26,6 +26,7 @@ #include "src/Globals/Plugins.h" #include "src/Globals/RuntimeData.h" #include "src/Globals/Settings.h" +#include "src/Globals/Services.h" #include "src/Helpers/_Plugin_init.h" #include "src/Helpers/ESPEasy_math.h" diff --git a/src/src/Commands/SDCARD.cpp b/src/src/Commands/SDCARD.cpp index 3f60f4067..51d030da9 100644 --- a/src/src/Commands/SDCARD.cpp +++ b/src/src/Commands/SDCARD.cpp @@ -13,7 +13,7 @@ #include -void printDirectory(File dir, int numTabs) +void printDirectory(fs::File dir, int numTabs) { while (true) { File entry = dir.openNextFile(); diff --git a/src/src/Commands/SDCARD.h b/src/src/Commands/SDCARD.h index bce64bc53..ca48f61fb 100644 --- a/src/src/Commands/SDCARD.h +++ b/src/src/Commands/SDCARD.h @@ -6,7 +6,7 @@ #include -void printDirectory(File dir, int numTabs); +void printDirectory(fs::File dir, int numTabs); const __FlashStringHelper * Command_SD_LS(struct EventStruct *event, const char* Line); String Command_SD_Remove(struct EventStruct *event, const char* Line); diff --git a/src/src/DataStructs/RTC_cache_handler_struct.h b/src/src/DataStructs/RTC_cache_handler_struct.h index 9984011c6..040d7535f 100644 --- a/src/src/DataStructs/RTC_cache_handler_struct.h +++ b/src/src/DataStructs/RTC_cache_handler_struct.h @@ -86,9 +86,9 @@ private: RTC_cache_struct RTC_cache; std::vectorRTC_cache_data; #endif - File fw; - File fr; - File fp; + fs::File fw; + fs::File fr; + fs::File fp; size_t peekfilenr = 0; size_t peekreadpos = 0; diff --git a/src/src/ESPEasyCore/ESPEasyRules.cpp b/src/src/ESPEasyCore/ESPEasyRules.cpp index dfd79e70c..313cbb51c 100644 --- a/src/src/ESPEasyCore/ESPEasyRules.cpp +++ b/src/src/ESPEasyCore/ESPEasyRules.cpp @@ -25,6 +25,7 @@ #include +#include boolean activeRuleSets[RULESETS_MAX]; diff --git a/src/src/ESPEasyCore/ESPEasyWifi.h b/src/src/ESPEasyCore/ESPEasyWifi.h index 522057353..a2fbdddbe 100644 --- a/src/src/ESPEasyCore/ESPEasyWifi.h +++ b/src/src/ESPEasyCore/ESPEasyWifi.h @@ -5,11 +5,9 @@ #if defined(ESP8266) # include - # include #endif // if defined(ESP8266) #if defined(ESP32) # include - # include #endif // if defined(ESP32) #include "../DataTypes/WiFiConnectionProtocol.h" diff --git a/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp b/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp index 6eeb5a1ef..ee853296d 100644 --- a/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp +++ b/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp @@ -13,6 +13,12 @@ #include "../Helpers/Networking.h" +#ifdef FEATURE_ARDUINO_OTA +#include "../Helpers/OTA.h" +#endif + + + /*********************************************************************************************\ * run background tasks \*********************************************************************************************/ @@ -80,7 +86,7 @@ void backgroundtasks() #ifdef FEATURE_ARDUINO_OTA if (Settings.ArduinoOTAEnable) { - ArduinoOTA.handle(); + ArduinoOTA_handle(); } // once OTA is triggered, only handle that and dont do other stuff. (otherwise it fails) @@ -88,7 +94,7 @@ void backgroundtasks() { delay(0); - ArduinoOTA.handle(); + ArduinoOTA_handle(); } #endif // ifdef FEATURE_ARDUINO_OTA diff --git a/src/src/Globals/NPlugins.cpp b/src/src/Globals/NPlugins.cpp index c3f4978cb..f14b19a78 100644 --- a/src/src/Globals/NPlugins.cpp +++ b/src/src/Globals/NPlugins.cpp @@ -12,7 +12,7 @@ nprotocolIndex_t INVALID_NPROTOCOL_INDEX = NPLUGIN_MAX; bool (*NPlugin_ptr[NPLUGIN_MAX])(NPlugin::Function, struct EventStruct *, String&); -npluginID_t NPlugin_id[NPLUGIN_MAX]; +npluginID_t NPlugin_id[NPLUGIN_MAX] = { INVALID_N_PLUGIN_ID }; NotificationStruct Notification[NPLUGIN_MAX]; @@ -110,6 +110,8 @@ bool addNPlugin(npluginID_t npluginID, nprotocolIndex_t x) { // FIXME TD-er: Must add lookup for notification plugins too // ProtocolIndex_to_NPlugin_id[x] = npluginID; // NPlugin_id_to_ProtocolIndex[npluginID] = x; + + NPlugin_id[x] = npluginID; return true; } /* diff --git a/src/src/Globals/Plugins.cpp b/src/src/Globals/Plugins.cpp index ccb593976..7a617588b 100644 --- a/src/src/Globals/Plugins.cpp +++ b/src/src/Globals/Plugins.cpp @@ -29,7 +29,7 @@ #include "../Helpers/StringConverter.h" #include "../Helpers/StringParser.h" - +#include int deviceCount = -1; diff --git a/src/src/Globals/RamTracker.cpp b/src/src/Globals/RamTracker.cpp index 9091f9713..9e846d3ff 100644 --- a/src/src/Globals/RamTracker.cpp +++ b/src/src/Globals/RamTracker.cpp @@ -51,18 +51,23 @@ void checkRAM(const __FlashStringHelper * descr ) { void checkRAM(const String& descr ) { if (Settings.EnableRAMTracking()) myRamTracker.registerRamState(descr); - - uint32_t freeRAM = FreeMem(); + + const uint32_t freeStack = getFreeStackWatermark(); + if (freeStack <= lowestFreeStack) { + lowestFreeStack = freeStack; + lowestFreeStackfunction = descr; + } + +#ifdef ESP32 + const uint32_t freeRAM = ESP.getMinFreeHeap(); +#else + const uint32_t freeRAM = FreeMem(); +#endif if (freeRAM <= lowestRAM) { lowestRAM = freeRAM; lowestRAMfunction = std::move(descr); } - uint32_t freeStack = getFreeStackWatermark(); - if (freeStack <= lowestFreeStack) { - lowestFreeStack = freeStack; - lowestFreeStackfunction = std::move(descr); - } } diff --git a/src/src/Globals/Services.h b/src/src/Globals/Services.h index bebae4f04..9095cc725 100644 --- a/src/src/Globals/Services.h +++ b/src/src/Globals/Services.h @@ -3,13 +3,6 @@ #include "../../ESPEasy_common.h" -#ifdef FEATURE_ARDUINO_OTA - //enable Arduino OTA updating. - //Note: This adds around 10kb to the firmware size, and 1kb extra ram. - #include - - extern bool ArduinoOTAtriggered; -#endif #ifdef FEATURE_MDNS //enable mDNS mode (adds about 6kb ram and some bytes IRAM) @@ -49,6 +42,13 @@ #endif +#ifdef FEATURE_ARDUINO_OTA + //enable Arduino OTA updating. + //Note: This adds around 10kb to the firmware size, and 1kb extra ram. + extern bool ArduinoOTAtriggered; +#endif + + #ifdef FEATURE_DNS_SERVER #include extern DNSServer dnsServer; diff --git a/src/src/Helpers/Dallas1WireHelper.cpp b/src/src/Helpers/Dallas1WireHelper.cpp index dc18460ca..c3a0b277e 100644 --- a/src/src/Helpers/Dallas1WireHelper.cpp +++ b/src/src/Helpers/Dallas1WireHelper.cpp @@ -14,6 +14,7 @@ # define ESP32interrupts() portEXIT_CRITICAL(&mux); } #endif // if defined(ESP32) +#include unsigned char ROM_NO[8]; uint8_t LastDiscrepancy; diff --git a/src/src/Helpers/ESPEasy_Storage.cpp b/src/src/Helpers/ESPEasy_Storage.cpp index c6ed40f15..b7f4af04f 100644 --- a/src/src/Helpers/ESPEasy_Storage.cpp +++ b/src/src/Helpers/ESPEasy_Storage.cpp @@ -1515,7 +1515,7 @@ bool getCacheFileCounters(uint16_t& lowest, uint16_t& highest, size_t& filesizeH highest = 0; filesizeHighest = 0; #ifdef ESP8266 - Dir dir = ESPEASY_FS.openDir(F("cache")); + fs::Dir dir = ESPEASY_FS.openDir(F("cache")); while (dir.next()) { String filename = dir.fileName(); @@ -1534,8 +1534,8 @@ bool getCacheFileCounters(uint16_t& lowest, uint16_t& highest, size_t& filesizeH } #endif // ESP8266 #ifdef ESP32 - File root = ESPEASY_FS.open(F("/")); - File file = root.openNextFile(); + fs::File root = ESPEASY_FS.open(F("/")); + fs::File file = root.openNextFile(); while (file) { diff --git a/src/src/Helpers/ESPEasy_time.cpp b/src/src/Helpers/ESPEasy_time.cpp index 41917af45..73b263fce 100644 --- a/src/src/Helpers/ESPEasy_time.cpp +++ b/src/src/Helpers/ESPEasy_time.cpp @@ -807,7 +807,9 @@ bool ESPEasy_time::ExtRTC_set(uint32_t unixtime) // Do not adjust the external RTC time if we already used it as a time source. return true; } + #ifdef USE_EXT_RTC bool timeAdjusted = false; + #endif switch (Settings.ExtTimeSource()) { case ExtTimeSource_e::None: return false; @@ -860,12 +862,14 @@ bool ESPEasy_time::ExtRTC_set(uint32_t unixtime) break; } } + #ifdef USE_EXT_RTC if (timeAdjusted) { String log = F("ExtRTC: External time source set to: "); log += unixtime; addLogMove(LOG_LEVEL_INFO, log); return true; } + #endif addLog(LOG_LEVEL_ERROR, F("ExtRTC: Cannot set time to external time source")); return false; } diff --git a/src/src/Helpers/FS_Helper.h b/src/src/Helpers/FS_Helper.h index 8ced8f9f4..2a982b4d6 100644 --- a/src/src/Helpers/FS_Helper.h +++ b/src/src/Helpers/FS_Helper.h @@ -8,7 +8,9 @@ // Macro used to make file system operations a bit more readable. #define SPIFFS_CHECK(result, fname) if (!(result)) { return(FileError(__LINE__, fname)); } -#define FS_NO_GLOBALS +#ifndef FS_NO_GLOBALS + #define FS_NO_GLOBALS +#endif #if defined(ESP8266) extern "C" { #include diff --git a/src/src/Helpers/Hardware.cpp b/src/src/Helpers/Hardware.cpp index 76ffcf380..abdf06b54 100644 --- a/src/src/Helpers/Hardware.cpp +++ b/src/src/Helpers/Hardware.cpp @@ -44,6 +44,11 @@ #endif + +#ifdef FEATURE_SD +#include +#endif + /********************************************************************************************\ * Initialize specific hardware settings (only global ones, others are set through devices) \*********************************************************************************************/ diff --git a/src/src/Helpers/Hardware.h b/src/src/Helpers/Hardware.h index c8a31d226..cb9b79528 100644 --- a/src/src/Helpers/Hardware.h +++ b/src/src/Helpers/Hardware.h @@ -13,9 +13,6 @@ #include "../../ESPEasy_common.h" -#ifdef FEATURE_SD -#include -#endif /********************************************************************************************\ * Initialize specific hardware settings (only global ones, others are set through devices) diff --git a/src/src/Helpers/Misc.cpp b/src/src/Helpers/Misc.cpp index 51d008636..43dda898e 100644 --- a/src/src/Helpers/Misc.cpp +++ b/src/src/Helpers/Misc.cpp @@ -14,6 +14,10 @@ #include "../Helpers/StringConverter.h" #include "../Helpers/StringParser.h" +#ifdef FEATURE_SD +#include +#endif + bool remoteConfig(struct EventStruct *event, const String& string) { diff --git a/src/src/Helpers/Misc.h b/src/src/Helpers/Misc.h index c008d9970..48cc6d0bf 100644 --- a/src/src/Helpers/Misc.h +++ b/src/src/Helpers/Misc.h @@ -10,10 +10,6 @@ #include "../../ESPEasy_common.h" -#ifdef FEATURE_SD -#include -#endif - bool remoteConfig(struct EventStruct *event, const String & string); diff --git a/src/src/Helpers/Networking.cpp b/src/src/Helpers/Networking.cpp index 126355743..2449560cd 100644 --- a/src/src/Helpers/Networking.cpp +++ b/src/src/Helpers/Networking.cpp @@ -64,6 +64,7 @@ void etharp_gratuitous_r(struct netif *netif) { # endif // ifdef ESP32 #endif // USE_SETTINGS_ARCHIVE +#include /*********************************************************************************************\ Syslog client diff --git a/src/src/Helpers/OTA.cpp b/src/src/Helpers/OTA.cpp index 52be2f69d..39a18c7aa 100644 --- a/src/src/Helpers/OTA.cpp +++ b/src/src/Helpers/OTA.cpp @@ -8,6 +8,13 @@ #include "../Helpers/Hardware.h" #include "../Helpers/Misc.h" +#ifdef FEATURE_ARDUINO_OTA + //enable Arduino OTA updating. + //Note: This adds around 10kb to the firmware size, and 1kb extra ram. + #include +#endif + + bool OTA_possible(uint32_t& maxSketchSize, bool& use2step) { #if defined(ESP8266) @@ -106,4 +113,9 @@ void ArduinoOTAInit() } } +void ArduinoOTA_handle() +{ + ArduinoOTA.handle(); +} + #endif // ifdef FEATURE_ARDUINO_OTA diff --git a/src/src/Helpers/OTA.h b/src/src/Helpers/OTA.h index 6485ea2ba..20ccc93bd 100644 --- a/src/src/Helpers/OTA.h +++ b/src/src/Helpers/OTA.h @@ -14,6 +14,8 @@ bool OTA_possible(uint32_t& maxSketchSize, void ArduinoOTAInit(); +void ArduinoOTA_handle(); + #endif // ifdef FEATURE_ARDUINO_OTA diff --git a/src/src/Helpers/StringConverter.cpp b/src/src/Helpers/StringConverter.cpp index 2905b0fa6..722cb57d8 100644 --- a/src/src/Helpers/StringConverter.cpp +++ b/src/src/Helpers/StringConverter.cpp @@ -263,7 +263,7 @@ void addNewLine(String& line) { line += F("\r\n"); } -size_t UTF8_charLength(char firstByte) { +size_t UTF8_charLength(uint8_t firstByte) { if (firstByte <= 0x7f) { return 1; } @@ -291,7 +291,7 @@ size_t UTF8_charLength(char firstByte) { void replaceUnicodeByChar(String& line, char replChar) { size_t pos = 0; while (pos < line.length()) { - const size_t charLength = UTF8_charLength(line[pos]); + const size_t charLength = UTF8_charLength((uint8_t)line[pos]); if (charLength > 1) { // Is unicode char in UTF-8 format diff --git a/src/src/Helpers/StringConverter.h b/src/src/Helpers/StringConverter.h index 572e45d02..c23c1cec7 100644 --- a/src/src/Helpers/StringConverter.h +++ b/src/src/Helpers/StringConverter.h @@ -96,7 +96,7 @@ void removeExtraNewLine(String& line); void addNewLine(String& line); -size_t UTF8_charLength(char firstByte); +size_t UTF8_charLength(uint8_t firstByte); void replaceUnicodeByChar(String& line, char replChar); diff --git a/src/src/Helpers/_CPlugin_Helper.h b/src/src/Helpers/_CPlugin_Helper.h index 906918539..5c5f107f7 100644 --- a/src/src/Helpers/_CPlugin_Helper.h +++ b/src/src/Helpers/_CPlugin_Helper.h @@ -12,6 +12,7 @@ #include "../ESPEasyCore/ESPEasyNetwork.h" #include "../Globals/CPlugins.h" #include "../Globals/ESPEasy_Scheduler.h" +#include "../Globals/Services.h" #include "../Helpers/_CPlugin_init.h" #include "../Helpers/Misc.h" #include "../Helpers/Network.h" diff --git a/src/src/PluginStructs/P016_data_struct.h b/src/src/PluginStructs/P016_data_struct.h index 4d117db97..e7e7ca033 100644 --- a/src/src/PluginStructs/P016_data_struct.h +++ b/src/src/PluginStructs/P016_data_struct.h @@ -6,6 +6,8 @@ # include +#include + # define PLUGIN_016_DEBUG // additional debug messages in the log // bit definition in PCONFIG_LONG(0) diff --git a/src/src/PluginStructs/P087_data_struct.cpp b/src/src/PluginStructs/P087_data_struct.cpp index d8e6f8b34..b37c55126 100644 --- a/src/src/PluginStructs/P087_data_struct.cpp +++ b/src/src/PluginStructs/P087_data_struct.cpp @@ -9,6 +9,7 @@ #ifdef USES_P087 +#include P087_data_struct::P087_data_struct() : easySerial(nullptr) {} diff --git a/src/src/PluginStructs/P104_data_struct.h b/src/src/PluginStructs/P104_data_struct.h index 3217f4dd1..7f76af022 100644 --- a/src/src/PluginStructs/P104_data_struct.h +++ b/src/src/PluginStructs/P104_data_struct.h @@ -17,6 +17,8 @@ # include "../Helpers/Misc.h" # include "../Helpers/StringParser.h" +# include + # if defined(PLUGIN_SET_MAX) || defined(PLUGIN_BUILD_CUSTOM) # define P104_USE_NUMERIC_DOUBLEHEIGHT_FONT // Enables double height numeric font for double-height time/date # endif // if defined(PLUGIN_SET_MAX) || defined(PLUGIN_BUILD_CUSTOM) diff --git a/src/src/PluginStructs/P120_data_struct.h b/src/src/PluginStructs/P120_data_struct.h index aaf79f16d..f54fa0f86 100644 --- a/src/src/PluginStructs/P120_data_struct.h +++ b/src/src/PluginStructs/P120_data_struct.h @@ -6,6 +6,8 @@ # include "../Globals/EventQueue.h" +# include + # include // Needed for I2C // https://github.com/sparkfun/SparkFun_ADXL345_Arduino_Library # include diff --git a/src/src/WebServer/FileList.cpp b/src/src/WebServer/FileList.cpp index 9add08330..31d4a6fa4 100644 --- a/src/src/WebServer/FileList.cpp +++ b/src/src/WebServer/FileList.cpp @@ -19,6 +19,10 @@ #include "../Globals/C016_ControllerCache.h" #endif +#ifdef FEATURE_SD +#include +#endif + #ifdef WEBSERVER_NEW_UI diff --git a/src/src/WebServer/FileList.h b/src/src/WebServer/FileList.h index f86377e2c..b3222d9f3 100644 --- a/src/src/WebServer/FileList.h +++ b/src/src/WebServer/FileList.h @@ -3,10 +3,6 @@ #include "../WebServer/common.h" -#ifdef FEATURE_SD -#include -#endif - #ifdef WEBSERVER_NEW_UI diff --git a/src/src/WebServer/I2C_Scanner.h b/src/src/WebServer/I2C_Scanner.h index fff7e273e..afc472d5b 100644 --- a/src/src/WebServer/I2C_Scanner.h +++ b/src/src/WebServer/I2C_Scanner.h @@ -8,6 +8,7 @@ #ifdef WEBSERVER_I2C_SCANNER #ifdef FEATURE_I2CMULTIPLEXER +#include typedef std::vector i2c_addresses_t; #endif