diff --git a/main/main.cpp b/main/main.cpp index 7d3d52e..2eb9eb5 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -27,9 +27,6 @@ using namespace std::chrono_literals; #include "screens.h" #include "presets.h" #include "statistics.h" -#ifdef FEATURE_BLE -#include "ble_bobby.h" -#endif #ifdef FEATURE_WEBSERVER #include "webserver.h" #endif @@ -60,9 +57,6 @@ std::optional lastModeUpdate; std::optional lastStatsUpdate; std::optional lastDisplayUpdate; std::optional lastDisplayRedraw; -#ifdef FEATURE_BLE -std::optional lastBleUpdate; -#endif #ifdef FEATURE_CLOUD std::optional lastCloudCollect; std::optional lastCloudSend; @@ -128,11 +122,6 @@ extern "C" void app_main() currentMode = &modes::defaultMode; -#ifdef FEATURE_BLE - bootLabel.redraw("ble"); - initBle(); -#endif - #ifdef FEATURE_WEBSERVER bootLabel.redraw("webserver"); initWebserver(); @@ -230,15 +219,6 @@ extern "C" void app_main() performance.lastTime = now; } -#ifdef FEATURE_BLE - if (!lastBleUpdate || now - *lastBleUpdate >= 250ms) - { - handleBle(); - - lastBleUpdate = now; - } -#endif - #ifdef FEATURE_ESPNOW espnow::handle(); #endif diff --git a/main/taskmanager.cpp b/main/taskmanager.cpp index 801881c..0cfd15e 100644 --- a/main/taskmanager.cpp +++ b/main/taskmanager.cpp @@ -51,6 +51,9 @@ #ifdef FEATURE_OTA #include "ota.h" #endif +#ifdef FEATURE_BLE +#include "ble_bobby.h" +#endif using namespace std::chrono_literals; @@ -99,6 +102,9 @@ espcpputils::SchedulerTask schedulerTasksArr[] { #ifdef FEATURE_OTA espcpputils::SchedulerTask { "ota", initOta, handleOta, 50ms }, #endif +#ifdef FEATURE_BLE + espcpputils::SchedulerTask { "ble", initBle, handleBle, 100ms }, +#endif }; } // namespace