File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -55,3 +55,4 @@ lib_deps =
55
55
https://github.com/Bodmer/OpenFontRender# f163cc6 ; no tags or releases to reference :( -> pin to Git revision
56
56
squix78/JsonStreamingParser@~1.0.5
57
57
thingpulse/ESP8266 Weather Station@~2.2.0
58
+ arkhipenko/TaskScheduler@~3.7.0
Original file line number Diff line number Diff line change 13
13
#include < OpenWeatherMapCurrent.h>
14
14
#include < OpenWeatherMapForecast.h>
15
15
#include < SunMoonCalc.h>
16
+ #include < TaskScheduler.h>
16
17
17
18
#include " connectivity.h"
18
19
#include " display.h"
@@ -41,6 +42,8 @@ const int16_t centerWidth = tft.width() / 2;
41
42
OpenWeatherMapCurrentData currentWeather;
42
43
OpenWeatherMapForecastData forecasts[NUMBER_OF_FORECASTS];
43
44
45
+ Scheduler scheduler;
46
+
44
47
45
48
46
49
// ----------------------------------------------------------------------------
@@ -60,6 +63,9 @@ void repaint();
60
63
void updateData (boolean updateProgressBar);
61
64
62
65
66
+ Task clockTask (1000 , TASK_FOREVER, &drawTimeAndDate);
67
+
68
+
63
69
64
70
// ----------------------------------------------------------------------------
65
71
// setup() & loop()
@@ -79,6 +85,10 @@ void setup(void) {
79
85
80
86
initFileSystem ();
81
87
initOpenFontRender ();
88
+
89
+ scheduler.init ();
90
+ scheduler.addTask (clockTask);
91
+ clockTask.enable ();
82
92
}
83
93
84
94
void loop (void ) {
@@ -89,10 +99,7 @@ void loop(void) {
89
99
lastUpdateMillis == 0 ||
90
100
(millis () - lastUpdateMillis) > updateIntervalMillis) {
91
101
repaint ();
92
- } else {
93
- drawTimeAndDate ();
94
102
}
95
- delay (1000 );
96
103
97
104
// if (ts.touched()) {
98
105
// TS_Point p = ts.getPoint();
@@ -104,6 +111,7 @@ void loop(void) {
104
111
// // Debouncing; avoid returning the same touch multiple times.
105
112
// delay(50);
106
113
// }
114
+ scheduler.execute ();
107
115
}
108
116
109
117
You can’t perform that action at this time.
0 commit comments