diff --git a/include/Scheduler.h b/include/Scheduler.h new file mode 100644 index 000000000..44f1b51d7 --- /dev/null +++ b/include/Scheduler.h @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include + +extern Scheduler scheduler; \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 10ce45712..8bf5b01dd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,6 +23,7 @@ platform = espressif32@6.3.2 build_flags = -DPIOENV=\"$PIOENV\" + -D_TASK_STD_FUNCTION=1 -Wall -Wextra -Werror -std=c++17 -std=gnu++17 @@ -36,6 +37,7 @@ lib_deps = nrf24/RF24 @ ^1.4.8 olikraus/U8g2 @ ^2.35.7 buelowp/sunset @ ^1.1.7 + https://github.com/arkhipenko/TaskScheduler#testing extra_scripts = pre:pio-scripts/auto_firmware_version.py diff --git a/src/Scheduler.cpp b/src/Scheduler.cpp new file mode 100644 index 000000000..79dfd9c8b --- /dev/null +++ b/src/Scheduler.cpp @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 Thomas Basler and others + */ +#include "Scheduler.h" + +Scheduler scheduler; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index bc6cb86a4..2976cbab3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,12 +16,14 @@ #include "NetworkSettings.h" #include "NtpSettings.h" #include "PinMapping.h" +#include "Scheduler.h" #include "SunPosition.h" #include "Utils.h" #include "WebApi.h" #include "defaults.h" #include #include +#include void setup() { @@ -149,6 +151,8 @@ void setup() void loop() { + scheduler.execute(); + NetworkSettings.loop(); yield(); InverterSettings.loop();