diff --git a/src/_C005.cpp b/src/_C005.cpp
index 3769c077c4..54bd9b4380 100644
--- a/src/_C005.cpp
+++ b/src/_C005.cpp
@@ -88,8 +88,6 @@ bool CPlugin_005(CPlugin::Function function, struct EventStruct *event, String&
const bool contains_valname = pubname.indexOf(F("%valname%")) != -1;
bool mqtt_retainFlag = CPlugin_005_mqtt_retainFlag;
- parseControllerVariables(pubname, event, false);
-
uint8_t valueCount = getValueCountForTask(event->TaskIndex);
for (uint8_t x = 0; x < valueCount; x++)
@@ -104,6 +102,7 @@ bool CPlugin_005(CPlugin::Function function, struct EventStruct *event, String&
if (contains_valname) {
parseSingleControllerVariable(tmppubname, event, x, false);
}
+ parseControllerVariables(tmppubname, event, false);
String value;
if (event->sensorType == Sensor_VType::SENSOR_TYPE_STRING) {
diff --git a/src/_C006.cpp b/src/_C006.cpp
index 9aa07449b3..b167117539 100644
--- a/src/_C006.cpp
+++ b/src/_C006.cpp
@@ -121,7 +121,6 @@ bool CPlugin_006(CPlugin::Function function, struct EventStruct *event, String&
statusLED(true);
//LoadTaskSettings(event->TaskIndex); // FIXME TD-er: This can probably be removed
- parseControllerVariables(pubname, event, false);
const uint8_t valueCount = getValueCountForTask(event->TaskIndex);
@@ -131,6 +130,7 @@ bool CPlugin_006(CPlugin::Function function, struct EventStruct *event, String&
if (contains_valname) {
parseSingleControllerVariable(tmppubname, event, x, false);
}
+ parseControllerVariables(tmppubname, event, false);
// Small optimization so we don't try to copy potentially large strings
if (event->sensorType == Sensor_VType::SENSOR_TYPE_STRING) {
diff --git a/src/_C008.cpp b/src/_C008.cpp
index 3c21e97436..d7eb87dff0 100644
--- a/src/_C008.cpp
+++ b/src/_C008.cpp
@@ -90,7 +90,6 @@ bool CPlugin_008(CPlugin::Function function, struct EventStruct *event, String&
// Collect the values at the same run, to make sure all are from the same sample
//LoadTaskSettings(event->TaskIndex); // FIXME TD-er: This can probably be removed
- parseControllerVariables(pubname, event, true);
for (uint8_t x = 0; x < valueCount; x++)
{
@@ -105,6 +104,7 @@ bool CPlugin_008(CPlugin::Function function, struct EventStruct *event, String&
if (contains_valname) {
parseSingleControllerVariable(txt, event, x, true);
}
+ parseControllerVariables(txt, event, true);
# ifndef BUILD_NO_DEBUG
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
diff --git a/src/_C010.cpp b/src/_C010.cpp
index ff8921c1c5..c12ff0e60d 100644
--- a/src/_C010.cpp
+++ b/src/_C010.cpp
@@ -83,7 +83,6 @@ bool CPlugin_010(CPlugin::Function function, struct EventStruct *event, String&
LoadControllerSettings(event->ControllerIndex, *ControllerSettings);
pubname = ControllerSettings->Publish;
}
- parseControllerVariables(pubname, event, false);
const bool contains_valname = pubname.indexOf(F("%valname%")) != -1;
for (uint8_t x = 0; x < valueCount; x++)
@@ -97,6 +96,7 @@ bool CPlugin_010(CPlugin::Function function, struct EventStruct *event, String&
if (contains_valname) {
parseSingleControllerVariable(txt, event, x, false);
}
+ parseControllerVariables(txt, event, false);
txt.replace(F("%value%"), formattedValue);
move_special(element->txt[x], std::move(txt));
#ifndef BUILD_NO_DEBUG
diff --git a/src/_C014.cpp b/src/_C014.cpp
index 95aa7d2754..ef05aafb19 100644
--- a/src/_C014.cpp
+++ b/src/_C014.cpp
@@ -886,7 +886,6 @@ bool CPlugin_014(CPlugin::Function function, struct EventStruct *event, String&
statusLED(true);
- parseControllerVariables(pubname, event, false);
LoadTaskSettings(event->TaskIndex);
uint8_t valueCount = getValueCountForTask(event->TaskIndex);
@@ -898,6 +897,7 @@ bool CPlugin_014(CPlugin::Function function, struct EventStruct *event, String&
if (contains_valname) {
parseSingleControllerVariable(tmppubname, event, x, false);
}
+ parseControllerVariables(tmppubname, event, false);
// Small optimization so we don't try to copy potentially large strings
if (event->getSensorType() == Sensor_VType::SENSOR_TYPE_STRING) {
diff --git a/src/_P021_Level.ino b/src/_P021_Level.ino
index 3453edfa19..b6903c355a 100644
--- a/src/_P021_Level.ino
+++ b/src/_P021_Level.ino
@@ -9,6 +9,9 @@
// Extended by timer based state control to support pumps with additional requirements (floor heating ciculation pump)
// Changelog:
+// 2024-12-14, tonhuisman: Move most defines to .h file to avoid compiler warnings, as Arduino doesn't support #ifdef in .ino files
+// Format source using Uncrustify
+// Remove unneeded includes
// 2024-07-07, flashmark: Reworked to support floor heating pump (added state machine control)
// 2023-03-13, tonhuisman: Add setting to invert the Output state
// 2022-08-22, tonhuisman: Add setting to auto-save a changed setting after x minutes, size optimizations, add PCONFIG defines
@@ -29,28 +32,9 @@
// Minimum build size is expected to be true when extras >=1
//////////////////////////////////////////////////////////////////////////////////////////////////////////
-# include "src/Helpers/ESPEasy_math.h"
# include "src/Globals/RulesCalculate.h"
-# include "src/WebServer/ESPEasy_WebServer.h"
-
-//// #define LIMIT_BUILD_SIZE
-# define PLUGIN_021_DEBUG
-
-// For additional debugging information use PLUGIN_021_DEBUG (see note)
-# ifdef BUILD_NO_DEBUG
-# undef PLUGIN_021_DEBUG
-# else // ifdef BUILD_NO_DEBUG
-////# define PLUGIN_021_DEBUG
-# endif // ifndef/else BUILD_NO_DEBUG
-
-// See note at top of file
-# ifdef LIMIT_BUILD_SIZE
-# define FEATURE_P021_EXTRAS 0
-# define P021_MIN_BUILD_SIZE
-# undef PLUGIN_021_DEBUG
-# else // ifdef LIMIT_BUILD_SIZE
-# define FEATURE_P021_EXTRAS 1
-# endif // ifdef LIMIT_BUILD_SIZE
+
+# include "src/PluginStructs/P021_data_struct.h"
# define PLUGIN_021
# define PLUGIN_ID_021 21
@@ -58,86 +42,6 @@
# define PLUGIN_VALUENAME1_021 "Output"
# define PLUGIN_VALUENAME2_021 "State"
-# define P021_GPIO_RELAY CONFIG_PIN1
-
-// Define the configuration options using ESPeasy standard structures
-// For unique identification on the HTML form use P021_GUID_