From b3299c832527cc533bdc73ab9f0a769c5c2e06ca Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 19 Dec 2021 16:42:45 +0100 Subject: [PATCH] Add ledstrip to task manager --- main/main.cpp | 19 ------------------- main/taskmanager.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 5674eca..e62c37f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -32,9 +32,6 @@ using namespace std::chrono_literals; #include "udpcloud.h" #endif #include "wifi_bobbycar.h" -#ifdef FEATURE_LEDSTRIP -#include "ledstrip.h" -#endif #include "modes/defaultmode.h" #include "displays/statusdisplay.h" #include "displays/lockscreen.h" @@ -58,9 +55,6 @@ std::optional lastDisplayRedraw; std::optional lastCloudCollect; std::optional lastCloudSend; #endif -#ifdef FEATURE_LEDSTRIP -std::optional lastLedstripUpdate; -#endif } extern "C" void app_main() @@ -109,11 +103,6 @@ extern "C" void app_main() task.setup(); } -#ifdef FEATURE_LEDSTRIP - bootLabel.redraw("LED strip"); - initLedStrip(); -#endif - for (Controller &controller : controllers) controller.command.buzzer = {}; @@ -232,14 +221,6 @@ extern "C" void app_main() bms::update(); #endif -#ifdef FEATURE_LEDSTRIP - if (!lastLedstripUpdate || now - *lastLedstripUpdate >= 1000ms / 60) - { - updateLedStrip(); - - lastLedstripUpdate = now; - } -#endif #ifdef FEATURE_DNS_NS handle_dns_announce(); #endif diff --git a/main/taskmanager.cpp b/main/taskmanager.cpp index 2a185f8..a70f90f 100644 --- a/main/taskmanager.cpp +++ b/main/taskmanager.cpp @@ -57,6 +57,9 @@ #ifdef FEATURE_WEBSERVER #include "webserver.h" #endif +#ifdef FEATURE_LEDSTRIP +#include "ledstrip.h" +#endif using namespace std::chrono_literals; @@ -96,7 +99,7 @@ espcpputils::SchedulerTask schedulerTasksArr[] { espcpputils::SchedulerTask { "bluetooth", bluetooth_init, bluetooth_update, 100ms }, #endif #ifdef FEATURE_CAN - espcpputils::SchedulerTask { "can", can::initCan, can::parseCanInput, 50ms }, + espcpputils::SchedulerTask { "can", can::initCan, can::parseCanInput, 10ms }, #endif espcpputils::SchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms }, #ifdef FEATURE_SERIAL @@ -111,6 +114,9 @@ espcpputils::SchedulerTask schedulerTasksArr[] { #ifdef FEATURE_WEBSERVER espcpputils::SchedulerTask { "webserver", initWebserver, handleWebserver, 100ms }, #endif +#ifdef FEATURE_LEDSTRIP + espcpputils::SchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms }, +#endif }; } // namespace