Skip to content

Commit 07f2539

Browse files
authored
Merge branch 'mega' into feature/build_description
2 parents f90af23 + ac863aa commit 07f2539

File tree

8 files changed

+148
-18
lines changed

8 files changed

+148
-18
lines changed

src/_CPlugin_Helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#define CPLUGIN_HELPER_H CPLUGIN_HELPER_H
33

44
#include <Arduino.h>
5+
6+
#include "ESPEasy_common.h"
7+
58
#include "src/Globals/CPlugins.h"
69
#include "src/Globals/ESPEasy_Scheduler.h"
710
#include "src/Helpers/Numerical.h"

src/__CPlugin.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "ESPEasy_common.h"
2+
13
#include "src/Globals/CPlugins.h"
24
#include "src/Globals/Protocol.h"
35
#include "src/Globals/Settings.h"
@@ -6,9 +8,6 @@
68
#include "src/DataStructs/ESPEasy_plugin_functions.h"
79
#include "src/DataStructs/TimingStats.h"
810

9-
#include "ESPEasy_common.h"
10-
11-
1211

1312
// ********************************************************************************
1413
// Initialize all Controller CPlugins that where defined earlier
@@ -148,6 +147,10 @@ void CPluginInit(void)
148147
ADDCPLUGIN(025)
149148
#endif
150149

150+
// When extending this, search for EXTEND_CONTROLLER_IDS
151+
// in the code to find all places that need to be updated too.
152+
153+
151154
CPluginCall(CPlugin::Function::CPLUGIN_PROTOCOL_ADD, 0);
152155

153156
// Set all not supported cplugins to disabled.

src/src/ControllerQueue/ControllerDelayHandlerStruct.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
#include "../Helpers/Scheduler.h"
1414
#include "../Helpers/StringConverter.h"
1515

16+
#include <Arduino.h>
1617
#include <list>
1718
#include <memory> // For std::shared_ptr
19+
#include <new> // std::nothrow
20+
1821

1922
/*********************************************************************************************\
2023
* ControllerDelayHandlerStruct
@@ -234,7 +237,7 @@ struct ControllerDelayHandlerStruct {
234237
} \
235238
bool init_c##NNN####M##_delay_queue(controllerIndex_t ControllerIndex) { \
236239
if (C##NNN####M##_DelayHandler == nullptr) { \
237-
C##NNN####M##_DelayHandler = new (std::nothrow) C##NNN####M##_DelayHandler_t; \
240+
C##NNN####M##_DelayHandler = new (std::nothrow) (C##NNN####M##_DelayHandler_t); \
238241
} \
239242
if (C##NNN####M##_DelayHandler == nullptr) { return false; } \
240243
MakeControllerSettings(ControllerSettings); \

src/src/ControllerQueue/DelayQueueElements.cpp

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "DelayQueueElements.h"
22

3+
#include "../DataStructs/ControllerSettingsStruct.h"
4+
#include "../DataStructs/TimingStats.h"
5+
#include "../Globals/ESPEasy_Scheduler.h"
36

47
#ifdef USES_MQTT
58
ControllerDelayHandlerStruct<MQTT_queue_element> *MQTTDelayHandler = nullptr;
@@ -11,7 +14,7 @@ bool init_mqtt_delay_queue(controllerIndex_t ControllerIndex, String& pubname, b
1114
}
1215
LoadControllerSettings(ControllerIndex, ControllerSettings);
1316
if (MQTTDelayHandler == nullptr) {
14-
MQTTDelayHandler = new (std::nothrow) ControllerDelayHandlerStruct<MQTT_queue_element>;
17+
MQTTDelayHandler = new (std::nothrow) ControllerDelayHandlerStruct<MQTT_queue_element>;
1518
}
1619
if (MQTTDelayHandler == nullptr) {
1720
return false;
@@ -145,6 +148,37 @@ DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 18)
145148
#endif
146149
*/
147150

151+
/*
152+
#ifdef USES_C021
153+
DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 21)
154+
#endif
155+
*/
156+
157+
/*
158+
#ifdef USES_C022
159+
DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 22)
160+
#endif
161+
*/
162+
163+
/*
164+
#ifdef USES_C023
165+
DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 23)
166+
#endif
167+
*/
168+
169+
/*
170+
#ifdef USES_C024
171+
DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 24)
172+
#endif
173+
*/
174+
175+
/*
176+
#ifdef USES_C025
177+
DEFINE_Cxxx_DELAY_QUEUE_MACRO_CPP(0, 25)
178+
#endif
179+
*/
180+
181+
148182

149-
// When extending this, also extend in Scheduler.cpp:
150-
// void process_interval_timer(unsigned long id, unsigned long lasttimer)
183+
// When extending this, search for EXTEND_CONTROLLER_IDS
184+
// in the code to find all places that need to be updated too.

src/src/ControllerQueue/DelayQueueElements.h

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#ifndef DELAY_QUEUE_ELEMENTS_H
22
#define DELAY_QUEUE_ELEMENTS_H
33

4+
45
#include "../../ESPEasy_common.h"
5-
#include "../DataStructs/ControllerSettingsStruct.h"
66
#include "../../ESPEasy_fdwdecl.h"
77

88
#include "../ControllerQueue/ControllerDelayHandlerStruct.h"
99
#include "../ControllerQueue/SimpleQueueElement_string_only.h"
1010
#include "../ControllerQueue/queue_element_single_value_base.h"
1111

12+
#include "../DataStructs/ControllerSettingsStruct.h"
13+
1214

1315
// The most logical place to have these queue element handlers defined would be in their
1416
// respective _Cxxx.ino file.
@@ -156,9 +158,39 @@ DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 18)
156158
#endif
157159
*/
158160

161+
/*
162+
#ifdef USES_C021
163+
DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 21)
164+
#endif
165+
*/
166+
167+
/*
168+
#ifdef USES_C022
169+
DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 22)
170+
#endif
171+
*/
172+
173+
/*
174+
#ifdef USES_C023
175+
DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 23)
176+
#endif
177+
*/
178+
179+
/*
180+
#ifdef USES_C024
181+
DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 24)
182+
#endif
183+
*/
184+
185+
/*
186+
#ifdef USES_C025
187+
DEFINE_Cxxx_DELAY_QUEUE_MACRO(0, 25)
188+
#endif
189+
*/
190+
159191

160-
// When extending this, also extend in Scheduler.cpp:
161-
// void process_interval_timer(unsigned long id, unsigned long lasttimer)
192+
// When extending this, search for EXTEND_CONTROLLER_IDS
193+
// in the code to find all places that need to be updated too.
162194

163195

164196
#endif // ifndef DELAY_QUEUE_ELEMENTS_H

src/src/Helpers/ESPEasyRTC.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include "ESPEasyRTC.h"
22

3-
#include "src/Globals/RTC.h"
4-
#include "src/DataStructs/RTCStruct.h"
5-
#include "src/DataStructs/RTCCacheStruct.h"
6-
#include "src/DataStructs/RTC_cache_handler_struct.h"
7-
#include "src/Globals/Plugins.h"
8-
#include "src/Helpers/CRC_functions.h"
3+
#include "../Globals/RTC.h"
4+
#include "../DataStructs/RTCStruct.h"
5+
#include "../DataStructs/RTCCacheStruct.h"
6+
#include "../DataStructs/RTC_cache_handler_struct.h"
7+
#include "../Globals/Plugins.h"
8+
#include "../Helpers/CRC_functions.h"
99

1010
#ifdef ESP8266
1111
#include <user_interface.h>

src/src/Helpers/Scheduler.cpp

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ void ESPEasy_Scheduler::setIntervalTimer(IntervalTimer_e id, unsigned long lastt
211211
case IntervalTimer_e::TIMER_C018_DELAY_QUEUE:
212212
case IntervalTimer_e::TIMER_C019_DELAY_QUEUE:
213213
case IntervalTimer_e::TIMER_C020_DELAY_QUEUE:
214+
case IntervalTimer_e::TIMER_C021_DELAY_QUEUE:
215+
case IntervalTimer_e::TIMER_C022_DELAY_QUEUE:
216+
case IntervalTimer_e::TIMER_C023_DELAY_QUEUE:
217+
case IntervalTimer_e::TIMER_C024_DELAY_QUEUE:
218+
case IntervalTimer_e::TIMER_C025_DELAY_QUEUE:
219+
// When extending this, search for EXTEND_CONTROLLER_IDS
220+
// in the code to find all places that need to be updated too.
214221
interval = 1000; break;
215222
}
216223
unsigned long timer = lasttimer;
@@ -368,8 +375,48 @@ void ESPEasy_Scheduler::process_interval_timer(IntervalTimer_e id, unsigned long
368375
*/
369376
break;
370377

371-
// When extending this, also extend in DelayQueueElements.h
372-
// Also make sure to extend the "TIMER_C020_DELAY_QUEUE" list of defines.
378+
case IntervalTimer_e::TIMER_C021_DELAY_QUEUE:
379+
/*
380+
#ifdef USES_C021
381+
process_c021_delay_queue();
382+
#endif
383+
*/
384+
break;
385+
386+
case IntervalTimer_e::TIMER_C022_DELAY_QUEUE:
387+
/*
388+
#ifdef USES_C022
389+
process_c022_delay_queue();
390+
#endif
391+
*/
392+
break;
393+
394+
case IntervalTimer_e::TIMER_C023_DELAY_QUEUE:
395+
/*
396+
#ifdef USES_C023
397+
process_c023_delay_queue();
398+
#endif
399+
*/
400+
break;
401+
402+
case IntervalTimer_e::TIMER_C024_DELAY_QUEUE:
403+
/*
404+
#ifdef USES_C024
405+
process_c024_delay_queue();
406+
#endif
407+
*/
408+
break;
409+
410+
case IntervalTimer_e::TIMER_C025_DELAY_QUEUE:
411+
/*
412+
#ifdef USES_C025
413+
process_c025_delay_queue();
414+
#endif
415+
*/
416+
break;
417+
418+
// When extending this, search for EXTEND_CONTROLLER_IDS
419+
// in the code to find all places that need to be updated too.
373420
}
374421
}
375422

src/src/Helpers/Scheduler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ class ESPEasy_Scheduler {
4242
TIMER_C018_DELAY_QUEUE,
4343
TIMER_C019_DELAY_QUEUE,
4444
TIMER_C020_DELAY_QUEUE,
45+
TIMER_C021_DELAY_QUEUE,
46+
TIMER_C022_DELAY_QUEUE,
47+
TIMER_C023_DELAY_QUEUE,
48+
TIMER_C024_DELAY_QUEUE,
49+
TIMER_C025_DELAY_QUEUE,
50+
// When extending this, search for EXTEND_CONTROLLER_IDS
51+
// in the code to find all places that need to be updated too.
52+
4553
};
4654

4755
enum class PluginPtrType {

0 commit comments

Comments
 (0)