diff --git a/main/main.cpp b/main/main.cpp index 36240dd..4410d5f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -53,7 +53,6 @@ using namespace std::chrono_literals; #include "udpcloud.h" #endif #include "wifi_bobbycar.h" -#include "time_bobbycar.h" #ifdef FEATURE_LEDSTRIP #include "ledstrip.h" #endif @@ -87,9 +86,6 @@ std::optional lastBleUpdate; std::optional lastCloudCollect; std::optional lastCloudSend; #endif -#ifdef FEATURE_NTP -std::optional lastNtpUpdate; -#endif #ifdef FEATURE_LEDSTRIP std::optional lastLedstripUpdate; #endif @@ -219,11 +215,6 @@ extern "C" void app_main() initCloud(); #endif -#ifdef FEATURE_NTP - bootLabel.redraw("time"); - initTime(); -#endif - bootLabel.redraw("switchScreen"); #if defined(FEATURE_DPAD_5WIRESW) && defined(DPAD_5WIRESW_DEBUG) @@ -366,15 +357,6 @@ extern "C" void app_main() } #endif -#ifdef FEATURE_NTP - if (!lastNtpUpdate || now - *lastNtpUpdate >= 100ms) - { - updateTime(); - - lastNtpUpdate = now; - } -#endif - #ifdef FEATURE_WEBSERVER handleWebserver(); #endif diff --git a/main/taskmanager.cpp b/main/taskmanager.cpp index 20c7f04..9055d1f 100644 --- a/main/taskmanager.cpp +++ b/main/taskmanager.cpp @@ -34,6 +34,9 @@ #ifdef FEATURE_MOSFETS #include "mosfets.h" #endif +#ifdef FEATURE_NTP +#include "time_bobbycar.h" +#endif using namespace std::chrono_literals; @@ -64,7 +67,10 @@ espcpputils::SchedulerTask schedulerTasksArr[] { #ifdef FEATURE_MOSFETS espcpputils::SchedulerTask { "mosfets", init_mosfets, update_mosfets, {} }, #endif - espcpputils::SchedulerTask { "wifi", wifi_begin, wifi_update, 100ms }, + espcpputils::SchedulerTask { "wifi", wifi_begin, wifi_update, 100ms }, +#ifdef FEATURE_NTP + espcpputils::SchedulerTask { "time", initTime, updateTime, 100ms }, +#endif }; } // namespace