Skip to content

Commit

Permalink
Task WDT (mathieucarbou/MycilaTaskManager @ 3.1.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jun 6, 2024
1 parent 74c2c2b commit 2d80f4e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
5 changes: 3 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ lib_deps =
mathieucarbou/MycilaPZEM004Tv3 @ 4.0.1
mathieucarbou/MycilaRelay @ 4.0.1
mathieucarbou/MycilaSystem @ 2.0.4
mathieucarbou/MycilaTaskManager @ 3.0.8
mathieucarbou/MycilaTaskManager @ 3.1.0
mathieucarbou/MycilaTaskMonitor @ 3.0.1
mathieucarbou/MycilaTrafficLight @ 1.0.0
mathieucarbou/Dimmable Light for Arduino @ 2.0.1
; https://github.com/mathieucarbou/fabianoriccardi-dimmable-light#dev
build_flags =
-D ARDUINO_LOOP_STACK_SIZE=4096
-D CONFIG_ASYNC_TCP_PRIORITY=0
-D CONFIG_ASYNC_TCP_QUEUE_SIZE=128
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
Expand All @@ -78,7 +79,7 @@ build_flags =
-D MYCILA_LOGGER_SUPPORT
-D MYCILA_MQTT_BUFFER_SIZE=512
-D MYCILA_MQTT_STACK_SIZE=4096
-D MYCILA_MQTT_TASK_PRIORITY=5
-D MYCILA_MQTT_TASK_PRIORITY=0
-D NETWORK_FREQ_RUNTIME
-D WS_MAX_QUEUED_MESSAGES=64
-D YASOLR_DISABLE_BROWNOUT_DETECTOR
Expand Down
4 changes: 4 additions & 0 deletions src/Website.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ void YaSolR::WebsiteClass::_outputBypassSwitch(Card& card, Mycila::RouterOutput&
if (output.isBypassRelayEnabled()) {
output.tryBypassRelayState(value);
}
card.update(output.isBypassOn());
dashboard.refreshCard(&card);
dashboardTask.requestEarlyRun();
});
}
Expand All @@ -761,6 +763,8 @@ void YaSolR::WebsiteClass::_outputDimmerSlider(Card& card, Mycila::RouterOutput&
if (output.dimmer().isEnabled()) {
output.tryDimmerLevel(value);
}
card.update(static_cast<int>(output.dimmer().getLevel()));
dashboard.refreshCard(&card);
dashboardTask.requestEarlyRun();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/init/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Mycila::Task initConfigTask("Init Config", [](void* params) {

// Task Monitor
Mycila::TaskMonitor.begin();
Mycila::TaskMonitor.addTask("loopTask"); // Arduino
// Mycila::TaskMonitor.addTask("loopTask"); // Arduino
Mycila::TaskMonitor.addTask("async_tcp"); // AsyncTCP
Mycila::TaskMonitor.addTask("mqtt_task"); // MQTT
Mycila::TaskMonitor.addTask(ioTaskManager.getName()); // YaSolR
Expand Down
3 changes: 3 additions & 0 deletions src/init/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Mycila::Task initCoreTask("Init Core", [](void* params) {
logger.warn(TAG, "Initializing %s...", Mycila::AppInfo.nameModelVersion.c_str());

// WDT
Mycila::TaskManager::configureWDT();

// ioTaskManager
haDiscoveryTask.setManager(ioTaskManager);
mqttPublishTask.setManager(ioTaskManager);
Expand Down
2 changes: 2 additions & 0 deletions src/init/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ Mycila::Task initLoggingTask("Init Logging", [](void* params) {
haDiscoveryTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
otaTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
mqttPublishStaticTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
mqttPublishTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
mqttPublishConfigTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
profilerTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
pzemO1PairingTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);
pzemO2PairingTask.setCallback(debug ? LOG_EXEC_TIME : nullptr);

Expand Down
16 changes: 8 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ void setup() {
initMqttSubscribersTask.forceRun();
initDashboardTask.forceRun();

assert(ioTaskManager.asyncStart(1024 * 5, uxTaskPriorityGet(NULL), xPortGetCoreID()));
assert(jsyTaskManager.asyncStart(1024 * 3, uxTaskPriorityGet(NULL), 0));
assert(pzemO1TaskManager.asyncStart(1024 * 3, uxTaskPriorityGet(NULL), 0));
assert(pzemO2TaskManager.asyncStart(1024 * 3, uxTaskPriorityGet(NULL), 0));
assert(routerTaskManager.asyncStart(1024 * 3, uxTaskPriorityGet(NULL), xPortGetCoreID()));
assert( coreTaskManager.asyncStart(1024 * 4, 0, 1, 100, true)); // NOLINT
assert( ioTaskManager.asyncStart(1024 * 5, 0, 1, 100, true)); // NOLINT
assert( jsyTaskManager.asyncStart(1024 * 3, 0, 0, 100, true)); // NOLINT
assert(pzemO1TaskManager.asyncStart(1024 * 3, 0, 0, 100, true)); // NOLINT
assert(pzemO2TaskManager.asyncStart(1024 * 3, 0, 0, 100, true)); // NOLINT
assert(routerTaskManager.asyncStart(1024 * 3, 0, 1, 100, true)); // NOLINT

// STARTUP READY!
logger.info(TAG, "Started %s", Mycila::AppInfo.nameModelVersion.c_str());
Expand All @@ -63,6 +64,5 @@ void setup() {
#endif
}

void loop() {
coreTaskManager.loop();
}
// Destroy default Arduino async task
void loop() { vTaskDelete(NULL); }

0 comments on commit 2d80f4e

Please sign in to comment.