diff --git a/platformio_core_defs.ini b/platformio_core_defs.ini index 52dd0ed67..efbd558ca 100644 --- a/platformio_core_defs.ini +++ b/platformio_core_defs.ini @@ -6,7 +6,7 @@ ; **** Frequently used build flags: ; Use custom.h file to override default settings for ESPeasy: -D USE_CUSTOM_H -; Set VCC mode to measure Vcc of ESP chip : -D FEATURE_ADC_VCC=true +; Set VCC mode to measure Vcc of ESP chip : -D FEATURE_ADC_VCC=1 ; Build Flags: ; -DUSE_CONFIG_OVERRIDE diff --git a/platformio_esp82xx_envs.ini b/platformio_esp82xx_envs.ini index 33da7cd24..44b168371 100644 --- a/platformio_esp82xx_envs.ini +++ b/platformio_esp82xx_envs.ini @@ -252,7 +252,7 @@ platform = ${regular_platform.platform} platform_packages = ${regular_platform.platform_packages} build_flags = ${regular_platform.build_flags} ${esp8266_1M.build_flags} - -D FEATURE_ADC_VCC=true + -D FEATURE_ADC_VCC=1 lib_ignore = ${regular_platform.lib_ignore} SD(esp8266) SD @@ -265,7 +265,7 @@ 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} - -D FEATURE_ADC_VCC=true + -D FEATURE_ADC_VCC=1 lib_ignore = ${regular_platform_alt_wifi.lib_ignore} SD(esp8266) SD @@ -306,7 +306,7 @@ platform = ${regular_platform.platform} platform_packages = ${regular_platform.platform_packages} build_flags = ${regular_platform.build_flags} ${esp8266_4M1M.build_flags} - -D FEATURE_ADC_VCC=true + -D FEATURE_ADC_VCC=1 [env:normal_alt_wifi_ESP8266_4M1M] extends = esp8266_4M1M @@ -544,63 +544,63 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} [env:collection_A_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DFEATURE_ADC_VCC=true + -DFEATURE_ADC_VCC=1 -DCOLLECTION_USE_RTTTL [env:collection_B_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DFEATURE_ADC_VCC=true + -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_B [env:collection_C_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DFEATURE_ADC_VCC=true + -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_C -DCOLLECTION_USE_RTTTL [env:collection_D_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DFEATURE_ADC_VCC=true + -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_D -DCOLLECTION_USE_RTTTL [env:collection_E_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DFEATURE_ADC_VCC=true + -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_E -DCOLLECTION_USE_RTTTL ;[env:collection_A_alt_wifi_ESP8266_4M1M_VCC] ;extends = collection_alt_wifi_ESP8266_4M1M ;build_flags = ${collection_alt_wifi_ESP8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true +; -DFEATURE_ADC_VCC=1 ;[env:collection_B_alt_wifi_ESP8266_4M1M_VCC] ;extends = collection_alt_wifi_ESP8266_4M1M ;build_flags = ${collection_alt_wifi_ESP8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true +; -DFEATURE_ADC_VCC=1 ; -DPLUGIN_BUILD_COLLECTION_B ;[env:collection_C_alt_wifi_ESP8266_4M1M_VCC] ;extends = collection_alt_wifi_ESP8266_4M1M ;build_flags = ${collection_alt_wifi_ESP8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true +; -DFEATURE_ADC_VCC=1 ; -DPLUGIN_BUILD_COLLECTION_C ;[env:collection_D_alt_wifi_ESP8266_4M1M_VCC] ;extends = collection_alt_wifi_ESP8266_4M1M ;build_flags = ${collection_alt_wifi_ESP8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true +; -DFEATURE_ADC_VCC=1 ; -DPLUGIN_BUILD_COLLECTION_D ;[env:collection_E_alt_wifi_ESP8266_4M1M_VCC] ;extends = collection_alt_wifi_ESP8266_4M1M ;build_flags = ${collection_alt_wifi_ESP8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true +; -DFEATURE_ADC_VCC=1 ; -DPLUGIN_BUILD_COLLECTION_E @@ -612,8 +612,8 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} ;platform_packages = ${collection.platform_packages} ;build_flags = ${collection.build_flags} ; ${esp8266_4M1M.build_flags} -; -DFEATURE_ADC_VCC=true -; -DFEATURE_MDNS +; -DFEATURE_ADC_VCC=1 +; -DFEATURE_MDNS=1 ; -DFEATURE_SD=1 ; -DLIMIT_BUILD_SIZE ;lib_ignore = ESP32_ping diff --git a/platformio_special_envs.ini b/platformio_special_envs.ini index e23151213..82f452718 100644 --- a/platformio_special_envs.ini +++ b/platformio_special_envs.ini @@ -121,6 +121,6 @@ extends = esp8266_4M1M platform = ${regular_platform.platform} platform_packages = ${regular_platform.platform_packages} lib_ignore = ${regular_platform.lib_ignore} -build_flags = ${esp8266_4M1M.build_flags} -DMEMORY_ANALYSIS -DPLUGIN_BUILD_CUSTOM -w -DUSE_NON_STANDARD_24_TASKS -DTASKS_MAX=24 +build_flags = ${esp8266_4M1M.build_flags} -DMEMORY_ANALYSIS -DPLUGIN_BUILD_CUSTOM -w -DFEATURE_NON_STANDARD_24_TASKS=1 -DTASKS_MAX=24 extra_scripts = pre:tools/pio/pre_memanalyze.py pre:tools/pio/generate-compiletime-defines.py diff --git a/src/Custom-sample.h b/src/Custom-sample.h index 5d0304e2e..4f1781219 100644 --- a/src/Custom-sample.h +++ b/src/Custom-sample.h @@ -293,7 +293,7 @@ static const char DATA_ESPEASY_DEFAULT_MIN_CSS[] PROGMEM = { ####################################################################################################### */ -// #define USE_NON_STANDARD_24_TASKS +// #define FEATURE_NON_STANDARD_24_TASKS 1 /* ####################################################################################################### diff --git a/src/ESPEasy-Globals.h b/src/ESPEasy-Globals.h index 5cfe99b12..344e5563a 100644 --- a/src/ESPEasy-Globals.h +++ b/src/ESPEasy-Globals.h @@ -13,7 +13,7 @@ //enable reporting status to ESPEasy developers. //this informs us of crashes and stability issues. // not finished yet! -// #define FEATURE_REPORTING +// #define FEATURE_REPORTING 1 //Select which plugin sets you want to build. //These are normally automaticly set via the Platformio build environment. diff --git a/src/ESPEasy_common.h b/src/ESPEasy_common.h index 2a93ad5cd..6c6b36706 100644 --- a/src/ESPEasy_common.h +++ b/src/ESPEasy_common.h @@ -237,7 +237,7 @@ extern const String EMPTY_STRING; // Please note that the TOUT pin has to be disconnected in this mode // Use the "System Info" device to read the VCC value #ifndef FEATURE_ADC_VCC - #define FEATURE_ADC_VCC false + #define FEATURE_ADC_VCC 0 #endif #ifndef ARDUINO_OTA_PORT diff --git a/src/_P026_Sysinfo.ino b/src/_P026_Sysinfo.ino index dafad0d72..06bb39476 100644 --- a/src/_P026_Sysinfo.ino +++ b/src/_P026_Sysinfo.ino @@ -182,7 +182,7 @@ boolean Plugin_026(uint8_t function, struct EventStruct *event, String& string) success = true; break; } -#ifdef USES_PACKED_RAW_DATA +#if FEATURE_PACKED_RAW_DATA case PLUGIN_GET_PACKED_RAW_DATA: { // Matching JS code: @@ -205,7 +205,7 @@ boolean Plugin_026(uint8_t function, struct EventStruct *event, String& string) success = true; break; } -#endif // USES_PACKED_RAW_DATA +#endif // if FEATURE_PACKED_RAW_DATA } return success; } diff --git a/src/_P082_GPS.ino b/src/_P082_GPS.ino index f58949230..362fa4dba 100644 --- a/src/_P082_GPS.ino +++ b/src/_P082_GPS.ino @@ -521,7 +521,7 @@ boolean Plugin_082(uint8_t function, struct EventStruct *event, String& string) break; } -# ifdef USES_PACKED_RAW_DATA +# if FEATURE_PACKED_RAW_DATA case PLUGIN_GET_PACKED_RAW_DATA: { P082_data_struct *P082_data = @@ -550,7 +550,7 @@ boolean Plugin_082(uint8_t function, struct EventStruct *event, String& string) } break; } -# endif // USES_PACKED_RAW_DATA +# endif // if FEATURE_PACKED_RAW_DATA } return success; } diff --git a/src/_P085_AcuDC243.ino b/src/_P085_AcuDC243.ino index ccebfbe3f..8e8216e47 100644 --- a/src/_P085_AcuDC243.ino +++ b/src/_P085_AcuDC243.ino @@ -295,7 +295,7 @@ boolean Plugin_085(uint8_t function, struct EventStruct *event, String& string) } break; } -# ifdef USES_PACKED_RAW_DATA +# if FEATURE_PACKED_RAW_DATA case PLUGIN_GET_PACKED_RAW_DATA: { // FIXME TD-er: Same code as in P102, share in LoRa code. @@ -318,7 +318,7 @@ boolean Plugin_085(uint8_t function, struct EventStruct *event, String& string) } break; } -# endif // USES_PACKED_RAW_DATA +# endif // if FEATURE_PACKED_RAW_DATA } return success; } diff --git a/src/_P102_PZEM004Tv3.ino b/src/_P102_PZEM004Tv3.ino index 9a0358ade..87123e40a 100644 --- a/src/_P102_PZEM004Tv3.ino +++ b/src/_P102_PZEM004Tv3.ino @@ -309,7 +309,7 @@ boolean Plugin_102(uint8_t function, struct EventStruct *event, String& string) break; } -#ifdef USES_PACKED_RAW_DATA +#if FEATURE_PACKED_RAW_DATA case PLUGIN_GET_PACKED_RAW_DATA: { // Matching JS code: @@ -337,7 +337,7 @@ boolean Plugin_102(uint8_t function, struct EventStruct *event, String& string) success = true; break; } -#endif // USES_PACKED_RAW_DATA +#endif // if FEATURE_PACKED_RAW_DATA diff --git a/src/_P108_DDS238.ino b/src/_P108_DDS238.ino index 1df7842fc..33fe527af 100644 --- a/src/_P108_DDS238.ino +++ b/src/_P108_DDS238.ino @@ -16,9 +16,9 @@ // Written by José Araújo (josemariaaraujo@gmail.com), // with most code copied from plugin 085: _P085_AcuDC243.ino -# ifndef USES_MODBUS +# if !FEATURE_MODBUS # error This code needs MODBUS library, it should be enabled in 'define_plugin_sets.h', or your 'custom.h' -# endif // ifndef USES_MODBUS +# endif // if !FEATURE_MODBUS /* DF - Below doesn't look right; needs a RS485 to TTL(3.3v) level converter (see https://github.com/reaper7/SDM_Energy_Meter) @@ -255,7 +255,7 @@ boolean Plugin_108(uint8_t function, struct EventStruct *event, String& string) break; } -# ifdef USES_PACKED_RAW_DATA +# if FEATURE_PACKED_RAW_DATA case PLUGIN_GET_PACKED_RAW_DATA: { // FIXME TD-er: Same code as in P102, share in LoRa code. @@ -278,7 +278,7 @@ boolean Plugin_108(uint8_t function, struct EventStruct *event, String& string) } break; } -# endif // USES_PACKED_RAW_DATA +# endif // if FEATURE_PACKED_RAW_DATA } return success; } diff --git a/src/_Reporting.ino b/src/_Reporting.ino index fd35235bb..0b713fef8 100644 --- a/src/_Reporting.ino +++ b/src/_Reporting.ino @@ -1,6 +1,6 @@ // not finished yet -#ifdef FEATURE_REPORTING +#if defined(FEATURE_REPORTING) && FEATURE_REPORTING #include @@ -8,7 +8,7 @@ // NO, too big: #include #define REPORT_HOST "espeasy.datux.nl" -#define FEATURE_REPORTING +#define FEATURE_REPORTING 1 void ReportStatus() { @@ -94,4 +94,4 @@ void ReportStatus() } */ -#endif // ifdef FEATURE_REPORTING +#endif // if defined(FEATURE_REPORTING) && FEATURE_REPORTING diff --git a/src/src/Commands/InternalCommands.cpp b/src/src/Commands/InternalCommands.cpp index bd1c621ca..9b3dae2f8 100644 --- a/src/src/Commands/InternalCommands.cpp +++ b/src/src/Commands/InternalCommands.cpp @@ -5,10 +5,10 @@ #include "../../_Plugin_Helper.h" #include "../Globals/Settings.h" -#ifdef USES_BLYNK +#if FEATURE_BLYNK # include "../Commands/Blynk.h" # include "../Commands/Blynk_c015.h" -#endif // ifdef USES_BLYNK +#endif // if FEATURE_BLYNK #include "../Commands/Common.h" #include "../Commands/Controller.h" @@ -17,12 +17,12 @@ #include "../Commands/HTTP.h" #include "../Commands/i2c.h" -#ifdef USES_MQTT +#if FEATURE_MQTT # include "../Commands/MQTT.h" -#endif // USES_MQTT +#endif // if FEATURE_MQTT #include "../Commands/Networks.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../Commands/Notifications.h" #endif #include "../Commands/Provisioning.h" @@ -367,7 +367,7 @@ bool executeInternalCommand(command_case_data & data) case 'n': { COMMAND_CASE_R( "name", Command_Settings_Name, 1); // Settings.h COMMAND_CASE_R("nosleep", Command_System_NoSleep, 1); // System.h -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER COMMAND_CASE_R( "notify", Command_Notifications_Notify, 2); // Notifications.h #endif COMMAND_CASE_R("ntphost", Command_NTPHost, 1); // Time.h @@ -390,7 +390,7 @@ bool executeInternalCommand(command_case_data & data) #if FEATURE_CUSTOM_PROVISIONING COMMAND_CASE_A( "provisionconfig", Command_Provisioning_Config, 0); // Provisioning.h COMMAND_CASE_A( "provisionsecurity", Command_Provisioning_Security, 0); // Provisioning.h - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER COMMAND_CASE_A( "provisionnotification", Command_Provisioning_Notification, 0); // Provisioning.h #endif COMMAND_CASE_A( "provisionprovision", Command_Provisioning_Provision, 0); // Provisioning.h @@ -398,9 +398,9 @@ bool executeInternalCommand(command_case_data & data) COMMAND_CASE_A( "provisionfirmware", Command_Provisioning_Firmware, 1); // Provisioning.h #endif COMMAND_CASE_A( "pulse", Command_GPIO_Pulse, 3); // GPIO.h -#ifdef USES_MQTT +#if FEATURE_MQTT COMMAND_CASE_A( "publish", Command_MQTT_Publish, 2); // MQTT.h -#endif // USES_MQTT +#endif // if FEATURE_MQTT COMMAND_CASE_A( "pwm", Command_GPIO_PWM, 4); // GPIO.h break; } @@ -436,9 +436,9 @@ bool executeInternalCommand(command_case_data & data) } COMMAND_CASE_A("status", Command_GPIO_Status, 2); // GPIO.h COMMAND_CASE_R("subnet", Command_Subnet, 1); // Network Command - #ifdef USES_MQTT + #if FEATURE_MQTT COMMAND_CASE_A("subscribe", Command_MQTT_Subscribe, 1); // MQTT.h - #endif // USES_MQTT + #endif // if FEATURE_MQTT #ifndef BUILD_NO_DIAGNOSTIC_COMMANDS COMMAND_CASE_A( "sysload", Command_SysLoad, 0); // Diagnostic.h #endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS diff --git a/src/src/Commands/MQTT.cpp b/src/src/Commands/MQTT.cpp index c519346c3..42bd042a0 100644 --- a/src/src/Commands/MQTT.cpp +++ b/src/src/Commands/MQTT.cpp @@ -1,7 +1,7 @@ #include "../../ESPEasy_common.h" #include "../Globals/MQTT.h" -#ifdef USES_MQTT +#if FEATURE_MQTT @@ -117,4 +117,4 @@ const __FlashStringHelper * Command_MQTT_Subscribe(struct EventStruct *event, co } -#endif // ifdef USES_MQTT +#endif // if FEATURE_MQTT diff --git a/src/src/Commands/MQTT.h b/src/src/Commands/MQTT.h index 93f543aa7..c3c4566ef 100644 --- a/src/src/Commands/MQTT.h +++ b/src/src/Commands/MQTT.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_MQTT +#if FEATURE_MQTT #include @@ -13,6 +13,6 @@ const __FlashStringHelper * Command_MQTT_Publish(struct EventStruct *event, const __FlashStringHelper * Command_MQTT_Subscribe(struct EventStruct *event, const char* Line); -#endif // ifdef USES_MQTT +#endif // if FEATURE_MQTT #endif // COMMAND_MQTT_H diff --git a/src/src/Commands/Notifications.cpp b/src/src/Commands/Notifications.cpp index e69b6c460..ca99f4880 100644 --- a/src/src/Commands/Notifications.cpp +++ b/src/src/Commands/Notifications.cpp @@ -1,6 +1,6 @@ #include "../Commands/Notifications.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../Commands/Common.h" diff --git a/src/src/Commands/Notifications.h b/src/src/Commands/Notifications.h index 817fb2946..03b2bfbd6 100644 --- a/src/src/Commands/Notifications.h +++ b/src/src/Commands/Notifications.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER const __FlashStringHelper * Command_Notifications_Notify(struct EventStruct *event, const char* Line); diff --git a/src/src/Commands/Provisioning.cpp b/src/src/Commands/Provisioning.cpp index 2dbd1e69b..66e26615a 100644 --- a/src/src/Commands/Provisioning.cpp +++ b/src/src/Commands/Provisioning.cpp @@ -19,7 +19,7 @@ String Command_Provisioning_Security(struct EventStruct *event, const char *Line return downloadFileType(FileType::SECURITY_DAT); } -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER String Command_Provisioning_Notification(struct EventStruct *event, const char *Line) { return downloadFileType(FileType::NOTIFICATION_DAT); diff --git a/src/src/Commands/Provisioning.h b/src/src/Commands/Provisioning.h index 85d160f3e..bc7316d8c 100644 --- a/src/src/Commands/Provisioning.h +++ b/src/src/Commands/Provisioning.h @@ -11,7 +11,7 @@ String Command_Provisioning_Config(struct EventStruct *event, const char *Line); String Command_Provisioning_Security(struct EventStruct *event, const char *Line); -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER String Command_Provisioning_Notification(struct EventStruct *event, const char *Line); #endif diff --git a/src/src/ControllerQueue/C018_queue_element.cpp b/src/src/ControllerQueue/C018_queue_element.cpp index a93c527e2..cb6871987 100644 --- a/src/src/ControllerQueue/C018_queue_element.cpp +++ b/src/src/ControllerQueue/C018_queue_element.cpp @@ -12,7 +12,7 @@ C018_queue_element::C018_queue_element(struct EventStruct *event, uint8_t sample TaskIndex(event->TaskIndex), controller_idx(event->ControllerIndex) { - # ifdef USES_PACKED_RAW_DATA + # if FEATURE_PACKED_RAW_DATA #ifdef USE_SECOND_HEAP // HeapSelectIram ephemeral; #endif @@ -24,7 +24,7 @@ C018_queue_element::C018_queue_element(struct EventStruct *event, uint8_t sample log += packed; addLogMove(LOG_LEVEL_INFO, log); } - # endif // USES_PACKED_RAW_DATA + # endif // if FEATURE_PACKED_RAW_DATA } size_t C018_queue_element::getSize() const { diff --git a/src/src/ControllerQueue/DelayQueueElements.cpp b/src/src/ControllerQueue/DelayQueueElements.cpp index 62cc342a2..d921b9853 100644 --- a/src/src/ControllerQueue/DelayQueueElements.cpp +++ b/src/src/ControllerQueue/DelayQueueElements.cpp @@ -5,7 +5,7 @@ #include "../Globals/ESPEasy_Scheduler.h" #include "../Helpers/PeriodicalActions.h" -#ifdef USES_MQTT +#if FEATURE_MQTT ControllerDelayHandlerStruct *MQTTDelayHandler = nullptr; bool init_mqtt_delay_queue(controllerIndex_t ControllerIndex, String& pubname, bool& retainFlag) { @@ -39,7 +39,7 @@ void exit_mqtt_delay_queue() { } } -#endif // USES_MQTT +#endif // if FEATURE_MQTT /*********************************************************************************************\ diff --git a/src/src/ControllerQueue/DelayQueueElements.h b/src/src/ControllerQueue/DelayQueueElements.h index a56cd96ac..044759f29 100644 --- a/src/src/ControllerQueue/DelayQueueElements.h +++ b/src/src/ControllerQueue/DelayQueueElements.h @@ -26,13 +26,13 @@ // -#ifdef USES_MQTT +#if FEATURE_MQTT # include "../ControllerQueue/MQTT_queue_element.h" extern ControllerDelayHandlerStruct *MQTTDelayHandler; bool init_mqtt_delay_queue(controllerIndex_t ControllerIndex, String& pubname, bool& retainFlag); void exit_mqtt_delay_queue(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT /*********************************************************************************************\ diff --git a/src/src/ControllerQueue/MQTT_queue_element.cpp b/src/src/ControllerQueue/MQTT_queue_element.cpp index 7c728d7a0..d53af0369 100644 --- a/src/src/ControllerQueue/MQTT_queue_element.cpp +++ b/src/src/ControllerQueue/MQTT_queue_element.cpp @@ -1,6 +1,6 @@ #include "../ControllerQueue/MQTT_queue_element.h" -#ifdef USES_MQTT +#if FEATURE_MQTT MQTT_queue_element::MQTT_queue_element(int ctrl_idx, taskIndex_t TaskIndex, @@ -67,4 +67,4 @@ void MQTT_queue_element::removeEmptyTopics() { _topic.replace(F("//"), F("/")); } } -#endif // USES_MQTT +#endif // if FEATURE_MQTT diff --git a/src/src/ControllerQueue/MQTT_queue_element.h b/src/src/ControllerQueue/MQTT_queue_element.h index 837105b0d..7d37b4ce8 100644 --- a/src/src/ControllerQueue/MQTT_queue_element.h +++ b/src/src/ControllerQueue/MQTT_queue_element.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_MQTT +#if FEATURE_MQTT #include "../DataStructs/UnitMessageCount.h" #include "../Globals/CPlugins.h" @@ -54,6 +54,6 @@ public: UnitMessageCount_t UnitMessageCount; }; -#endif // USES_MQTT +#endif // if FEATURE_MQTT #endif // CONTROLLERQUEUE_MQTT_QUEUE_ELEMENT_H diff --git a/src/src/CustomBuild/ESPEasyLimits.h b/src/src/CustomBuild/ESPEasyLimits.h index ca220f8ab..386611012 100644 --- a/src/src/CustomBuild/ESPEasyLimits.h +++ b/src/src/CustomBuild/ESPEasyLimits.h @@ -13,7 +13,7 @@ // Performing a 2-stage define assignment using the _TMP defines // See: https://github.com/letscontrolit/ESPEasy/issues/2621 -#ifdef USE_NON_STANDARD_24_TASKS +#if FEATURE_NON_STANDARD_24_TASKS #define TASKS_MAX_TMP 24 #else #define TASKS_MAX_TMP 12 diff --git a/src/src/CustomBuild/StorageLayout.h b/src/src/CustomBuild/StorageLayout.h index 3b3cebfd3..4e1d4d90e 100644 --- a/src/src/CustomBuild/StorageLayout.h +++ b/src/src/CustomBuild/StorageLayout.h @@ -118,7 +118,7 @@ #if defined(ESP8266) - # ifdef USE_NON_STANDARD_24_TASKS + # if FEATURE_NON_STANDARD_24_TASKS # ifndef DAT_OFFSET_TASKS # define DAT_OFFSET_TASKS 4096 // 0x1000 each task = 2k, (1024 basic + 1024 bytes custom) # endif // ifndef DAT_OFFSET_TASKS @@ -132,7 +132,7 @@ # define CONFIG_FILE_SIZE 65536 # endif // ifndef CONFIG_FILE_SIZE - # else // ifdef USE_NON_STANDARD_24_TASKS + # else // if FEATURE_NON_STANDARD_24_TASKS # ifndef DAT_OFFSET_TASKS # define DAT_OFFSET_TASKS 4096 // each task = 2k, (1024 basic + 1024 bytes custom), 12 max @@ -153,7 +153,7 @@ # define CONFIG_FILE_SIZE 65536 # endif // ifndef CONFIG_FILE_SIZE # endif - # endif // ifdef USE_NON_STANDARD_24_TASKS + # endif // if FEATURE_NON_STANDARD_24_TASKS #endif // if defined(ESP8266) #if defined(ESP32) diff --git a/src/src/CustomBuild/check_defines_custom.h b/src/src/CustomBuild/check_defines_custom.h index c4f0bc9a2..a626d6f93 100644 --- a/src/src/CustomBuild/check_defines_custom.h +++ b/src/src/CustomBuild/check_defines_custom.h @@ -120,6 +120,54 @@ # undef USE_I2C_DEVICE_SCAN #endif // if USE_I2C_DEVICE_SCAN +#if defined(FEATURE_MDNS) && (2 - FEATURE_MDNS - 2 == 4) // 'Defined but empty' check +# warning "Custom.h has '#define FEATURE_MDNS' to be replaced with '#define FEATURE_MDNS 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# undef FEATURE_MDNS +# define FEATURE_MDNS 1 +#endif // if defined(FEATURE_MDNS) && (2-FEATURE_MDNS-2 == 4) + +#if FEATURE_NOTIFIER +# warning "Custom.h has '#define USES_NOTIFIER' to be replaced with '#define FEATURE_NOTIFIER 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# define FEATURE_NOTIFIER 1 +# undef USES_NOTIFIER +#endif // if FEATURE_NOTIFIER + +#ifdef USES_MODBUS +# warning "Custom.h has '#define USES_MODBUS' to be replaced with '#define FEATURE_MODBUS 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# define FEATURE_MODBUS 1 +# undef USES_MODBUS +#endif // ifdef USES_MODBUS + +#ifdef USE_NON_STANDARD_24_TASKS +# warning "Custom.h has '#define USE_NON_STANDARD_24_TASKS' to be replaced with '#define FEATURE_NON_STANDARD_24_TASKS 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# define FEATURE_NON_STANDARD_24_TASKS 1 +# undef USE_NON_STANDARD_24_TASKS +#endif // ifdef USE_NON_STANDARD_24_TASKS + +#ifdef USES_PACKED_RAW_DATA +# warning "Custom.h has '#define USES_PACKED_RAW_DATA' to be replaced with '#define FEATURE_PACKED_RAW_DATA 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# define FEATURE_PACKED_RAW_DATA 1 +# undef USES_PACKED_RAW_DATA +#endif // ifdef USES_PACKED_RAW_DATA + +#ifdef USES_BLYNK +# warning "Custom.h has '#define USES_BLYNK' to be replaced with '#define FEATURE_BLYNK 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# define FEATURE_BLYNK 1 +# undef USES_BLYNK +#endif // ifdef USES_BLYNK + +#if defined(FEATURE_REPORTING) && (2 - FEATURE_REPORTING - 2 == 4) // 'Defined but empty' check +# warning "Custom.h has '#define FEATURE_REPORTING' to be replaced with '#define FEATURE_REPORTING 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# undef FEATURE_REPORTING +# define FEATURE_REPORTING 1 +#endif // if defined(FEATURE_REPORTING) && (2-FEATURE_REPORTING-2 == 4) + +#if defined(FEATURE_DNS_SERVER) && (2 - FEATURE_DNS_SERVER - 2 == 4) // 'Defined but empty' check +# warning "Custom.h has '#define FEATURE_DNS_SERVER' to be replaced with '#define FEATURE_DNS_SERVER 1', see https://github.com/letscontrolit/ESPEasy/pull/4153" +# undef FEATURE_DNS_SERVER +# define FEATURE_DNS_SERVER 1 +#endif // if defined(FEATURE_DNS_SERVER) && (2-FEATURE_DNS_SERVER-2 == 4) + /* *INDENT-ON* */ #endif // ifndef CUSTOMBUILD_CHECK_DEFINES_CUSTOM_H diff --git a/src/src/CustomBuild/define_plugin_sets.h b/src/src/CustomBuild/define_plugin_sets.h index e0b9d971a..bdd4660ec 100644 --- a/src/src/CustomBuild/define_plugin_sets.h +++ b/src/src/CustomBuild/define_plugin_sets.h @@ -318,17 +318,17 @@ To create/register a plugin, you have to : #endif #endif -#ifdef FEATURE_FHEM +#if FEATURE_FHEM #define USES_C009 // FHEM HTTP #endif -#ifdef FEATURE_HOMEASSISTANT_OPENHAB +#if FEATURE_HOMEASSISTANT_OPENHAB #define USES_C005 // Home Assistant (openHAB) MQTT #endif #ifdef PLUGIN_BUILD_MINIMAL_OTA // Disable ESPEasy p2p for minimal OTA builds. - #ifdef FEATURE_ESPEASY_P2P + #if FEATURE_ESPEASY_P2P #undef FEATURE_ESPEASY_P2P #define FEATURE_ESPEASY_P2P 0 #endif @@ -390,9 +390,11 @@ To create/register a plugin, you have to : #if FEATURE_SERVO #undef FEATURE_SERVO + #define FEATURE_SERVO 0 #endif #if FEATURE_RTTTL #undef FEATURE_RTTTL + #define FEATURE_RTTTL 0 #endif #endif @@ -1418,10 +1420,12 @@ To create/register a plugin, you have to : #if FEATURE_PLUGIN_STATS && defined(ESP8266) // Does not fit in build #undef FEATURE_PLUGIN_STATS + #define FEATURE_PLUGIN_STATS 0 #endif #if FEATURE_CHART_JS && defined(ESP8266) // Does not fit in build #undef FEATURE_CHART_JS + #define FEATURE_CHART_JS 0 #endif #endif @@ -1749,12 +1753,12 @@ To create/register a plugin, you have to : #if defined(USES_C018) - #define USES_PACKED_RAW_DATA + #define FEATURE_PACKED_RAW_DATA 1 #endif #if defined(USES_P085) || defined (USES_P052) || defined(USES_P078) || defined(USES_P108) // FIXME TD-er: Is this correct? Those plugins use Modbus_RTU. - #define USES_MODBUS + #define FEATURE_MODBUS 1 #endif #if defined(USES_C001) || defined (USES_C002) || defined(USES_P029) @@ -1783,7 +1787,7 @@ To create/register a plugin, you have to : // VCC builds need a bit more, disable timing stats to make it fit. #ifndef PLUGIN_BUILD_CUSTOM - #if defined(FEATURE_ADC_VCC) && !defined(PLUGIN_SET_MAX) + #if FEATURE_ADC_VCC && !defined(PLUGIN_SET_MAX) #ifndef LIMIT_BUILD_SIZE #define LIMIT_BUILD_SIZE #endif @@ -1844,16 +1848,19 @@ To create/register a plugin, you have to : #if FEATURE_SERVO #undef FEATURE_SERVO + #define FEATURE_SERVO 0 #endif #if FEATURE_RTTTL #undef FEATURE_RTTTL + #define FEATURE_RTTTL 0 #endif #if FEATURE_TOOLTIPS #undef FEATURE_TOOLTIPS #define FEATURE_TOOLTIPS 0 #endif - #ifdef USES_BLYNK - #undef USES_BLYNK + #if FEATURE_BLYNK + #undef FEATURE_BLYNK + #define FEATURE_BLYNK 0 #endif #if !defined(PLUGIN_SET_COLLECTION) && !defined(PLUGIN_SET_SONOFF_POW) #ifdef USES_P076 @@ -1883,6 +1890,7 @@ To create/register a plugin, you have to : #endif #if FEATURE_TRIGONOMETRIC_FUNCTIONS_RULES && !defined(KEEP_TRIGONOMETRIC_FUNCTIONS_RULES) #undef FEATURE_TRIGONOMETRIC_FUNCTIONS_RULES + #define FEATURE_TRIGONOMETRIC_FUNCTIONS_RULES 0 #endif #if FEATURE_SSDP #undef FEATURE_SSDP @@ -1890,9 +1898,11 @@ To create/register a plugin, you have to : #endif #if FEATURE_PLUGIN_STATS #undef FEATURE_PLUGIN_STATS + #define FEATURE_PLUGIN_STATS 0 #endif #if FEATURE_CHART_JS #undef FEATURE_CHART_JS + #define FEATURE_CHART_JS 0 #endif #endif @@ -1933,18 +1943,18 @@ To create/register a plugin, you have to : #endif #if defined(USES_C002) || defined (USES_C005) || defined(USES_C006) || defined(USES_C014) || defined(USES_P037) - #define USES_MQTT + #define FEATURE_MQTT 1 #endif #if defined(USES_C012) || defined (USES_C015) - #define USES_BLYNK + #define FEATURE_BLYNK 1 #endif // Specific notifier plugins may be enabled via Custom.h, regardless // whether NOTIFIER_SET_NONE is defined #if defined(USES_N001) || defined(USES_N002) - #ifndef USES_NOTIFIER - #define USES_NOTIFIER + #ifndef FEATURE_NOTIFIER + #define FEATURE_NOTIFIER 1 #endif #endif @@ -1956,16 +1966,16 @@ To create/register a plugin, you have to : #endif #endif -#ifdef USES_MQTT +#if FEATURE_MQTT // MQTT_MAX_PACKET_SIZE : Maximum packet size #ifndef MQTT_MAX_PACKET_SIZE #define MQTT_MAX_PACKET_SIZE 1024 // Is also used in PubSubClient #endif -#endif //USES_MQTT +#endif //if FEATURE_MQTT // It may have gotten undefined to fit a build. Make sure the Blynk controllers are not defined -#ifndef USES_BLYNK +#if !FEATURE_BLYNK #ifdef USES_C012 #undef USES_C012 #endif @@ -1976,20 +1986,20 @@ To create/register a plugin, you have to : #if FEATURE_ARDUINO_OTA #ifndef FEATURE_MDNS - #define FEATURE_MDNS + #define FEATURE_MDNS 1 #endif #endif -#ifdef FEATURE_MDNS +#if FEATURE_MDNS #ifndef FEATURE_DNS_SERVER - #define FEATURE_DNS_SERVER + #define FEATURE_DNS_SERVER 1 #endif #endif #ifdef WEBSERVER_SETUP #ifndef PLUGIN_BUILD_MINIMAL_OTA #ifndef FEATURE_DNS_SERVER - #define FEATURE_DNS_SERVER + #define FEATURE_DNS_SERVER 1 #endif #endif #endif diff --git a/src/src/DataStructs/ESPEasy_EventStruct.h b/src/src/DataStructs/ESPEasy_EventStruct.h index 30175f38c..762d856b3 100644 --- a/src/src/DataStructs/ESPEasy_EventStruct.h +++ b/src/src/DataStructs/ESPEasy_EventStruct.h @@ -65,7 +65,7 @@ public: EventValueSource::Enum Source = EventValueSource::Enum::VALUE_SOURCE_NOT_SET; taskIndex_t TaskIndex = INVALID_TASK_INDEX; // index position in TaskSettings array, 0-11 controllerIndex_t ControllerIndex = INVALID_CONTROLLER_INDEX; // index position in Settings.Controller, 0-3 -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER notifierIndex_t NotificationIndex = INVALID_NOTIFIER_INDEX; // index position in Settings.Notification, 0-3 #endif uint8_t BaseVarIndex = 0; diff --git a/src/src/DataStructs/Modbus.cpp b/src/src/DataStructs/Modbus.cpp index c9c8738fd..789b49de2 100644 --- a/src/src/DataStructs/Modbus.cpp +++ b/src/src/DataStructs/Modbus.cpp @@ -1,10 +1,11 @@ #include "../DataStructs/Modbus.h" -#ifdef USES_MODBUS +#if FEATURE_MODBUS #include "../DataStructs/ControllerSettingsStruct.h" #include "../ESPEasyCore/ESPEasy_Log.h" + Modbus::Modbus() : ModbusClient(nullptr), errcnt(0), timeout(0), TXRXstate(MODBUS_IDLE), RXavailable(0), payLoad(0) {} @@ -242,4 +243,4 @@ bool Modbus::tryRead(uint8_t ModbusID, uint16_t M_register, MODBUS_registerType return false; } -#endif // USES_MODBUS +#endif // FEATURE_MODBUS diff --git a/src/src/DataStructs/Modbus.h b/src/src/DataStructs/Modbus.h index b8ef4ebfd..53913139e 100644 --- a/src/src/DataStructs/Modbus.h +++ b/src/src/DataStructs/Modbus.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_MODBUS +#if FEATURE_MODBUS enum MODBUS_states_t { MODBUS_IDLE, MODBUS_RECEIVE, MODBUS_RECEIVE_PAYLOAD }; enum MODBUS_registerTypes_t { signed16, unsigned16, signed32, unsigned32, signed64, unsigned64 }; @@ -79,6 +79,6 @@ private: }; -#endif // ifdef USES_MODBUS +#endif // if FEATURE_MODBUS #endif // ifndef DATASTRUCTS_MODBUS_H diff --git a/src/src/DataStructs/NotificationSettingsStruct.cpp b/src/src/DataStructs/NotificationSettingsStruct.cpp index 0087b9fb7..ea07e2a4c 100644 --- a/src/src/DataStructs/NotificationSettingsStruct.cpp +++ b/src/src/DataStructs/NotificationSettingsStruct.cpp @@ -1,6 +1,6 @@ #include "../DataStructs/NotificationSettingsStruct.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER NotificationSettingsStruct::NotificationSettingsStruct() : Port(0), Pin1(-1), Pin2(-1) { ZERO_FILL(Server); diff --git a/src/src/DataStructs/NotificationSettingsStruct.h b/src/src/DataStructs/NotificationSettingsStruct.h index a0cc26a75..7ee1eaf46 100644 --- a/src/src/DataStructs/NotificationSettingsStruct.h +++ b/src/src/DataStructs/NotificationSettingsStruct.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include #include // For std::shared_ptr diff --git a/src/src/DataStructs/NotificationStruct.h b/src/src/DataStructs/NotificationStruct.h index 455f47bc8..52e29c0c2 100644 --- a/src/src/DataStructs/NotificationStruct.h +++ b/src/src/DataStructs/NotificationStruct.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER /*********************************************************************************************\ * NotificationStruct diff --git a/src/src/DataTypes/ESPEasy_plugin_functions.h b/src/src/DataTypes/ESPEasy_plugin_functions.h index f7a40e9f7..03ade62de 100644 --- a/src/src/DataTypes/ESPEasy_plugin_functions.h +++ b/src/src/DataTypes/ESPEasy_plugin_functions.h @@ -39,7 +39,7 @@ #define PLUGIN_MONITOR 30 // Replaces PLUGIN_UNCONDITIONAL_POLL #define PLUGIN_SET_DEFAULTS 31 // Called when assigning a plugin to a task, to set some default config. #define PLUGIN_GET_PACKED_RAW_DATA 32 // Return all data in a compact binary format specific for that plugin. - // Needs USES_PACKED_RAW_DATA + // Needs FEATURE_PACKED_RAW_DATA #define PLUGIN_ONLY_TIMER_IN 33 // Similar to PLUGIN_TIMER_IN, addressed to a plugin instead of a task. #define PLUGIN_WEBFORM_SHOW_I2C_PARAMS 34 // Show I2C parameters like address. #define PLUGIN_WEBFORM_SHOW_SERIAL_PARAMS 35 // When needed, show additional parameters like baudrate or specific serial config diff --git a/src/src/DataTypes/SettingsType.cpp b/src/src/DataTypes/SettingsType.cpp index 32497d537..f2985f4a9 100644 --- a/src/src/DataTypes/SettingsType.cpp +++ b/src/src/DataTypes/SettingsType.cpp @@ -16,7 +16,7 @@ const __FlashStringHelper * SettingsType::getSettingsTypeString(Enum settingsTyp case Enum::ControllerSettings_Type: return F("ControllerSettings"); case Enum::CustomControllerSettings_Type: return F("CustomControllerSettings"); case Enum::NotificationSettings_Type: - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER return F("NotificationSettings"); #else break; @@ -83,7 +83,7 @@ bool SettingsType::getSettingsParameters(Enum settingsType, int index, int& max_ } case Enum::NotificationSettings_Type: { -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER max_index = NOTIFICATION_MAX; offset = index * (DAT_NOTIFICATION_SIZE); max_size = DAT_NOTIFICATION_SIZE; diff --git a/src/src/ESPEasyCore/Controller.cpp b/src/src/ESPEasyCore/Controller.cpp index 56e2b4c2a..b99d73d65 100644 --- a/src/src/ESPEasyCore/Controller.cpp +++ b/src/src/ESPEasyCore/Controller.cpp @@ -106,7 +106,7 @@ bool validUserVar(struct EventStruct *event) { return true; } -#ifdef USES_MQTT +#if FEATURE_MQTT /*********************************************************************************************\ * Handle incoming MQTT messages @@ -433,7 +433,7 @@ String getLWT_messageDisconnect(const ControllerSettingsStruct& ControllerSettin return LWTMessageDisconnect; } -#endif // USES_MQTT +#endif // if FEATURE_MQTT /*********************************************************************************************\ * Send status info to request source @@ -473,11 +473,11 @@ void SendStatus(struct EventStruct *event, const String& status) printWebString += status; } break; -#ifdef USES_MQTT +#if FEATURE_MQTT case EventValueSource::Enum::VALUE_SOURCE_MQTT: MQTTStatus(event, status); break; -#endif // USES_MQTT +#endif // if FEATURE_MQTT case EventValueSource::Enum::VALUE_SOURCE_SERIAL: serialPrintln(status); break; @@ -487,7 +487,7 @@ void SendStatus(struct EventStruct *event, const String& status) } } -#ifdef USES_MQTT +#if FEATURE_MQTT bool MQTT_queueFull(controllerIndex_t controller_idx) { if (MQTTDelayHandler == nullptr) { return true; @@ -579,7 +579,7 @@ void MQTTStatus(struct EventStruct *event, const String& status) } } -#endif // USES_MQTT +#endif // if FEATURE_MQTT /*********************************************************************************************\ diff --git a/src/src/ESPEasyCore/Controller.h b/src/src/ESPEasyCore/Controller.h index 0a69b48a4..e451c4091 100644 --- a/src/src/ESPEasyCore/Controller.h +++ b/src/src/ESPEasyCore/Controller.h @@ -13,7 +13,7 @@ void sendData(struct EventStruct *event); bool validUserVar(struct EventStruct *event); -#ifdef USES_MQTT +#if FEATURE_MQTT /*********************************************************************************************\ * Handle incoming MQTT messages \*********************************************************************************************/ @@ -45,7 +45,7 @@ String getLWT_messageConnect(const ControllerSettingsStruct& ControllerSettings) String getLWT_messageDisconnect(const ControllerSettingsStruct& ControllerSettings); -#endif // USES_MQTT +#endif // if FEATURE_MQTT /*********************************************************************************************\ * Send status info to request source @@ -56,7 +56,7 @@ bool SourceNeedsStatusUpdate(EventValueSource::Enum eventSource); void SendStatus(struct EventStruct *event, const String& status); -#ifdef USES_MQTT +#if FEATURE_MQTT bool MQTT_queueFull(controllerIndex_t controller_idx); bool MQTTpublish(controllerIndex_t controller_idx, taskIndex_t taskIndex, const char *topic, const char *payload, bool retained); @@ -69,7 +69,7 @@ bool MQTTpublish(controllerIndex_t controller_idx, taskIndex_t taskIndex, Strin * Send status info back to channel where request came from \*********************************************************************************************/ void MQTTStatus(struct EventStruct *event, const String& status); -#endif //USES_MQTT +#endif //if FEATURE_MQTT diff --git a/src/src/ESPEasyCore/ESPEasyWifi.cpp b/src/src/ESPEasyCore/ESPEasyWifi.cpp index 55b812f5f..66e21c8ba 100644 --- a/src/src/ESPEasyCore/ESPEasyWifi.cpp +++ b/src/src/ESPEasyCore/ESPEasyWifi.cpp @@ -1086,12 +1086,12 @@ void setAPinternal(bool enable) #endif // ifdef ESP32 WiFiEventData.timerAPoff.setMillisFromNow(WIFI_AP_OFF_TIMER_DURATION); } else { - #ifdef FEATURE_DNS_SERVER + #if FEATURE_DNS_SERVER if (dnsServerActive) { dnsServerActive = false; dnsServer.stop(); } - #endif + #endif // if FEATURE_DNS_SERVER } } @@ -1215,7 +1215,7 @@ void setWifiMode(WiFiMode_t wifimode) { // Mode has changed setAPinternal(new_mode_AP_enabled); } - #ifdef FEATURE_MDNS + #if FEATURE_MDNS #ifdef ESP8266 // notifyAPChange() is not present in the ESP32 MDNSResponder MDNS.notifyAPChange(); diff --git a/src/src/ESPEasyCore/ESPEasyWifi_ProcessEvent.cpp b/src/src/ESPEasyCore/ESPEasyWifi_ProcessEvent.cpp index 3cf258ed9..1dc9d76c3 100644 --- a/src/src/ESPEasyCore/ESPEasyWifi_ProcessEvent.cpp +++ b/src/src/ESPEasyCore/ESPEasyWifi_ProcessEvent.cpp @@ -428,13 +428,13 @@ void processGotIP() { if (node_time.systemTimePresent()) { node_time.initTime(); } -#ifdef USES_MQTT +#if FEATURE_MQTT mqtt_reconnect_count = 0; MQTTclient_should_reconnect = true; timermqtt_interval = 100; Scheduler.setIntervalTimer(ESPEasy_Scheduler::IntervalTimer_e::TIMER_MQTT); scheduleNextMQTTdelayQueue(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT Scheduler.sendGratuitousARP_now(); if (Settings.UseRules) @@ -491,7 +491,7 @@ void processConnectAPmode() { addLogMove(LOG_LEVEL_INFO, log); } - #ifdef FEATURE_DNS_SERVER + #if FEATURE_DNS_SERVER // Start DNS, only used if the ESP has no valid WiFi config // It will reply with it's own address on all DNS requests // (captive portal concept) @@ -499,7 +499,7 @@ void processConnectAPmode() { dnsServerActive = true; dnsServer.start(DNS_PORT, "*", apIP); } - #endif + #endif // if FEATURE_DNS_SERVER } // Switch of AP mode when timeout reached and no client connected anymore. @@ -664,13 +664,13 @@ void processEthernetGotIP() { if (node_time.systemTimePresent()) { node_time.initTime(); } -#ifdef USES_MQTT +#if FEATURE_MQTT mqtt_reconnect_count = 0; MQTTclient_should_reconnect = true; timermqtt_interval = 100; Scheduler.setIntervalTimer(ESPEasy_Scheduler::IntervalTimer_e::TIMER_MQTT); scheduleNextMQTTdelayQueue(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT Scheduler.sendGratuitousARP_now(); if (Settings.UseRules) diff --git a/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp b/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp index 9f7fd6934..46712664c 100644 --- a/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp +++ b/src/src/ESPEasyCore/ESPEasy_backgroundtasks.cpp @@ -53,7 +53,7 @@ void backgroundtasks() lastRunBackgroundTasks = millis(); START_TIMER - #ifdef FEATURE_MDNS + #if FEATURE_MDNS const bool networkConnected = NetworkConnected(); #else NetworkConnected(); @@ -83,13 +83,13 @@ void backgroundtasks() #endif } - #ifdef FEATURE_DNS_SERVER + #if FEATURE_DNS_SERVER // process DNS, only used if the ESP has no valid WiFi config if (dnsServerActive) { dnsServer.processNextRequest(); } - #endif // ifdef FEATURE_DNS_SERVER + #endif // if FEATURE_DNS_SERVER #if FEATURE_ARDUINO_OTA @@ -107,7 +107,7 @@ void backgroundtasks() #endif // if FEATURE_ARDUINO_OTA - #ifdef FEATURE_MDNS + #if FEATURE_MDNS // Allow MDNS processing if (networkConnected) { @@ -117,7 +117,7 @@ void backgroundtasks() MDNS.update(); # endif // ifdef ESP8266 } - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS delay(0); diff --git a/src/src/ESPEasyCore/ESPEasy_loop.cpp b/src/src/ESPEasyCore/ESPEasy_loop.cpp index 813f49f7f..373f26d65 100644 --- a/src/src/ESPEasyCore/ESPEasy_loop.cpp +++ b/src/src/ESPEasyCore/ESPEasy_loop.cpp @@ -138,9 +138,9 @@ void ESPEasy_loop() // Deep sleep mode, just run all tasks one (more) time and go back to sleep as fast as possible if ((firstLoopConnectionsEstablished || readyForSleep()) && isDeepSleepEnabled()) { -#ifdef USES_MQTT +#if FEATURE_MQTT runPeriodicalMQTT(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT // Now run all frequent tasks run50TimesPerSecond(); run10TimesPerSecond(); diff --git a/src/src/ESPEasyCore/ESPEasy_setup.cpp b/src/src/ESPEasyCore/ESPEasy_setup.cpp index f533a3aba..0d3c93b27 100644 --- a/src/src/ESPEasyCore/ESPEasy_setup.cpp +++ b/src/src/ESPEasyCore/ESPEasy_setup.cpp @@ -280,7 +280,7 @@ void ESPEasy_setup() if (toDisable != 0) { toDisable = disableController(toDisable); } - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER if (toDisable != 0) { toDisable = disableNotification(toDisable); } @@ -297,7 +297,7 @@ void ESPEasy_setup() if (toDisable != 0) { toDisable = disableAllControllers(toDisable); } -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER if (toDisable != 0) { toDisable = disableAllNotifications(toDisable); } @@ -380,12 +380,12 @@ void ESPEasy_setup() #ifndef BUILD_NO_RAM_TRACKER logMemUsageAfter(F("CPluginInit()")); #endif - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER NPluginInit(); #ifndef BUILD_NO_RAM_TRACKER logMemUsageAfter(F("NPluginInit()")); #endif - #endif // ifdef USES_NOTIFIER + #endif // if FEATURE_NOTIFIER PluginInit(); #ifndef BUILD_NO_RAM_TRACKER @@ -453,9 +453,9 @@ void ESPEasy_setup() #endif - #ifdef FEATURE_REPORTING + #if FEATURE_REPORTING ReportStatus(); - #endif // ifdef FEATURE_REPORTING + #endif // if FEATURE_REPORTING #if FEATURE_ARDUINO_OTA ArduinoOTAInit(); diff --git a/src/src/Globals/MQTT.cpp b/src/src/Globals/MQTT.cpp index 32e9449ce..ca236e58f 100644 --- a/src/src/Globals/MQTT.cpp +++ b/src/src/Globals/MQTT.cpp @@ -2,7 +2,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_MQTT +#if FEATURE_MQTT // MQTT client @@ -13,7 +13,7 @@ bool MQTTclient_must_send_LWT_connected = false; bool MQTTclient_connected = false; int mqtt_reconnect_count = 0; LongTermTimer MQTTclient_next_connect_attempt; -#endif // USES_MQTT +#endif // if FEATURE_MQTT #ifdef USES_P037 diff --git a/src/src/Globals/MQTT.h b/src/src/Globals/MQTT.h index 460804978..bc5ce4549 100644 --- a/src/src/Globals/MQTT.h +++ b/src/src/Globals/MQTT.h @@ -4,7 +4,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_MQTT +#if FEATURE_MQTT # include # include @@ -19,7 +19,7 @@ extern bool MQTTclient_must_send_LWT_connected; extern bool MQTTclient_connected; extern int mqtt_reconnect_count; extern LongTermTimer MQTTclient_next_connect_attempt; -#endif // USES_MQTT +#endif // if FEATURE_MQTT #ifdef USES_P037 diff --git a/src/src/Globals/NPlugins.cpp b/src/src/Globals/NPlugins.cpp index 9dde4086c..3dbea1df2 100644 --- a/src/src/Globals/NPlugins.cpp +++ b/src/src/Globals/NPlugins.cpp @@ -1,6 +1,6 @@ #include "../Globals/NPlugins.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../DataStructs/ESPEasy_EventStruct.h" #include "../DataStructs/NotificationStruct.h" diff --git a/src/src/Globals/NPlugins.h b/src/src/Globals/NPlugins.h index 72bfa4b22..266a684bb 100644 --- a/src/src/Globals/NPlugins.h +++ b/src/src/Globals/NPlugins.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../CustomBuild/ESPEasyLimits.h" #include "../DataStructs/NotificationStruct.h" diff --git a/src/src/Globals/Services.cpp b/src/src/Globals/Services.cpp index 52f65b832..f3971e2a4 100644 --- a/src/src/Globals/Services.cpp +++ b/src/src/Globals/Services.cpp @@ -22,8 +22,8 @@ #endif -#ifdef FEATURE_DNS_SERVER +#if FEATURE_DNS_SERVER #include DNSServer dnsServer; bool dnsServerActive = false; -#endif +#endif // if FEATURE_DNS_SERVER diff --git a/src/src/Globals/Services.h b/src/src/Globals/Services.h index 2a3ac3450..7d4197e51 100644 --- a/src/src/Globals/Services.h +++ b/src/src/Globals/Services.h @@ -4,7 +4,7 @@ #include "../../ESPEasy_common.h" -#ifdef FEATURE_MDNS +#if FEATURE_MDNS //enable mDNS mode (adds about 6kb ram and some bytes IRAM) #ifdef ESP8266 #include @@ -49,11 +49,11 @@ #endif -#ifdef FEATURE_DNS_SERVER +#if FEATURE_DNS_SERVER #include extern DNSServer dnsServer; extern bool dnsServerActive; -#endif +#endif // if FEATURE_DNS_SERVER #endif // GLOBALS_SERVICES_H diff --git a/src/src/Helpers/ESPEasy_FactoryDefault.cpp b/src/src/Helpers/ESPEasy_FactoryDefault.cpp index 4545f667c..491d35259 100644 --- a/src/src/Helpers/ESPEasy_FactoryDefault.cpp +++ b/src/src/Helpers/ESPEasy_FactoryDefault.cpp @@ -109,9 +109,9 @@ void ResetFactory() // pad files with extra zeros for future extensions InitFile(SettingsType::SettingsFileEnum::FILE_CONFIG_type); InitFile(SettingsType::SettingsFileEnum::FILE_SECURITY_type); - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER InitFile(SettingsType::SettingsFileEnum::FILE_NOTIFICATION_type); - #endif + #endif // if FEATURE_NOTIFIER InitFile(getRulesFileName(0), 0); diff --git a/src/src/Helpers/ESPEasy_Storage.cpp b/src/src/Helpers/ESPEasy_Storage.cpp index f3d663048..611c8f794 100644 --- a/src/src/Helpers/ESPEasy_Storage.cpp +++ b/src/src/Helpers/ESPEasy_Storage.cpp @@ -223,7 +223,7 @@ String BuildFixes() } if (Settings.Build <= 20106) { // ClientID is now defined in the controller settings. - #ifdef USES_MQTT + #if FEATURE_MQTT controllerIndex_t controller_idx = firstEnabledMQTT_ControllerIndex(); if (validControllerIndex(controller_idx)) { MakeControllerSettings(ControllerSettings); //-V522 @@ -247,7 +247,7 @@ String BuildFixes() SaveControllerSettings(controller_idx, ControllerSettings); } } - #endif // USES_MQTT + #endif // if FEATURE_MQTT } if (Settings.Build < 20107) { Settings.WebserverPort = 80; @@ -660,7 +660,7 @@ uint8_t disableAllControllers(uint8_t bootFailedCount) { /********************************************************************************************\ Disable Notification, based on bootFailedCount \*********************************************************************************************/ -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER uint8_t disableNotification(uint8_t bootFailedCount) { for (uint8_t i = 0; i < NOTIFICATION_MAX && bootFailedCount > 0; ++i) { if (Settings.NotificationEnabled[i]) { @@ -1159,7 +1159,7 @@ String loadProvisioningSettings(ProvisioningStruct& ProvisioningSettings) #endif -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER /********************************************************************************************\ Save Controller settings to file system \*********************************************************************************************/ diff --git a/src/src/Helpers/ESPEasy_Storage.h b/src/src/Helpers/ESPEasy_Storage.h index bbd17d132..fc3dbd323 100644 --- a/src/src/Helpers/ESPEasy_Storage.h +++ b/src/src/Helpers/ESPEasy_Storage.h @@ -89,7 +89,7 @@ uint8_t disableAllControllers(uint8_t bootFailedCount); /********************************************************************************************\ Disable Notification, based on bootFailedCount \*********************************************************************************************/ -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER uint8_t disableNotification(uint8_t bootFailedCount); uint8_t disableAllNotifications(uint8_t bootFailedCount); #endif @@ -195,7 +195,7 @@ String loadProvisioningSettings(ProvisioningStruct& ProvisioningSettings); -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER /********************************************************************************************\ Save Controller settings to file system \*********************************************************************************************/ diff --git a/src/src/Helpers/ESPEasy_checks.cpp b/src/src/Helpers/ESPEasy_checks.cpp index 2f9548eaa..1139b8108 100644 --- a/src/src/Helpers/ESPEasy_checks.cpp +++ b/src/src/Helpers/ESPEasy_checks.cpp @@ -38,10 +38,10 @@ #include "../ControllerQueue/C016_queue_element.h" #endif -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../DataStructs/NotificationStruct.h" #include "../DataStructs/NotificationSettingsStruct.h" -#endif +#endif // if FEATURE_NOTIFIER // ******************************************************************************** @@ -83,9 +83,9 @@ void run_compiletime_checks() { #endif check_size(); check_size(); - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER check_size(); - #endif + #endif // if FEATURE_NOTIFIER check_size(); #if ESP_IDF_VERSION_MAJOR > 3 // String class has increased with 4 bytes @@ -106,9 +106,9 @@ void run_compiletime_checks() { check_size(); // Is not stored check_size(); // Is not stored check_size(); - #ifdef USES_NOTIFIER + #if FEATURE_NOTIFIER check_size(); - #endif + #endif // if FEATURE_NOTIFIER #if FEATURE_ESPEASY_P2P #if ESP_IDF_VERSION_MAJOR > 3 // String class has increased with 4 bytes @@ -131,7 +131,7 @@ void run_compiletime_checks() { #endif - #if defined(USE_NON_STANDARD_24_TASKS) && defined(ESP8266) + #if FEATURE_NON_STANDARD_24_TASKS && defined(ESP8266) static_assert(TASKS_MAX == 24, "TASKS_MAX invalid size"); #endif diff --git a/src/src/Helpers/MDNS_Helper.cpp b/src/src/Helpers/MDNS_Helper.cpp index 9d9fa0bc3..c75b06472 100644 --- a/src/src/Helpers/MDNS_Helper.cpp +++ b/src/src/Helpers/MDNS_Helper.cpp @@ -12,7 +12,7 @@ #include "../Helpers/StringProvider.h" void set_mDNS() { - #ifdef FEATURE_MDNS + #if FEATURE_MDNS if (!WiFiEventData.WiFiServicesInitialized()) { return; } @@ -46,5 +46,5 @@ void set_mDNS() { mDNS_init = false; #endif } - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS } diff --git a/src/src/Helpers/OTA.cpp b/src/src/Helpers/OTA.cpp index de902b1b5..624bea983 100644 --- a/src/src/Helpers/OTA.cpp +++ b/src/src/Helpers/OTA.cpp @@ -100,7 +100,7 @@ void ArduinoOTAInit() reboot(ESPEasy_Scheduler::IntendedRebootReason_e::OTA_error); }); - #if defined(ESP8266) && defined(FEATURE_MDNS) + #if defined(ESP8266) && FEATURE_MDNS ArduinoOTA.begin(true); #else ArduinoOTA.begin(); diff --git a/src/src/Helpers/PeriodicalActions.cpp b/src/src/Helpers/PeriodicalActions.cpp index 0f9a27c70..31543222b 100644 --- a/src/src/Helpers/PeriodicalActions.cpp +++ b/src/src/Helpers/PeriodicalActions.cpp @@ -245,13 +245,13 @@ void runEach30Seconds() } #endif - #ifdef FEATURE_REPORTING + #if FEATURE_REPORTING ReportStatus(); - #endif + #endif // if FEATURE_REPORTING } -#ifdef USES_MQTT +#if FEATURE_MQTT void scheduleNextMQTTdelayQueue() { @@ -387,7 +387,7 @@ controllerIndex_t firstEnabledMQTT_ControllerIndex() { } -#endif //USES_MQTT +#endif //if FEATURE_MQTT @@ -437,25 +437,25 @@ void updateLoopStats_30sec(uint8_t loglevel) { \*********************************************************************************************/ void flushAndDisconnectAllClients() { if (anyControllerEnabled()) { -#ifdef USES_MQTT +#if FEATURE_MQTT bool mqttControllerEnabled = validControllerIndex(firstEnabledMQTT_ControllerIndex()); -#endif //USES_MQTT +#endif //if FEATURE_MQTT unsigned long timer = millis() + 1000; while (!timeOutReached(timer)) { // call to all controllers (delay queue) to flush all data. CPluginCall(CPlugin::Function::CPLUGIN_FLUSH, 0); -#ifdef USES_MQTT +#if FEATURE_MQTT if (mqttControllerEnabled && MQTTclient.connected()) { MQTTclient.loop(); } -#endif //USES_MQTT +#endif //if FEATURE_MQTT } -#ifdef USES_MQTT +#if FEATURE_MQTT if (mqttControllerEnabled && MQTTclient.connected()) { MQTTclient.disconnect(); updateMQTTclient_connected(); } -#endif //USES_MQTT +#endif //if FEATURE_MQTT saveToRTC(); delay(100); // Flush anything in the network buffers. } @@ -465,9 +465,9 @@ void flushAndDisconnectAllClients() { void prepareShutdown(ESPEasy_Scheduler::IntendedRebootReason_e reason) { -#ifdef USES_MQTT +#if FEATURE_MQTT runPeriodicalMQTT(); // Flush outstanding MQTT messages -#endif // USES_MQTT +#endif // if FEATURE_MQTT process_serialWriteBuffer(); flushAndDisconnectAllClients(); saveUserVarToRTC(); diff --git a/src/src/Helpers/PeriodicalActions.h b/src/src/Helpers/PeriodicalActions.h index 985c33c6f..2d147b7d9 100644 --- a/src/src/Helpers/PeriodicalActions.h +++ b/src/src/Helpers/PeriodicalActions.h @@ -28,7 +28,7 @@ void runOncePerSecond(); \*********************************************************************************************/ void runEach30Seconds(); -#ifdef USES_MQTT +#if FEATURE_MQTT void scheduleNextMQTTdelayQueue(); void schedule_all_MQTTimport_tasks(); @@ -42,7 +42,7 @@ void runPeriodicalMQTT(); controllerIndex_t firstEnabledMQTT_ControllerIndex(); -#endif //USES_MQTT +#endif //if FEATURE_MQTT void logTimerStatistics(); diff --git a/src/src/Helpers/Scheduler.cpp b/src/src/Helpers/Scheduler.cpp index 0c8e21d59..b1fac89cb 100644 --- a/src/src/Helpers/Scheduler.cpp +++ b/src/src/Helpers/Scheduler.cpp @@ -79,7 +79,7 @@ const __FlashStringHelper * ESPEasy_Scheduler::toString(ESPEasy_Scheduler::Plugi switch (pluginType) { case PluginPtrType::TaskPlugin: return F("Plugin"); case PluginPtrType::ControllerPlugin: return F("Controller"); -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER case PluginPtrType::NotificationPlugin: return F("Notification"); #endif } @@ -427,9 +427,9 @@ void ESPEasy_Scheduler::process_interval_timer(IntervalTimer_e id, unsigned long case IntervalTimer_e::TIMER_1SEC: runOncePerSecond(); break; case IntervalTimer_e::TIMER_30SEC: runEach30Seconds(); break; case IntervalTimer_e::TIMER_MQTT: -#ifdef USES_MQTT +#if FEATURE_MQTT runPeriodicalMQTT(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT break; case IntervalTimer_e::TIMER_STATISTICS: logTimerStatistics(); break; case IntervalTimer_e::TIMER_GRATUITOUS_ARP: @@ -446,9 +446,9 @@ void ESPEasy_Scheduler::process_interval_timer(IntervalTimer_e id, unsigned long } break; case IntervalTimer_e::TIMER_MQTT_DELAY_QUEUE: -#ifdef USES_MQTT +#if FEATURE_MQTT processMQTTdelayQueue(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT break; case IntervalTimer_e::TIMER_C001_DELAY_QUEUE: #ifdef USES_C001 @@ -1055,7 +1055,7 @@ void ESPEasy_Scheduler::schedule_plugin_task_event_timer(deviceIndex_t DeviceInd } } -#ifdef USES_MQTT +#if FEATURE_MQTT void ESPEasy_Scheduler::schedule_mqtt_plugin_import_event_timer(deviceIndex_t DeviceIndex, taskIndex_t TaskIndex, uint8_t Function, @@ -1102,7 +1102,7 @@ unsigned long ESPEasy_Scheduler::createSystemEventMixedId(PluginPtrType ptr_type return getMixedId(SchedulerTimerType_e::SystemEventQueue, subId); } -#ifdef USES_MQTT +#if FEATURE_MQTT void ESPEasy_Scheduler::schedule_mqtt_controller_event_timer(protocolIndex_t ProtocolIndex, CPlugin::Function Function, char *c_topic, @@ -1129,7 +1129,7 @@ void ESPEasy_Scheduler::schedule_mqtt_controller_event_timer(protocolIndex_t P } #endif -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER void ESPEasy_Scheduler::schedule_notification_event_timer(uint8_t NotificationProtocolIndex, NPlugin::Function Function, struct EventStruct&& event) { @@ -1184,7 +1184,7 @@ void ESPEasy_Scheduler::process_system_event_queue() { case PluginPtrType::ControllerPlugin: CPluginCall(Index, static_cast(Function), &ScheduledEventQueue.front().event, tmpString); break; -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER case PluginPtrType::NotificationPlugin: NPlugin_ptr[Index](static_cast(Function), &ScheduledEventQueue.front().event, tmpString); break; diff --git a/src/src/Helpers/Scheduler.h b/src/src/Helpers/Scheduler.h index b4394017d..29b7eec45 100644 --- a/src/src/Helpers/Scheduler.h +++ b/src/src/Helpers/Scheduler.h @@ -75,7 +75,7 @@ public: enum class PluginPtrType { TaskPlugin, ControllerPlugin -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER ,NotificationPlugin #endif }; @@ -254,7 +254,7 @@ public: uint8_t Function, struct EventStruct&& event); -#ifdef USES_MQTT +#if FEATURE_MQTT void schedule_mqtt_plugin_import_event_timer(deviceIndex_t DeviceIndex, taskIndex_t TaskIndex, uint8_t Function, @@ -269,7 +269,7 @@ public: uint8_t Function, struct EventStruct&& event); -#ifdef USES_MQTT +#if FEATURE_MQTT void schedule_mqtt_controller_event_timer(protocolIndex_t ProtocolIndex, CPlugin::Function Function, char *c_topic, @@ -278,7 +278,7 @@ public: #endif // Note: The event will be moved -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER void schedule_notification_event_timer(uint8_t NotificationProtocolIndex, NPlugin::Function Function, struct EventStruct&& event); diff --git a/src/src/Helpers/StringGenerator_System.cpp b/src/src/Helpers/StringGenerator_System.cpp index aa6e4a0cd..98a7ddaf7 100644 --- a/src/src/Helpers/StringGenerator_System.cpp +++ b/src/src/Helpers/StringGenerator_System.cpp @@ -6,7 +6,7 @@ \*********************************************************************************************/ -#ifdef USES_MQTT +#if FEATURE_MQTT #include #include "../Globals/MQTT.h" @@ -28,7 +28,7 @@ const __FlashStringHelper * getMQTT_state() { return F(""); } -#endif // USES_MQTT +#endif // if FEATURE_MQTT /********************************************************************************************\ Get system information @@ -183,9 +183,9 @@ String getPluginDescriptionString() { result += F(PLUGIN_DESCR); result += ']'; #endif // ifdef PLUGIN_DESCR - #ifdef USE_NON_STANDARD_24_TASKS + #if FEATURE_NON_STANDARD_24_TASKS && defined(ESP8266) result += F(" 24tasks"); - #endif // ifdef USE_NON_STANDARD_24_TASKS + #endif // if FEATURE_NON_STANDARD_24_TASKS && defined(ESP8266) result.trim(); return result; } diff --git a/src/src/Helpers/StringGenerator_System.h b/src/src/Helpers/StringGenerator_System.h index a5d9052bb..b16c744ac 100644 --- a/src/src/Helpers/StringGenerator_System.h +++ b/src/src/Helpers/StringGenerator_System.h @@ -10,9 +10,9 @@ ESPEasy specific strings \*********************************************************************************************/ -#ifdef USES_MQTT +#if FEATURE_MQTT const __FlashStringHelper * getMQTT_state(); -#endif // USES_MQTT +#endif // if FEATURE_MQTT /********************************************************************************************\ Get system information diff --git a/src/src/Helpers/StringProvider.cpp b/src/src/Helpers/StringProvider.cpp index 19f1ffa04..ba756a77d 100644 --- a/src/src/Helpers/StringProvider.cpp +++ b/src/src/Helpers/StringProvider.cpp @@ -119,9 +119,9 @@ const __FlashStringHelper * getLabel(LabelType::Enum label) { case LabelType::IP_ADDRESS_SUBNET: return F("IP / Subnet"); case LabelType::GATEWAY: return F("Gateway"); case LabelType::CLIENT_IP: return F("Client IP"); - #ifdef FEATURE_MDNS + #if FEATURE_MDNS case LabelType::M_DNS: return F("mDNS"); - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS case LabelType::DNS: return F("DNS"); case LabelType::DNS_1: return F("DNS 1"); case LabelType::DNS_2: return F("DNS 2"); @@ -318,9 +318,9 @@ String getValue(LabelType::Enum label) { case LabelType::GATEWAY: return NetworkGatewayIP().toString(); case LabelType::CLIENT_IP: return formatIP(web_server.client().remoteIP()); - #ifdef FEATURE_MDNS + #if FEATURE_MDNS case LabelType::M_DNS: return String(NetworkGetHostname()) + F(".local"); - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS case LabelType::DNS: return String(getValue(LabelType::DNS_1) + F(" / ") + getValue(LabelType::DNS_2)); case LabelType::DNS_1: return NetworkDnsIP(0).toString(); case LabelType::DNS_2: return NetworkDnsIP(1).toString(); diff --git a/src/src/Helpers/StringProvider.h b/src/src/Helpers/StringProvider.h index dceac3659..62b566b1a 100644 --- a/src/src/Helpers/StringProvider.h +++ b/src/src/Helpers/StringProvider.h @@ -80,9 +80,9 @@ struct LabelType { IP_ADDRESS_SUBNET, // 192.168.1.123 / 255.255.255.0 GATEWAY, // 192.168.1.1 CLIENT_IP, // 192.168.1.67 - #ifdef FEATURE_MDNS + #if FEATURE_MDNS M_DNS, // breadboard.local - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS DNS, // 192.168.1.1 / (IP unset) DNS_1, DNS_2, diff --git a/src/src/Helpers/SystemVariables.cpp b/src/src/Helpers/SystemVariables.cpp index 6e7cbde83..73293653d 100644 --- a/src/src/Helpers/SystemVariables.cpp +++ b/src/src/Helpers/SystemVariables.cpp @@ -15,9 +15,9 @@ #include "../Globals/CRCValues.h" #include "../Globals/ESPEasy_time.h" #include "../Globals/ESPEasyWiFiEvent.h" -#ifdef USES_MQTT +#if FEATURE_MQTT # include "../Globals/MQTT.h" -#endif // ifdef USES_MQTT +#endif // if FEATURE_MQTT #include "../Globals/NetworkState.h" #include "../Globals/RuntimeData.h" #include "../Globals/Settings.h" @@ -138,11 +138,11 @@ String SystemVariables::getSystemVariable(SystemVariables::Enum enumval) { case BSSID: return String((WiFiEventData.WiFiDisconnected()) ? MAC_address().toString() : WiFi.BSSIDstr()); case CR: return String('\r'); case IP4: return String(static_cast(NetworkLocalIP()[3])); // 4th IP octet - #ifdef USES_MQTT + #if FEATURE_MQTT case ISMQTT: return String(MQTTclient_connected ? 1 : 0); - #else // ifdef USES_MQTT + #else // if FEATURE_MQTT case ISMQTT: return String('0'); - #endif // ifdef USES_MQTT + #endif // if FEATURE_MQTT #ifdef USES_P037 case ISMQTTIMP: return String(P037_MQTTImport_connected ? 1 : 0); diff --git a/src/src/Helpers/_CPlugin_LoRa_TTN_helper.cpp b/src/src/Helpers/_CPlugin_LoRa_TTN_helper.cpp index d76348a08..916860cef 100644 --- a/src/src/Helpers/_CPlugin_LoRa_TTN_helper.cpp +++ b/src/src/Helpers/_CPlugin_LoRa_TTN_helper.cpp @@ -10,7 +10,7 @@ // # Helper functions to encode data for use on LoRa/TTN network. // ####################################################################################################### -#if defined(USES_PACKED_RAW_DATA) +#if FEATURE_PACKED_RAW_DATA String getPackedFromPlugin(struct EventStruct *event, uint8_t sampleSetCount) @@ -104,4 +104,4 @@ float getLoRaAirTime(uint8_t pl, uint8_t sf, uint16_t bw, uint8_t cr, uint8_t n_ return t_air; } -#endif // USES_PACKED_RAW_DATA +#endif // if FEATURE_PACKED_RAW_DATA diff --git a/src/src/Helpers/_CPlugin_LoRa_TTN_helper.h b/src/src/Helpers/_CPlugin_LoRa_TTN_helper.h index e280a75eb..018314905 100644 --- a/src/src/Helpers/_CPlugin_LoRa_TTN_helper.h +++ b/src/src/Helpers/_CPlugin_LoRa_TTN_helper.h @@ -8,7 +8,7 @@ // # Helper functions to encode data for use on LoRa/TTN network. // ####################################################################################################### -#if defined(USES_PACKED_RAW_DATA) +#if FEATURE_PACKED_RAW_DATA #include "../DataStructs/ESPEasy_packed_raw_data.h" @@ -32,7 +32,7 @@ float getLoRaAirTime(uint8_t pl, bool header = true, bool crc = true); -#endif // USES_PACKED_RAW_DATA +#endif // if FEATURE_PACKED_RAW_DATA diff --git a/src/src/Helpers/_NPlugin_init.cpp b/src/src/Helpers/_NPlugin_init.cpp index 05b610697..597b87d08 100644 --- a/src/src/Helpers/_NPlugin_init.cpp +++ b/src/src/Helpers/_NPlugin_init.cpp @@ -1,6 +1,6 @@ #include "../Helpers/_NPlugin_init.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../DataStructs/ESPEasy_EventStruct.h" #include "../DataStructs/TimingStats.h" diff --git a/src/src/Helpers/_NPlugin_init.h b/src/src/Helpers/_NPlugin_init.h index c1cbfce8f..2fc641384 100644 --- a/src/src/Helpers/_NPlugin_init.h +++ b/src/src/Helpers/_NPlugin_init.h @@ -3,7 +3,7 @@ #include "../../ESPEasy_common.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../DataTypes/ESPEasy_plugin_functions.h" diff --git a/src/src/PluginStructs/P037_data_struct.cpp b/src/src/PluginStructs/P037_data_struct.cpp index f80a408be..e2b509311 100644 --- a/src/src/PluginStructs/P037_data_struct.cpp +++ b/src/src/PluginStructs/P037_data_struct.cpp @@ -36,9 +36,9 @@ bool P037_data_struct::loadSettings() { String tmp[1]; LoadCustomTaskSettings(_taskIndex, tmp, - 1, 41, offset); - globalTopicPrefix = std::move(tmp[0]); - offset += 41; + 1, 41, offset); + globalTopicPrefix = std::move(tmp[0]); + offset += 41; } @@ -51,34 +51,36 @@ bool P037_data_struct::loadSettings() { String P037_data_struct::saveSettings() { String res; + if (_taskIndex < TASKS_MAX) { size_t offset = 0; res += SaveCustomTaskSettings(_taskIndex, mqttTopics, - VARS_PER_TASK, 41, offset); + VARS_PER_TASK, 41, offset); offset += VARS_PER_TASK * 41; res += SaveCustomTaskSettings(_taskIndex, jsonAttributes, - VARS_PER_TASK, 21, offset); + VARS_PER_TASK, 21, offset); offset += VARS_PER_TASK * 21; { String tmp[1]; tmp[0] = globalTopicPrefix; - res += SaveCustomTaskSettings(_taskIndex, tmp, - 1, 41, offset); + res += SaveCustomTaskSettings(_taskIndex, tmp, + 1, 41, offset); offset += 41; } res += SaveCustomTaskSettings(_taskIndex, valueArray, - P037_ARRAY_SIZE, 0, offset + 1); + P037_ARRAY_SIZE, 0, offset + 1); } return res; } String P037_data_struct::getFullMQTTTopic(uint8_t taskValueIndex) const { String topic; - if (taskValueIndex < VARS_PER_TASK && mqttTopics[taskValueIndex].length() > 0) { + + if ((taskValueIndex < VARS_PER_TASK) && (mqttTopics[taskValueIndex].length() > 0)) { topic.reserve(globalTopicPrefix.length() + mqttTopics[taskValueIndex].length()); topic = globalTopicPrefix; topic.trim(); @@ -88,9 +90,9 @@ String P037_data_struct::getFullMQTTTopic(uint8_t taskValueIndex) const { return topic; } - bool P037_data_struct::shouldSubscribeToMQTTtopic(const String& topic) const { - if (topic.length() == 0) return false; + if (topic.length() == 0) { return false; } + for (uint8_t x = 0; x < VARS_PER_TASK; x++) { if (topic.equalsIgnoreCase(getFullMQTTTopic(x))) { @@ -124,8 +126,11 @@ void P037_data_struct::parseMappings() { _maxFilter = 0; // Initialize to empty # endif // if P037_FILTER_SUPPORT + # if P037_MAPPING_SUPPORT || P037_FILTER_SUPPORT + int8_t idx; + # endif // if P037_MAPPING_SUPPORT || P037_FILTER_SUPPORT # if P037_MAPPING_SUPPORT - int8_t idx = P037_MAX_MAPPINGS; + idx = P037_MAX_MAPPINGS; for (uint8_t mappingOffset = P037_END_MAPPINGS; mappingOffset >= P037_START_MAPPINGS && _maxIdx == 0; mappingOffset--) { if (!valueArray[mappingOffset].isEmpty()) { @@ -475,7 +480,6 @@ bool P037_data_struct::webform_load( return success; } // webform_load - bool P037_data_struct::webform_save( # if P037_FILTER_SUPPORT bool filterEnabled @@ -503,8 +507,8 @@ bool P037_data_struct::webform_save( # ifdef P037_JSON_SUPPORT if (jsonEnabled) { - argName = F("attribute"); - argName += (varNr + 1); + argName = F("attribute"); + argName += (varNr + 1); jsonAttributes[varNr] = web_server.arg(argName); } # endif // P037_JSON_SUPPORT @@ -515,6 +519,7 @@ bool P037_data_struct::webform_save( # if P037_MAPPING_SUPPORT || P037_FILTER_SUPPORT String left, right; bool firstError; + int8_t idx = 0; # endif // if P037_MAPPING_SUPPORT || P037_FILTER_SUPPORT // Mappings are processed first @@ -522,7 +527,6 @@ bool P037_data_struct::webform_save( firstError = true; String operands = P037_OPERAND_LIST; uint8_t mapNr = 1; - int8_t idx = 0; left.reserve(32); right.reserve(32); diff --git a/src/src/PluginStructs/P037_data_struct.h b/src/src/PluginStructs/P037_data_struct.h index 8b5ef6c8b..4e813ba4b 100644 --- a/src/src/PluginStructs/P037_data_struct.h +++ b/src/src/PluginStructs/P037_data_struct.h @@ -39,22 +39,27 @@ # endif // ifdef PLUGIN_037_DEBUG # if P037_MAPPING_SUPPORT # undef P037_MAPPING_SUPPORT +# define P037_MAPPING_SUPPORT 0 # endif // if P037_MAPPING_SUPPORT -# if defined(FEATURE_ADC_VCC) && P037_FILTER_SUPPORT +# if FEATURE_ADC_VCC && P037_FILTER_SUPPORT # undef P037_FILTER_SUPPORT -# endif // if defined(FEATURE_ADC_VCC) && P037_FILTER_SUPPORT +# define P037_FILTER_SUPPORT 0 +# endif // if FEATURE_ADC_VCC && P037_FILTER_SUPPORT // #if P037_JSON_SUPPORT // #undef P037_JSON_SUPPORT +// #define P037_JSON_SUPPORT 0 // #endif # endif // if defined(LIMIT_BUILD_SIZE) && !defined(P037_OVERRIDE) # ifdef PLUGIN_DISPLAY_COLLECTION # if P037_FILTER_SUPPORT # undef P037_FILTER_SUPPORT +# define P037_FILTER_SUPPORT 0 # endif // if P037_FILTER_SUPPORT # if P037_REPLACE_BY_COMMA_SUPPORT # undef P037_REPLACE_BY_COMMA_SUPPORT +# define P037_REPLACE_BY_COMMA_SUPPORT 0 # endif // if P037_REPLACE_BY_COMMA_SUPPORT # endif // ifdef PLUGIN_DISPLAY_COLLECTION # endif // ifndef PLUGIN_BUILD_MAX_ESP32 diff --git a/src/src/WebServer/ConfigPage.cpp b/src/src/WebServer/ConfigPage.cpp index 66854380f..c38154d3d 100644 --- a/src/src/WebServer/ConfigPage.cpp +++ b/src/src/WebServer/ConfigPage.cpp @@ -52,13 +52,13 @@ void handle_config() { addLog(LOG_LEVEL_INFO, F("Unit Name changed.")); if (CPluginCall(CPlugin::Function::CPLUGIN_GOT_INVALID, 0)) { // inform controllers that the old name will be invalid from now on. -#ifdef USES_MQTT +#if FEATURE_MQTT MQTTDisconnect(); // disconnect form MQTT Server if invalid message was sent succesfull. -#endif // USES_MQTT +#endif // if FEATURE_MQTT } -#ifdef USES_MQTT +#if FEATURE_MQTT MQTTclient_should_reconnect = true; -#endif // USES_MQTT +#endif // if FEATURE_MQTT } // Unit name diff --git a/src/src/WebServer/ControllerPage.cpp b/src/src/WebServer/ControllerPage.cpp index 502182c93..3a05985fb 100644 --- a/src/src/WebServer/ControllerPage.cpp +++ b/src/src/WebServer/ControllerPage.cpp @@ -362,7 +362,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex { addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_PASS); } - #ifdef USES_MQTT + #if FEATURE_MQTT if (Protocol[ProtocolIndex].usesMQTT) { addTableSeparator(F("MQTT"), 2, 3); @@ -373,7 +373,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex addFormNote(F("Updated on load of this page")); addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_RETAINFLAG); } - #endif // USES_MQTT + #endif // if FEATURE_MQTT if (Protocol[ProtocolIndex].usesTemplate || Protocol[ProtocolIndex].usesMQTT) @@ -381,7 +381,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_SUBSCRIBE); addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_PUBLISH); } - #ifdef USES_MQTT + #if FEATURE_MQTT if (Protocol[ProtocolIndex].usesMQTT) { addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_LWT_TOPIC); @@ -391,7 +391,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_WILL_RETAIN); addControllerParameterForm(ControllerSettings, controllerindex, ControllerSettingsStruct::CONTROLLER_CLEAN_SESSION); } - #endif // USES_MQTT + #endif // if FEATURE_MQTT } } // End of scope for ControllerSettings, destruct it to save memory. diff --git a/src/src/WebServer/JSON.cpp b/src/src/WebServer/JSON.cpp index b88d4c30e..5a37bddb2 100644 --- a/src/src/WebServer/JSON.cpp +++ b/src/src/WebServer/JSON.cpp @@ -212,9 +212,9 @@ void handle_json() static const LabelType::Enum labels[] PROGMEM = { LabelType::HOST_NAME, - #ifdef FEATURE_MDNS + #if FEATURE_MDNS LabelType::M_DNS, - #endif // ifdef FEATURE_MDNS + #endif // if FEATURE_MDNS LabelType::IP_CONFIG, LabelType::IP_ADDRESS, LabelType::IP_SUBNET, @@ -556,7 +556,7 @@ void handle_buildinfo() { } json_close(true); } -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER { json_open(true, F("notifications")); diff --git a/src/src/WebServer/NotificationPage.cpp b/src/src/WebServer/NotificationPage.cpp index 88048aa5e..bf26c991d 100644 --- a/src/src/WebServer/NotificationPage.cpp +++ b/src/src/WebServer/NotificationPage.cpp @@ -1,6 +1,6 @@ #include "../WebServer/NotificationPage.h" -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER #include "../WebServer/WebServer.h" #include "../WebServer/HTML_wrappers.h" @@ -21,6 +21,8 @@ // ******************************************************************************** // Web Interface notifcations page // ******************************************************************************** + + #include "../Globals/NPlugins.h" @@ -242,4 +244,4 @@ void handle_notifications() { TXBuffer.endStream(); } -#endif // USES_NOTIFIER +#endif // FEATURE_NOTIFIER diff --git a/src/src/WebServer/NotificationPage.h b/src/src/WebServer/NotificationPage.h index 853fa803b..8819358b8 100644 --- a/src/src/WebServer/NotificationPage.h +++ b/src/src/WebServer/NotificationPage.h @@ -7,11 +7,11 @@ // Web Interface notifcations page // ******************************************************************************** -#ifdef USES_NOTIFIER +#if FEATURE_NOTIFIER void handle_notifications(); -#endif // USES_NOTIFIER +#endif // FEATURE_NOTIFIER #endif \ No newline at end of file diff --git a/src/src/WebServer/RootPage.cpp b/src/src/WebServer/RootPage.cpp index 26baaf2f9..446392053 100644 --- a/src/src/WebServer/RootPage.cpp +++ b/src/src/WebServer/RootPage.cpp @@ -26,7 +26,7 @@ #include "../../ESPEasy-Globals.h" -#ifdef USES_MQTT +#if FEATURE_MQTT # include "../Globals/MQTT.h" # include "../Helpers/PeriodicalActions.h" // For finding enabled MQTT controller #endif @@ -205,7 +205,7 @@ void handle_root() { } #endif // if FEATURE_ETHERNET - #ifdef FEATURE_MDNS + #if FEATURE_MDNS { addRowLabel(LabelType::M_DNS); addHtml(F("