Skip to content

Commit

Permalink
Initialize TaskScheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Nov 23, 2023
1 parent 9417054 commit a7c9c2d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/Scheduler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include <TaskSchedulerDeclarations.h>

extern Scheduler scheduler;
2 changes: 2 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ platform = [email protected]

build_flags =
-DPIOENV=\"$PIOENV\"
-D_TASK_STD_FUNCTION=1
-Wall -Wextra -Werror
-std=c++17
-std=gnu++17
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/Scheduler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2023 Thomas Basler and others
*/
#include "Scheduler.h"

Scheduler scheduler;
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Arduino.h>
#include <LittleFS.h>
#include <TaskScheduler.h>

void setup()
{
Expand Down Expand Up @@ -149,6 +151,8 @@ void setup()

void loop()
{
scheduler.execute();

NetworkSettings.loop();
yield();
InverterSettings.loop();
Expand Down

0 comments on commit a7c9c2d

Please sign in to comment.