[Build] Fix building ESPEasy in PlatformIO 6.1.7 (#4656)

* [PIO build] Update build scripts for scons 4.5.x

* [Build] Fix build error due to strange cast of double type in rules

* [Build] Work-around for new ESP8266 macro of round()

Whoever thought it would be a good idea to make round() an explicit cast to `long`....

* [Build ESP8266] Replace calls to round()

* [Build] Use HWrandom to overcome build issues

* [Build] Fix missing include

* [Build] Remove extern "C" to allow for (C++) function overloading

* [Build] include ESPEasy_common.h instead of Arduino.h where possible

* [Cleanup] Moving not commonly needed code out of ESPEasy_common.h

* [Build] Remove "Helpers" folder from concat script

* [Build] Include ESPEasy_common.h instead of ESPEasy_config.h

* [Build] Add Helpers folder to concat .cpp for ESP8266

* [Build] Add ESPEasyCore to concat cpp & split global RulesCalculate obj

* [Build test] Disable lots of plugins + not concat Helpers/*.cpp

* [Build test] Disable P037 to test build failures

* [Build test] Undef round right after include <Arduino.h>

* [Build] Revert disabling plugins + concat Helpers/*.cpp

* [Build] Include cmath after Arduino.h to redefine round()

* [Build] Fix ESP32 build error

* [Build] Add ESP32_CLASSIC define for ESP32 IR build
This commit is contained in:
TD-er
2023-05-10 23:00:33 +02:00
committed by GitHub
parent e14450ccbb
commit cc7602539f
150 changed files with 470 additions and 348 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ upload_speed = 115200
monitor_speed = 115200
;targets = size, checkprogsize
targets =
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands_tmp/> -<*/ControllerQueue_tmp/> -<*/DataStructs_tmp/> -<*/DataTypes_tmp/> -<*/Globals_tmp/> -<*/Helpers_tmp/> -<*/PluginStructs_tmp/> -<*/WebServer_tmp/>
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands_tmp/> -<*/ControllerQueue_tmp/> -<*/DataStructs_tmp/> -<*/DataTypes_tmp/> -<*/ESPEasyCore_tmp/> -<*/Globals_tmp/> -<*/Helpers_tmp/> -<*/PluginStructs_tmp/> -<*/WebServer_tmp/>
; Backwards compatibility: https://github.com/platformio/platformio-core/issues/4270
;build_src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands/> -<*/ControllerQueue/> -<*/DataStructs/> -<*/DataTypes/> -<*/Globals/> -<*/Helpers/> -<*/PluginStructs/> -<*/WebServer/>
+1 -1
View File
@@ -74,6 +74,7 @@ build_flags = ${esp82xx_2_5_x.build_flags}
-DCORE_POST_2_6_0
; remove the 4-bytes alignment for PSTR()
-DPSTR_ALIGN=1
-Werror=return-type
lib_ignore = ${esp82xx_defaults.lib_ignore}
@@ -81,7 +82,6 @@ lib_ignore = ${esp82xx_defaults.lib_ignore}
build_flags = ${esp82xx_2_6_x.build_flags}
-DCORE_POST_3_0_0
-Wno-deprecated-declarations
-Werror=return-type
lib_ignore = ${esp82xx_defaults.lib_ignore}
+6 -5
View File
@@ -60,6 +60,7 @@ lib_ignore = ${esp32_always.lib_ignore}
HeatpumpIR
ESP32 BLE Arduino
build_flags = ${esp32_base.build_flags}
-DESP32_CLASSIC
extra_scripts = ${esp32_base.extra_scripts}
build_unflags = ${esp32_base.build_unflags}
-fexceptions
@@ -76,7 +77,7 @@ board_build.filesystem = littlefs
extends = esp32_base
lib_ignore = ${esp32_always.lib_ignore}
ESP32_ping
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_NORMAL_IRext
-DCOLLECTION_USE_RTTTL
@@ -115,7 +116,7 @@ board_upload.flash_size = 16MB
[env:custom_IR_ESP32_4M316k]
extends = esp32_base
board = esp32_4M
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32_common.build_flags}
-DPLUGIN_BUILD_CUSTOM
-DPLUGIN_BUILD_IR
lib_ignore = ${esp32_always.lib_ignore}
@@ -272,7 +273,7 @@ extra_scripts = ${env:custom_ESP32_4M316k.extra_scripts}
extends = esp32_base
board = esp32_16M8M
board_upload.flash_size = 16MB
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32_common.build_flags}
-DPLUGIN_BUILD_CUSTOM
-DPLUGIN_BUILD_IR
-DFEATURE_ETHERNET=1
@@ -429,7 +430,7 @@ board = esp32_16M1M
board_upload.flash_size = 16MB
lib_ignore = ${esp32_always.lib_ignore}
ESP32_ping
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
@@ -447,7 +448,7 @@ board = esp32_16M8M
board_upload.flash_size = 16MB
lib_ignore = ${esp32_always.lib_ignore}
ESP32_ping
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32_common.build_flags}
-DUSE_LITTLEFS
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
+2 -2
View File
@@ -61,7 +61,7 @@ framework = ${common.framework}
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
targets = ${common.targets}
build_flags = ${debug_flags.build_flags}
build_flags = ${minimal_size.build_flags}
${mqtt_flags.build_flags}
-DHTTPCLIENT_1_1_COMPATIBLE=0
build_unflags = -DDEBUG_ESP_PORT
@@ -80,7 +80,7 @@ lib_ignore = ${esp82xx_defaults.lib_ignore}
monitor_filters = esp8266_exception_decoder
extra_scripts = pre:tools/pio/pre_default_check.py
${extra_scripts_esp8266.extra_scripts}
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands/> -<*/ControllerQueue/> -<*/DataStructs/> -<*/DataTypes/> -<*/Globals/> -<*/Helpers/> -<*/PluginStructs/> -<*/WebServer/>
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands/> -<*/ControllerQueue/> -<*/DataStructs/> -<*/DataTypes/> -<*/ESPEasyCore/> -<*/Globals/> -<*/Helpers/> -<*/PluginStructs/> -<*/WebServer/>
-2
View File
@@ -1,5 +1,3 @@
#include <Arduino.h>
#include "ESPEasy-Globals.h"
-2
View File
@@ -1,6 +1,4 @@
#include <Arduino.h>
#ifdef CONTINUOUS_INTEGRATION
# pragma GCC diagnostic error "-Wall"
#else // ifdef CONTINUOUS_INTEGRATION
+34 -27
View File
@@ -1,6 +1,8 @@
#ifndef ESPEASY_COMMON_H
#define ESPEASY_COMMON_H
#ifdef __cplusplus
// *****************************************************************************************
// For Arduino IDE users:
// When building using Custom.h, uncomment the next line:
@@ -14,7 +16,10 @@
*/
#include <Arduino.h>
#include <Arduino.h> // See: https://github.com/esp8266/Arduino/issues/8922#issuecomment-1542301697
#include <cmath>
// User configuration
#include "include/ESPEasy_config.h"
#include "./src/CustomBuild/ESPEasyDefaults.h"
@@ -39,7 +44,7 @@
#endif
//#include "src/DataStructs/NodeStruct.h"
#include "src/DataTypes/NodeTypeID.h"
//#include "src/DataTypes/NodeTypeID.h"
#include "src/Globals/RamTracker.h"
#include "src/ESPEasyCore/ESPEasy_Log.h"
#include "src/Helpers/ESPEasy_math.h"
@@ -47,7 +52,6 @@
#if defined(ESP8266)
#include <core_version.h>
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASYM_STD
#include <lwip/init.h>
#ifndef LWIP_VERSION_MAJOR
#error
@@ -57,32 +61,43 @@
#else
#include <lwip/tcp_impl.h>
#endif
#include <ESP8266WiFi.h>
// #include <ESP8266WiFi.h>
//#include <ESP8266Ping.h>
#ifndef LWIP_OPEN_SRC
#define LWIP_OPEN_SRC
#endif
#include <lwip/opt.h>
#include <lwip/udp.h>
#include <lwip/igmp.h>
#include <include/UdpContext.h>
// #include <lwip/opt.h>
// #include <lwip/udp.h>
// #include <lwip/igmp.h>
// #include <include/UdpContext.h>
#include <limits.h>
/*
extern "C" {
#include <user_interface.h>
}
*/
#define SMALLEST_OTA_IMAGE 276848 // smallest known 2-step OTA image
#define MAX_SKETCH_SIZE 1044464 // 1020 kB - 16 bytes
#endif
/*
#if defined(ESP32)
#include <WiFi.h>
#ifdef ESP32S2
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32S2_STD
#include <esp32s2/rom/rtc.h>
#elif defined(ESP32S3)
#include <esp32s3/rom/rtc.h>
#elif defined(ESP32C3)
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32C3_STD
#else
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32_STD
#include <esp32c3/rom/rtc.h>
# elif defined(ESP32_CLASSIC)
#if ESP_IDF_VERSION_MAJOR > 3
#include <esp32/rom/rtc.h>
#else
#include <rom/rtc.h>
#endif
# else
static_assert(false, "Implement processor architecture");
#endif
// #include <WiFi.h>
// #include "esp32_ping.h"
@@ -99,27 +114,18 @@
#include <esp_wifi.h> // Needed to call ESP-IDF functions like esp_wifi_....
#endif
*/
#include <WiFiUdp.h>
#include <Wire.h>
#include <SPI.h>
//#include <WiFiUdp.h>
//#include <Wire.h>
//#include <SPI.h>
extern const String EMPTY_STRING;
#ifndef ARDUINO_OTA_PORT
#if defined(ESP32)
#define ARDUINO_OTA_PORT 3232
#else
// Do not use port 8266 for OTA, since that's used for ESPeasy p2p
#define ARDUINO_OTA_PORT 18266
#endif
#endif
#if defined(ESP8266)
//enable Arduino OTA updating.
//Note: This adds around 10kb to the firmware size, and 1kb extra ram.
@@ -133,5 +139,6 @@ extern const String EMPTY_STRING;
//#define FEATURE_MDNS
#endif
#endif
#endif // ESPEASY_COMMON_H
+1
View File
@@ -1,6 +1,7 @@
#include "src/Helpers/_CPlugin_Helper.h"
#ifdef USES_C009
#include "src/DataTypes/NodeTypeID.h"
#include "src/Helpers/StringProvider.h"
#include "src/CustomBuild/ESPEasy_buildinfo.h"
+1
View File
@@ -2,6 +2,7 @@
#ifdef USES_C014
# include "src/Commands/InternalCommands.h"
# include "src/DataTypes/NodeTypeID.h"
# include "src/Globals/Device.h"
# include "src/Globals/MQTT.h"
# include "src/Globals/Plugins.h"
+1 -1
View File
@@ -15,7 +15,7 @@
// apply float/double math compare functions instead of regular comparisons
# include "src/Helpers/ESPEasy_math.h"
# include "src/Helpers/Rules_calculate.h"
# include "src/Globals/RulesCalculate.h"
# include "src/WebServer/ESPEasy_WebServer.h"
# define PLUGIN_021
+1 -3
View File
@@ -1,9 +1,7 @@
#ifndef PLUGIN_HELPER_H
#define PLUGIN_HELPER_H
#include <Arduino.h>
#include "include/ESPEasy_config.h"
#include "ESPEasy_common.h"
#include "src/CustomBuild/ESPEasyLimits.h"
-1
View File
@@ -2,7 +2,6 @@
#define COMMAND_COMMON_H
#include <ctype.h>
#include <Arduino.h>
#include "../../ESPEasy_common.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_CONTROLLR_H
#define COMMAND_CONTROLLR_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_Controller_Disable(struct EventStruct *event, const char* Line);
const __FlashStringHelper * Command_Controller_Enable(struct EventStruct *event, const char* Line);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_GPIO_H
#define COMMAND_GPIO_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// FIXME TD-er: This fwd declaration should not be in .h file.
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_HTTP_H
#define COMMAND_HTTP_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#if FEATURE_SEND_TO_HTTP || FEATURE_POST_TO_HTTP || FEATURE_PUT_TO_HTTP
const __FlashStringHelper* httpEmitToHTTP(struct EventStruct *event,
+2 -2
View File
@@ -1,11 +1,11 @@
#ifndef COMMANDS_INTERNALCOMMANDS_H
#define COMMANDS_INTERNALCOMMANDS_H
#include "../../ESPEasy_common.h"
#include "../DataStructs/ESPEasy_EventStruct.h"
#include "../Globals/Plugins.h"
#include <Arduino.h>
bool checkSourceFlags(EventValueSource::Enum source, EventValueSourceGroup::Enum group);
-2
View File
@@ -5,8 +5,6 @@
#if FEATURE_MQTT
#include <Arduino.h>
const __FlashStringHelper * Command_MQTT_Publish(struct EventStruct *event,
const char *Line);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_RTC_H
#define COMMAND_RTC_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_RTC_Clear(struct EventStruct *event, const char* Line);
const __FlashStringHelper * Command_RTC_resetFlashWriteCounter(struct EventStruct *event, const char* Line);
+1 -1
View File
@@ -12,11 +12,11 @@
#include "../ESPEasyCore/ESPEasyRules.h"
#include "../Globals/EventQueue.h"
#include "../Globals/RulesCalculate.h"
#include "../Globals/RuntimeData.h"
#include "../Globals/Settings.h"
#include "../Helpers/Misc.h"
#include "../Helpers/Rules_calculate.h"
#include "../Helpers/StringConverter.h"
const __FlashStringHelper * Command_Rules_Execute(struct EventStruct *event, const char *Line)
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_RULES_H
#define COMMAND_RULES_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_Rules_Execute(struct EventStruct *event, const char *Line);
String Command_Rules_UseRules(struct EventStruct *event, const char *Line);
-1
View File
@@ -5,7 +5,6 @@
#if FEATURE_SERVO
# include <Arduino.h>
# include <map>
# include <Servo.h>
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_SETTINGS_H
#define COMMAND_SETTINGS_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
String Command_Settings_Build(struct EventStruct *event, const char* Line);
String Command_Settings_Unit(struct EventStruct *event, const char* Line);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_SYSTEM_H
#define COMMAND_SYSTEM_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_System_NoSleep(struct EventStruct *event, const char* Line);
const __FlashStringHelper * Command_System_deepSleep(struct EventStruct *event, const char* Line);
+1 -1
View File
@@ -12,12 +12,12 @@
#include "../ESPEasyCore/Serial.h"
#include "../Globals/ESPEasy_Scheduler.h"
#include "../Globals/RulesCalculate.h"
#include "../Globals/RuntimeData.h"
#include "../Globals/Settings.h"
#include "../Helpers/Misc.h"
#include "../Helpers/Numerical.h"
#include "../Helpers/Rules_calculate.h"
#include "../Helpers/StringConverter.h"
#include "../Helpers/StringParser.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_TIMER_H
#define COMMAND_TIMER_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_Timer_Set (struct EventStruct *event, const char* Line);
const __FlashStringHelper * Command_Timer_Set_ms (struct EventStruct *event, const char* Line);
-1
View File
@@ -3,7 +3,6 @@
#include "../../ESPEasy_common.h"
#include <Arduino.h>
String Command_UDP_Port(struct EventStruct *event, const char* Line);
#if FEATURE_ESPEASY_P2P
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef COMMAND_I2C_H
#define COMMAND_I2C_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper * Command_i2c_Scanner(struct EventStruct *event, const char* Line);
+2
View File
@@ -11,6 +11,8 @@
#include "../Helpers/StringConverter.h"
#include <Wire.h>
const __FlashStringHelper * Command_WD_Config(EventStruct *event, const char* Line)
{
Wire.beginTransmission(event->Par1); // address
+3 -2
View File
@@ -2,6 +2,9 @@
#define CONTROLLERQUEUE_C011_QUEUE_ELEMENT_H
#include "../../ESPEasy_common.h"
#ifdef USES_C011
#include "../ControllerQueue/Queue_element_base.h"
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataStructs/DeviceStruct.h"
@@ -12,8 +15,6 @@
struct EventStruct;
#ifdef USES_C011
/*********************************************************************************************\
* C011_queue_element for queueing requests for C011: Generic HTTP Advanced.
\*********************************************************************************************/
+3 -1
View File
@@ -2,6 +2,9 @@
#define CONTROLLERQUEUE_C015_QUEUE_ELEMENT_H
#include "../../ESPEasy_common.h"
#ifdef USES_C015
#include "../ControllerQueue/Queue_element_base.h"
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataStructs/UnitMessageCount.h"
@@ -10,7 +13,6 @@
struct EventStruct;
#ifdef USES_C015
/*********************************************************************************************\
* C015_queue_element for queueing requests for 015: Blynk
@@ -20,7 +20,7 @@
#include "../Helpers/Scheduler.h"
#include "../Helpers/StringConverter.h"
#include <Arduino.h>
#include <list>
#include <memory> // For std::shared_ptr
#include <new> // std::nothrow
+4
View File
@@ -1,7 +1,11 @@
#ifndef CUSTOMBUILD_COMPILETIMEDEFINES_H
#define CUSTOMBUILD_COMPILETIMEDEFINES_H
#include <Arduino.h>
#ifdef ESP8266
#undef round //see https://github.com/esp8266/Arduino/issues/5787#issuecomment-465852231
#endif
// Build NR is used as a "revision" nr for settings
+1 -1
View File
@@ -2904,4 +2904,4 @@ To create/register a plugin, you have to :
#endif
#endif
#endif // CUSTOMBUILD_DEFINE_PLUGIN_SETS_H
#endif // CUSTOMBUILD_DEFINE_PLUGIN_SETS_H
@@ -5,7 +5,6 @@
#ifdef USES_C013
# include <Arduino.h>
# include "../CustomBuild/ESPEasyLimits.h"
# include "../DataStructs/DeviceStruct.h"
+2 -1
View File
@@ -1,7 +1,6 @@
#ifndef DATASTRUCTS_CACHES_H
#define DATASTRUCTS_CACHES_H
#include <map>
#include "../../ESPEasy_common.h"
#include "../CustomBuild/ESPEasyLimits.h"
@@ -14,6 +13,8 @@
#include "../Helpers/RulesHelper.h"
#include <map>
// Key is combination of array index + some offset reflecting the used array
// Store those sparingly used TaskDevicePluginConfigLong and TaskDevicePluginConfig
// from the ExtraTaskSettings
@@ -4,7 +4,8 @@
/*********************************************************************************************\
* ControllerSettingsStruct definition
\*********************************************************************************************/
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include <memory> // For std::shared_ptr
#include <new> // for std::nothrow
@@ -12,7 +13,6 @@
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include "../../ESPEasy_common.h"
#include "../DataStructs/ChecksumType.h"
#include "../Globals/Plugins.h"
+2 -1
View File
@@ -2,7 +2,8 @@
#define DATASTRUCTS_DEVICESTRUCTS_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include <vector>
#include "../DataTypes/SensorVType.h"
@@ -5,7 +5,6 @@
#if FEATURE_RTC_CACHE_STORAGE
#include <Arduino.h>
#include "../DataStructs/RTC_cache_handler_struct.h"
@@ -1,5 +1,7 @@
#include "../DataStructs/ESPEasy_EventStruct.h"
#include "../../ESPEasy_common.h"
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataTypes/EventValueSource.h"
#include "../Globals/Plugins.h"
@@ -3,8 +3,6 @@
#include "../../ESPEasy_common.h"
#include <Arduino.h>
#include "../DataTypes/ControllerIndex.h"
#include "../DataTypes/EventValueSource.h"
#include "../DataTypes/TaskIndex.h"
+1
View File
@@ -12,6 +12,7 @@
#ifdef ESP32
# include <esp_event.h>
# include <WiFi.h>
#endif // ifdef ESP32
@@ -1,7 +1,8 @@
#ifndef DATASTRUCTS_EVENTSTRUCTCOMMANDWRAPPER_H
#define DATASTRUCTS_EVENTSTRUCTCOMMANDWRAPPER_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include "../DataStructs/ESPEasy_EventStruct.h"
struct EventStructCommandWrapper {
@@ -5,7 +5,7 @@
* ExtraTaskSettingsStruct
\*********************************************************************************************/
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataStructs/ChecksumType.h"
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef DATASTRUCTS_I2C_TYPES_H
#define DATASTRUCTS_I2C_TYPES_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include <vector>
// **************************************************************************/
-1
View File
@@ -1,7 +1,6 @@
#ifndef DATASTRUCTS_LOGSTRUCT_H
#define DATASTRUCTS_LOGSTRUCT_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
+2
View File
@@ -10,6 +10,8 @@
#include "../Globals/ESPEasy_now_state.h"
#endif
#include "../DataTypes/NodeTypeID.h"
#if FEATURE_MQTT
#include "../ESPEasyCore/Controller.h"
#endif
@@ -5,7 +5,6 @@
#if FEATURE_NOTIFIER
#include <Arduino.h>
#include <memory> // For std::shared_ptr
/*********************************************************************************************\
+2
View File
@@ -8,6 +8,8 @@
# include "../DataStructs/FactoryDefaultPref.h"
# include "../DataTypes/ESPEasyFileType.h"
# include <memory> // for std::shared_ptr
/*********************************************************************************************\
* ProvisioningStruct
\*********************************************************************************************/
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATASTRUCTS_TIMECHANGERULE_H
#define DATASTRUCTS_TIMECHANGERULE_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// structure to describe rules for when daylight/summer time begins,
// or when standard time begins.
-1
View File
@@ -11,7 +11,6 @@
# include "../Globals/Settings.h"
# include "../Helpers/ESPEasy_time_calc.h"
# include <Arduino.h>
# include <map>
#endif // if FEATURE_TIMING_STATS
+1 -1
View File
@@ -425,7 +425,7 @@ void SettingsStruct_tmpl<N_TASKS>::validate() {
if ((Longitude < -180.0f) || (Longitude > 180.0f)) { Longitude = 0.0f; }
if (VariousBits1 > (1 << 31)) { VariousBits1 = 0; } // FIXME: Check really needed/useful?
if (VariousBits1 > (1u << 31)) { VariousBits1 = 0; } // FIXME: Check really needed/useful?
ZERO_TERMINATE(Name);
ZERO_TERMINATE(NTPHost);
+1 -2
View File
@@ -1,8 +1,7 @@
#ifndef DATATYPES_CPLUGINID_H
#define DATATYPES_CPLUGINID_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t cpluginID_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_CONTROLLERINDEX_H
#define DATATYPES_CONTROLLERINDEX_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t controllerIndex_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_DEVICEINDEX_H
#define DATATYPES_DEVICEINDEX_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t deviceIndex_t;
+1 -1
View File
@@ -5,7 +5,7 @@
Pre defined settings for off-the-shelf hardware
\*********************************************************************************************/
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// This enum will be stored, so do not change order or at least the values.
enum class DeviceModel : uint8_t {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_ESPEASYFILETYPE_H
#define DATATYPES_ESPEASYFILETYPE_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
struct FileType {
enum Enum : short {
-2
View File
@@ -1,7 +1,5 @@
#include "../DataTypes/ESPEasyTimeSource.h"
#include <Arduino.h>
#include "../../ESPEasy_common.h"
const __FlashStringHelper* toString(timeSource_t timeSource)
+3 -1
View File
@@ -2,8 +2,10 @@
#define DATATYPES_ESPEASYTIMESOURCE_H
#include "../../ESPEasy_common.h"
#include <stdint.h>
#include <Arduino.h>
class String;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATASTRUCTS_ETHERNETPARAMETERS_H
#define DATASTRUCTS_ETHERNETPARAMETERS_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// Is stored in settings
enum class EthClockMode_t : uint8_t {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_EVENT_VALUE_SOURCE_H
#define DATATYPES_EVENT_VALUE_SOURCE_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
struct EventValueSourceGroup {
enum class Enum : uint8_t {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_NPLUGINID_H
#define DATATYPES_NPLUGINID_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t npluginID_t;
-2
View File
@@ -1,8 +1,6 @@
#ifndef DATATYPES_NETWORKMEDIUM_H
#define DATATYPES_NETWORKMEDIUM_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// Is stored in settings
+25 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_NODETYPEID_H
#define DATATYPES_NODETYPEID_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#define NODE_TYPE_ID_ESP_EASY_STD 1
#define NODE_TYPE_ID_RPI_EASY_STD 5 // https://github.com/enesbcs/rpieasy
@@ -12,6 +12,30 @@
#define NODE_TYPE_ID_ARDUINO_EASY_STD 65
#define NODE_TYPE_ID_NANO_EASY_STD 81
#if defined(ESP8266)
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASYM_STD
#endif
#if defined(ESP32)
#ifdef ESP32S2
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32S2_STD
#elif defined(ESP32S3)
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32S3_STD
#elif defined(ESP32C3)
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32C3_STD
# elif defined(ESP32_CLASSIC)
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32_STD
# else
static_assert(false, "Implement processor architecture");
#endif
#endif
const __FlashStringHelper* toNodeTypeDisplayString(uint8_t nodeType);
#endif // ifndef DATATYPES_NODETYPEID_H
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_NOTIFIERINDEX_H
#define DATATYPES_NOTIFIERINDEX_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t notifierIndex_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_PLUGINID_H
#define DATATYPES_PLUGINID_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t pluginID_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_PROTOCOLINDEX_H
#define DATATYPES_PROTOCOLINDEX_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t protocolIndex_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_SPI_OPTIONS_H
#define DATATYPES_SPI_OPTIONS_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
enum class SPI_Options_e { // Do not change values as this is stored in the settings!
None = 0,
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_TASKINDEX_H
#define DATATYPES_TASKINDEX_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
typedef uint8_t taskIndex_t;
typedef uint16_t userVarIndex_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_TIMESOURCE_H
#define DATATYPES_TIMESOURCE_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
// Do not change order as values are stored in settings
enum class ExtTimeSource_e {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DATATYPES_WIFICONNECTIONPROTOCOL_H
#define DATATYPES_WIFICONNECTIONPROTOCOL_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
enum class WiFiConnectionProtocol {
Unknown,
+1 -1
View File
@@ -23,13 +23,13 @@
#include "../Globals/MQTT.h"
#include "../Globals/Plugins.h"
#include "../Globals/Protocol.h"
#include "../Globals/RulesCalculate.h"
#include "../Helpers/_CPlugin_Helper.h"
#include "../Helpers/Misc.h"
#include "../Helpers/Network.h"
#include "../Helpers/PeriodicalActions.h"
#include "../Helpers/PortStatus.h"
#include "../Helpers/Rules_calculate.h"
#define PLUGIN_ID_MQTT_IMPORT 37
+7 -3
View File
@@ -9,9 +9,13 @@
// Make sure not to call anything in these functions that result in delay() or yield()
// ********************************************************************************
#ifdef ESP32
#if ESP_IDF_VERSION_MAJOR > 3
void EthEvent(WiFiEvent_t event, arduino_event_info_t info);
#endif
#if FEATURE_ETHERNET
#if ESP_IDF_VERSION_MAJOR > 3
#include <WiFi.h>
#include <WiFiType.h>
void EthEvent(WiFiEvent_t event, arduino_event_info_t info);
#endif
#endif
#endif
+2
View File
@@ -5,6 +5,8 @@
#include "../DataStructs/MAC_address.h"
#include <IPAddress.h>
void setNetworkMedium(NetworkMedium_t medium);
void NetworkConnectRelaxed();
+3 -4
View File
@@ -1,5 +1,7 @@
#include "../ESPEasyCore/ESPEasyRules.h"
#include "../../_Plugin_Helper.h"
#include "../Commands/InternalCommands.h"
#include "../DataStructs/TimingStats.h"
#include "../DataTypes/EventValueSource.h"
@@ -10,21 +12,18 @@
#include "../Globals/EventQueue.h"
#include "../Globals/Plugins.h"
#include "../Globals/Plugins_other.h"
#include "../Globals/RulesCalculate.h"
#include "../Globals/Settings.h"
#include "../Helpers/ESPEasy_Storage.h"
#include "../Helpers/ESPEasy_time_calc.h"
#include "../Helpers/FS_Helper.h"
#include "../Helpers/Misc.h"
#include "../Helpers/Numerical.h"
#include "../Helpers/Rules_calculate.h"
#include "../Helpers/RulesHelper.h"
#include "../Helpers/RulesMatcher.h"
#include "../Helpers/StringConverter.h"
#include "../Helpers/StringParser.h"
#include "../../_Plugin_Helper.h"
#include <math.h>
#include <vector>
+2
View File
@@ -13,6 +13,7 @@
#ifdef ESP32
#include <IPv6Address.h>
#include <WiFiSTA.h>
#include <WiFi.h>
class WiFi_Access_Static_IP : public WiFiSTAClass {
public:
@@ -40,6 +41,7 @@ void setUseStaticIP(bool enabled);
// ********************************************************************************
#ifdef ESP32
#if ESP_IDF_VERSION_MAJOR > 3
#include <WiFiType.h>
void WiFiEvent(WiFiEvent_t event, arduino_event_info_t info);
#else
void WiFiEvent(system_event_id_t event, system_event_info_t info);
+1
View File
@@ -25,6 +25,7 @@
#ifdef ESP32
#include <WiFiGeneric.h>
#include <esp_wifi.h> // Needed to call ESP-IDF functions like esp_wifi_....
#endif
// FIXME TD-er: Cleanup of WiFi code
-1
View File
@@ -5,7 +5,6 @@
#ifdef USES_C016
# include <Arduino.h>
# include "../DataStructs/ESPEasyControllerCache.h"
# include "../DataStructs/ESPEasy_EventStruct.h"
# include "../DataStructs/DeviceStruct.h"
+1 -1
View File
@@ -6,7 +6,7 @@
#include "../DataStructs/WiFiEventData.h"
#include <Arduino.h>
#include <IPAddress.h>
#include <stdint.h>
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_MAINLOOPCOMMAND_H
#define GLOBALS_MAINLOOPCOMMAND_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
extern uint8_t cmd_within_mainloop;
+1 -1
View File
@@ -14,7 +14,7 @@
#include <map>
#include <vector>
#include <Arduino.h>
typedef uint8_t nprotocolIndex_t;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_NETWORKSTATE_H
#define GLOBALS_NETWORKSTATE_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include <IPAddress.h>
#include <WiFiUdp.h>
+2 -2
View File
@@ -3,14 +3,14 @@
#include "../../ESPEasy_common.h"
#include <map>
#include <vector>
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataTypes/PluginID.h"
#include "../DataTypes/DeviceIndex.h"
#include "../DataTypes/TaskIndex.h"
#include <map>
#include <vector>
/********************************************************************************************\
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_PLUGIN_OTHER_H
#define GLOBALS_PLUGIN_OTHER_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
#include "../CustomBuild/ESPEasyLimits.h"
+2
View File
@@ -1,6 +1,8 @@
#ifndef GLOBALS_PROTOCOL_H
#define GLOBALS_PROTOCOL_H
#include "../../ESPEasy_common.h"
#include "../DataStructs/ProtocolStruct.h"
#include "../CustomBuild/ESPEasyLimits.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#define TRACES 3 // number of memory traces
#define TRACEENTRIES 15 // entries per trace
#include <Arduino.h>
#include "../../ESPEasy_common.h"
/********************************************************************************************\
+90
View File
@@ -0,0 +1,90 @@
#include "../Globals/RulesCalculate.h"
#include "../DataStructs/TimingStats.h"
#include "../Helpers/Numerical.h"
#include "../Helpers/StringConverter_Numerical.h"
RulesCalculate_t RulesCalculate{};
/*******************************************************************************************
* Helper functions to actually interact with the rules calculation functions.
* *****************************************************************************************/
int CalculateParam(const String& TmpStr) {
int returnValue = 0;
// Minimize calls to the Calulate function.
// Only if TmpStr starts with '=' then call Calculate(). Otherwise do not call it
if (TmpStr[0] != '=') {
validIntFromString(TmpStr, returnValue);
} else {
double param = 0;
// Starts with an '=', so Calculate starting at next position
CalculateReturnCode returnCode = Calculate(TmpStr.substring(1), param);
if (!isError(returnCode)) {
#ifndef BUILD_NO_DEBUG
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
String log = F("CALCULATE PARAM: ");
log += TmpStr;
log += F(" = ");
log += roundf(param);
addLogMove(LOG_LEVEL_DEBUG, log);
}
#endif // ifndef BUILD_NO_DEBUG
}
returnValue = roundf(param); // return integer only as it's valid only for device and task id
}
return returnValue;
}
CalculateReturnCode Calculate(const String& input,
double & result)
{
START_TIMER;
CalculateReturnCode returnCode = RulesCalculate.doCalculate(
RulesCalculate_t::preProces(input).c_str(),
&result);
if (isError(returnCode)) {
if (loglevelActiveFor(LOG_LEVEL_ERROR)) {
String log = F("Calculate: ");
switch (returnCode) {
case CalculateReturnCode::ERROR_STACK_OVERFLOW:
log += F("Stack Overflow");
break;
case CalculateReturnCode::ERROR_BAD_OPERATOR:
log += F("Bad Operator");
break;
case CalculateReturnCode::ERROR_PARENTHESES_MISMATCHED:
log += F("Parenthesis mismatch");
break;
case CalculateReturnCode::ERROR_UNKNOWN_TOKEN:
log += F("Unknown token");
break;
case CalculateReturnCode::ERROR_TOKEN_LENGTH_EXCEEDED:
log += String(F("Exceeded token length (")) + TOKEN_LENGTH + ')';
break;
case CalculateReturnCode::OK:
// Already handled, but need to have all cases here so the compiler can warn if we're missing one.
break;
}
#ifndef BUILD_NO_DEBUG
log += F(" input: ");
log += input;
log += F(" = ");
const bool trimTrailingZeros = true;
log += doubleToString(result, 6, trimTrailingZeros);
#endif // ifndef BUILD_NO_DEBUG
addLogMove(LOG_LEVEL_ERROR, log);
}
}
STOP_TIMER(COMPUTE_STATS);
return returnCode;
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef GLOBALS_RULESCALCULATE_H
#define GLOBALS_RULESCALCULATE_H
#include "../Helpers/Rules_calculate.h"
/********************************************************************************************\
Instance of the RulesCalculate to perform calculations
These functions are wrapped in a class to
- make it more clear what external functions to use
- Make sure generic function names will not cause conflicts
- Prevent external access to calculate only variables.
\*********************************************************************************************/
extern RulesCalculate_t RulesCalculate;
/*******************************************************************************************
* Helper functions to actually interact with the rules calculation functions.
* *****************************************************************************************/
int CalculateParam(const String& TmpStr);
CalculateReturnCode Calculate(const String& input,
double & result);
#endif
+2
View File
@@ -1,6 +1,8 @@
#ifndef GLOBALS_RUNTIMEDATA_H
#define GLOBALS_RUNTIMEDATA_H
#include "../../ESPEasy_common.h"
#include "../CustomBuild/ESPEasyLimits.h"
#include "../DataStructs/UserVarStruct.h"
-1
View File
@@ -1,6 +1,5 @@
#include "../Globals/Statistics.h"
#include <Arduino.h>
#ifndef BUILD_NO_RAM_TRACKER
uint32_t lowestRAM = 0;
+5 -3
View File
@@ -5,9 +5,6 @@
# include "../Helpers/StringConverter.h"
# include "../WebServer/Markup_Forms.h"
# if FEATURE_SD && defined(ADAGFX_ENABLE_BMP_DISPLAY)
# include <SD.h>
# endif // if FEATURE_SD && defined(ADAGFX_ENABLE_BMP_DISPLAY)
# if ADAGFX_FONTS_INCLUDED
# include "../Static/Fonts/Seven_Segment24pt7b.h"
@@ -67,6 +64,11 @@
# endif // ifdef ADAGFX_FONTS_EXTRA_20PT_INCLUDED
# endif // if ADAGFX_FONTS_INCLUDED
# if FEATURE_SD && defined(ADAGFX_ENABLE_BMP_DISPLAY)
# include <SD.h>
# endif // if FEATURE_SD && defined(ADAGFX_ENABLE_BMP_DISPLAY)
/******************************************************************************************
* get the display text for a 'text print mode' enum value
*****************************************************************************************/
+6 -5
View File
@@ -38,7 +38,12 @@
* Make 8 and 16 color support optional to squeeze a few bytes from size limited builds
* 2022-05-23 tonhuisman: Add changelog, older changes have not been logged.
***************************************************************************/
# include <Arduino.h>
# include "../Helpers/Numerical.h"
# include "../Helpers/ESPEasy_Storage.h"
# include "../ESPEasyCore/ESPEasy_Log.h"
# include <Adafruit_GFX.h>
# include <Adafruit_SPITFT.h>
# include <FS.h>
@@ -47,10 +52,6 @@
// Used for bmp support
# define BUFPIXELS 200 ///< 200 * 5 = 1000 bytes
# include "../Helpers/Numerical.h"
# include "../Helpers/ESPEasy_Storage.h"
# include "../ESPEasyCore/ESPEasy_Log.h"
# define ADAGFX_PARSE_MAX_ARGS 7 // Maximum number of arguments needed and supported (corrected)
# ifndef ADAGFX_ARGUMENT_VALIDATION
# define ADAGFX_ARGUMENT_VALIDATION 1 // Validate command arguments
-1
View File
@@ -1,7 +1,6 @@
#ifndef HELPERS_AUDIO_H
#define HELPERS_AUDIO_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef HELPERS_CRC_FUNCTIONS_H
#define HELPERS_CRC_FUNCTIONS_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
int calc_CRC16(const String& text);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef HELPERS_CONVERT_H
#define HELPERS_CONVERT_H
#include <Arduino.h>
#include "../../ESPEasy_common.h"
/*********************************************************************************************\
Convert bearing in degree to bearing string
+12
View File
@@ -0,0 +1,12 @@
#include "../Helpers/ESPEasyMutex.h"
#ifdef ESP8266
// ESP8266 doesn't have a proper mutex system.
// This is by no means a perfect implementation, but the assembly implementation was causing lots of issues with esp8266/Arduino 3.0.0
// See: https://github.com/letscontrolit/ESPEasy/issues/3693#issuecomment-868847669
ESPEasy_Mutex::ESPEasy_Mutex() {
_mutex = 1;
}
#endif
+1 -3
View File
@@ -30,9 +30,7 @@ struct ESPEasy_Mutex {
// ESP8266 doesn't have a proper mutex system.
// This is by no means a perfect implementation, but the assembly implementation was causing lots of issues with esp8266/Arduino 3.0.0
// See: https://github.com/letscontrolit/ESPEasy/issues/3693#issuecomment-868847669
ESPEasy_Mutex() {
_mutex = 1;
}
ESPEasy_Mutex();
// May cause deadlock, perhaps add a timeout?
void lock() {
+3
View File
@@ -1,5 +1,8 @@
#include "../Helpers/ESPEasy_math.h"
#include <Arduino.h>
// Need to include Arduino.h first, then cmath
// See: https://github.com/esp8266/Arduino/issues/8922#issuecomment-1542301697
#include <cmath>
+6 -6
View File
@@ -231,7 +231,7 @@ unsigned long ESPEasy_time::now() {
#if FEATURE_EXT_RTC
// External RTC only stores with second resolution.
// Thus to limit the error to +/- 500 ms, round the sysTime instead of just casting it.
ExtRTC_set(round(sysTime));
ExtRTC_set(static_cast<uint32_t>(sysTime + 0.5));
#endif
{
const unsigned long abs_time_offset_ms = std::abs(time_offset) * 1000;
@@ -242,7 +242,7 @@ unsigned long ESPEasy_time::now() {
// offset is less than 1 second, so we consider it a regular time sync.
if (abs_time_offset_ms < 100) {
// Good clock stability, use 5 - 6 hour interval
syncInterval = random(18000, 21600);
syncInterval = HwRandom(18000, 21600);
} else {
// Dynamic interval between 30 minutes ... 5 hours.
syncInterval = 1800000 / abs_time_offset_ms;
@@ -252,7 +252,7 @@ unsigned long ESPEasy_time::now() {
}
if (syncInterval <= 3600) {
syncInterval = random(3600, 4000);
syncInterval = HwRandom(3600, 4000);
}
} else if (timeSource == timeSource_t::No_time_source) {
syncInterval = 60;
@@ -380,16 +380,16 @@ bool ESPEasy_time::getNtpTime(double& unixTime_d)
log += Settings.NTPHost;
// When single set host fails, retry again in 20 seconds
nextSyncTime = sysTime + random(20, 60);
nextSyncTime = sysTime + HwRandom(20, 60);
} else {
// Have to do a lookup each time, since the NTP pool always returns another IP
String ntpServerName = String(random(0, 3));
String ntpServerName = String(HwRandom(0, 3));
ntpServerName += F(".pool.ntp.org");
resolveHostByName(ntpServerName.c_str(), timeServerIP);
log += ntpServerName;
// When pool host fails, retry can be much sooner
nextSyncTime = sysTime + random(5, 20);
nextSyncTime = sysTime + HwRandom(5, 20);
useNTPpool = true;
}
-2
View File
@@ -3,8 +3,6 @@
#include "../../ESPEasy_common.h"
#include <Arduino.h>
#include "../DataTypes/ESPEasyTimeSource.h"
#include <time.h>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "../Helpers/ESPEasy_time_calc.h"
#include <Arduino.h>
#include <limits.h>
#include "../Globals/ESPEasy_time.h"

Some files were not shown because too many files have changed in this diff Show More