From 3386806af70e9357de8bef6ff19e9754ba4901f0 Mon Sep 17 00:00:00 2001 From: TD-er Date: Tue, 12 Jan 2021 16:54:09 +0100 Subject: [PATCH] [Minimal OTA] Make minimal OTA build fit again --- src/ESPEasy_common.h | 6 -- src/_C018.ino | 2 +- src/_N001_Email.ino | 8 +- src/_P020_Ser2Net.ino | 2 +- src/_P022_PCA9685.ino | 4 +- src/_P026_Sysinfo.ino | 16 +--- src/_P042_Candle.ino | 2 +- src/_P095_ILI9341.ino | 2 +- src/src/Commands/InternalCommands.cpp | 6 ++ src/src/Commands/Notifications.cpp | 4 + src/src/Commands/Notifications.h | 6 ++ src/src/Commands/wd.cpp | 3 + src/src/Commands/wd.h | 6 ++ src/src/CustomBuild/define_plugin_sets.h | 2 +- src/src/DataStructs/C013_p2p_dataStructs.cpp | 3 + src/src/DataStructs/C013_p2p_dataStructs.h | 3 +- .../DataStructs/GpioFactorySettingsStruct.cpp | 19 ++++- .../DataStructs/GpioFactorySettingsStruct.h | 1 + src/src/ESPEasyCore/ESPEasyNetwork.cpp | 4 +- src/src/ESPEasyCore/ESPEasyRules.cpp | 82 +++---------------- src/src/ESPEasyCore/ESPEasyRules.h | 1 - src/src/ESPEasyCore/ESPEasyWifi.cpp | 13 ++- .../ESPEasyCore/ESPEasyWifi_ProcessEvent.cpp | 6 +- src/src/Globals/Plugins.cpp | 8 +- src/src/Globals/Services.h | 20 +++-- src/src/Helpers/ESPEasy_FactoryDefault.cpp | 2 + src/src/Helpers/ESPEasy_checks.cpp | 8 +- src/src/Helpers/Hardware.cpp | 21 ++++- src/src/Helpers/MDNS_Helper.cpp | 3 +- src/src/Helpers/StringConverter.cpp | 10 ++- src/src/Helpers/StringGenerator_GPIO.cpp | 4 +- src/src/Helpers/SystemVariables.cpp | 4 +- src/src/Helpers/_CPlugin_Helper_webform.cpp | 2 +- src/src/WebServer/AdvancedConfigPage.cpp | 3 +- src/src/WebServer/FactoryResetPage.cpp | 13 ++- src/src/WebServer/FileList.cpp | 2 +- src/src/WebServer/I2C_Scanner.cpp | 2 +- src/src/WebServer/JSON.cpp | 8 +- src/src/WebServer/Log.cpp | 2 +- src/src/WebServer/PinStates.cpp | 20 ++--- src/src/WebServer/ToolsPage.cpp | 2 +- src/src/WebServer/UploadPage.cpp | 4 +- src/src/WebServer/WiFiScanner.cpp | 8 +- 43 files changed, 181 insertions(+), 166 deletions(-) diff --git a/src/ESPEasy_common.h b/src/ESPEasy_common.h index 3162022d37..faf8602d93 100644 --- a/src/ESPEasy_common.h +++ b/src/ESPEasy_common.h @@ -95,9 +95,6 @@ namespace std #include "user_interface.h" } - #ifdef FEATURE_MDNS - #include - #endif #define SMALLEST_OTA_IMAGE 276848 // smallest known 2-step OTA image #define MAX_SKETCH_SIZE 1044464 // 1020 kB - 16 bytes #define PIN_D_MAX 16 @@ -117,9 +114,6 @@ namespace std // #include "esp32_ping.h" #include #include "esp_wifi.h" // Needed to call ESP-IDF functions like esp_wifi_.... - #ifdef FEATURE_MDNS - #include - #endif #define PIN_D_MAX 39 #define MAX_SKETCH_SIZE 1900544 // 0x1d0000 look at partitions in csv file #endif diff --git a/src/_C018.ino b/src/_C018.ino index c2ee2aa852..3c2707ee7c 100644 --- a/src/_C018.ino +++ b/src/_C018.ino @@ -526,7 +526,7 @@ bool CPlugin_018(CPlugin::Function function, struct EventStruct *event, String& addHtml(c018_add_joinChanged_script_element_line(F("devaddr"), false)); addHtml(c018_add_joinChanged_script_element_line(F("nskey"), false)); addHtml(c018_add_joinChanged_script_element_line(F("appskey"), false)); - addHtml("}"); + addHtml('}'); html_add_script_end(); } diff --git a/src/_N001_Email.ino b/src/_N001_Email.ino index b830c42e04..170f11d454 100644 --- a/src/_N001_Email.ino +++ b/src/_N001_Email.ino @@ -110,10 +110,10 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, mailheader.replace(String(F("$emailfrom")), notificationsettings.Sender); } else { String senderName = email_address.substring(0, pos_less); - senderName.replace("\"", ""); // Remove quotes + senderName.replace(F("\""), F("")); // Remove quotes String address = email_address.substring(pos_less + 1); - address.replace("<", ""); - address.replace(">", ""); + address.replace(F("<"), F("")); + address.replace(F(">"), F("")); address.trim(); senderName.trim(); mailheader.replace(String(F("$nodename")), senderName); @@ -125,7 +125,7 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, mailheader.replace(String(F("$ato")), notificationsettings.Receiver); mailheader.replace(String(F("$subject")), aSub); mailheader.replace(String(F("$espeasyversion")), String(BUILD)); - aMesg.replace("\r", F("
")); // re-write line breaks for Content-type: text/html + aMesg.replace(F("\r"), F("
")); // re-write line breaks for Content-type: text/html // Wait for Client to Start Sending // The MTA Exchange diff --git a/src/_P020_Ser2Net.ino b/src/_P020_Ser2Net.ino index 46f2ab3894..d752a9f195 100644 --- a/src/_P020_Ser2Net.ino +++ b/src/_P020_Ser2Net.ino @@ -283,7 +283,7 @@ boolean Plugin_020(byte function, struct EventStruct *event, String& string) if (Settings.UseRules) { String message = (char *)serial_buf; - int NewLinePos = message.indexOf("\r\n"); + int NewLinePos = message.indexOf(F("\r\n")); if (NewLinePos > 0) { message = message.substring(0, NewLinePos); diff --git a/src/_P022_PCA9685.ino b/src/_P022_PCA9685.ino index 3f3b4f3749..8ff608bd6d 100644 --- a/src/_P022_PCA9685.ino +++ b/src/_P022_PCA9685.ino @@ -190,8 +190,8 @@ boolean Plugin_022(byte function, struct EventStruct *event, String& string) { LoadTaskSettings(event->TaskIndex); String name = line.substring(0, dotPos); - name.replace("[", ""); - name.replace("]", ""); + name.replace(F("["), F("")); + name.replace(F("]"), F("")); if (name.equalsIgnoreCase(getTaskDeviceName(event->TaskIndex))) { line = line.substring(dotPos + 1); diff --git a/src/_P026_Sysinfo.ino b/src/_P026_Sysinfo.ino index ea9c5f11a1..e2db81a6d9 100644 --- a/src/_P026_Sysinfo.ino +++ b/src/_P026_Sysinfo.ino @@ -6,7 +6,9 @@ #include "src/DataStructs/ESPEasy_packed_raw_data.h" +#include "src/ESPEasyCore/ESPEasyNetwork.h" #include "src/Helpers/Memory.h" +#include "ESPEasy-Globals.h" #define PLUGIN_026 #define PLUGIN_ID_026 26 @@ -226,23 +228,11 @@ float P026_get_value(int type) break; } case 5: - { - value = NetworkLocalIP()[0]; - break; - } case 6: - { - value = NetworkLocalIP()[1]; - break; - } case 7: - { - value = NetworkLocalIP()[2]; - break; - } case 8: { - value = NetworkLocalIP()[3]; + value = NetworkLocalIP()[type - 5]; break; } case 9: diff --git a/src/_P042_Candle.ino b/src/_P042_Candle.ino index b683921263..b3fc41e815 100644 --- a/src/_P042_Candle.ino +++ b/src/_P042_Candle.ino @@ -218,7 +218,7 @@ boolean Plugin_042(byte function, struct EventStruct *event, String& string) addHtml(F(" document.getElementById('web_RGB_Red').value = Math.round(picker.rgb[0]);")); addHtml(F(" document.getElementById('web_RGB_Green').value = Math.round(picker.rgb[1]);")); addHtml(F(" document.getElementById('web_RGB_Blue').value = Math.round(picker.rgb[2]);")); - addHtml("}"); + addHtml('}'); addHtml(F("")); addHtml(F("