diff --git a/main.cpp b/main.cpp index 2204b67..452f5cf 100644 --- a/main.cpp +++ b/main.cpp @@ -172,10 +172,12 @@ int main() { { std::unique_ptr pSensors = std::make_unique(); std::vector threads; - std::function funcs[] = {displayThread, hassThread, sensorsThread}; + std::function funcs[] = {displayThread, sensorsThread, hassThread}; - for (auto& f : funcs) + for (auto& f : funcs) { threads.emplace_back(f, pSensors.get()); // params: function, stop_token (implied), pointer to sensor struct + std::this_thread::sleep_for(std::chrono::milliseconds(10)); // start threads with delay so displayThread can quit the app if theres no lcd + } sem::main.acquire(); }