17
17
*/
18
18
19
19
#include < assert.h>
20
- #include < numeric>
21
20
22
21
#include " Schedule.h"
23
22
#include " PolledTimeout.h"
@@ -35,7 +34,6 @@ static scheduled_fn_t* sFirst = nullptr;
35
34
static scheduled_fn_t * sLast = nullptr ;
36
35
static scheduled_fn_t * sUnused = nullptr ;
37
36
static int sCount = 0 ;
38
- static uint32_t recurrent_max_grain_mS = 0 ;
39
37
40
38
typedef std::function<bool (void )> mRecFuncT ;
41
39
struct recurrent_fn_t
@@ -132,39 +130,9 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
132
130
}
133
131
rLast = item;
134
132
135
- // grain needs to be recomputed
136
- recurrent_max_grain_mS = 0 ;
137
-
138
133
return true ;
139
134
}
140
135
141
- uint32_t compute_scheduled_recurrent_grain ()
142
- {
143
- if (recurrent_max_grain_mS == 0 )
144
- {
145
- if (rFirst)
146
- {
147
- uint32_t recurrent_max_grain_uS = rFirst->callNow .getTimeout ();
148
- for (auto it = rFirst->mNext ; it; it = it->mNext )
149
- recurrent_max_grain_uS = std::gcd (recurrent_max_grain_uS, it->callNow .getTimeout ());
150
- if (recurrent_max_grain_uS)
151
- // round to the upper millis
152
- recurrent_max_grain_mS = recurrent_max_grain_uS <= 1000 ? 1 : (recurrent_max_grain_uS + 999 ) / 1000 ;
153
- }
154
-
155
- #ifdef DEBUG_ESP_CORE
156
- static uint32_t last_grain = 0 ;
157
- if (recurrent_max_grain_mS != last_grain)
158
- {
159
- ::printf (" :rsf %u->%u\n " , last_grain, recurrent_max_grain_mS);
160
- last_grain = recurrent_max_grain_mS;
161
- }
162
- #endif
163
- }
164
-
165
- return recurrent_max_grain_mS;
166
- }
167
-
168
136
void run_scheduled_functions ()
169
137
{
170
138
// prevent scheduling of new functions during this run
@@ -258,9 +226,6 @@ void run_scheduled_recurrent_functions()
258
226
}
259
227
260
228
delete (to_ditch);
261
-
262
- // grain needs to be recomputed
263
- recurrent_max_grain_mS = 0 ;
264
229
}
265
230
else
266
231
{
0 commit comments