Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2757aa2

Browse files
committed
Revertcompute_scheduled_recurrent_grain
1 parentd5eb265 commit2757aa2

File tree

3 files changed

+2
-53
lines changed

3 files changed

+2
-53
lines changed

‎cores/esp8266/Schedule.cpp‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include<assert.h>
20-
#include<numeric>
2120

2221
#include"Schedule.h"
2322
#include"PolledTimeout.h"
@@ -35,7 +34,6 @@ static scheduled_fn_t* sFirst = nullptr;
3534
staticscheduled_fn_t*sLast =nullptr;
3635
staticscheduled_fn_t*sUnused =nullptr;
3736
staticintsCount =0;
38-
staticuint32_t recurrent_max_grain_mS =0;
3937

4038
typedef std::function<bool(void)>mRecFuncT;
4139
structrecurrent_fn_t
@@ -132,39 +130,9 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
132130
}
133131
rLast = item;
134132

135-
// grain needs to be recomputed
136-
recurrent_max_grain_mS =0;
137-
138133
returntrue;
139134
}
140135

141-
uint32_tcompute_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-
staticuint32_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-
168136
voidrun_scheduled_functions()
169137
{
170138
// prevent scheduling of new functions during this run
@@ -258,9 +226,6 @@ void run_scheduled_recurrent_functions()
258226
}
259227

260228
delete(to_ditch);
261-
262-
// grain needs to be recomputed
263-
recurrent_max_grain_mS =0;
264229
}
265230
else
266231
{

‎cores/esp8266/Schedule.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
// scheduled function happen more often: every yield() (vs every loop()),
4040
// and time resolution is microsecond (vs millisecond). Details are below.
4141

42-
// compute_scheduled_recurrent_grain() is used by delay() to give a chance to
43-
// all recurrent functions to run per their timing requirement.
44-
45-
uint32_tcompute_scheduled_recurrent_grain ();
46-
4742
// scheduled functions called once:
4843
//
4944
// * internal queue is FIFO.

‎cores/esp8266/core_esp8266_main.cpp‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222

2323
//This may be used to change user task stack size:
2424
//#define CONT_STACKSIZE 4096
25-
26-
#include<numeric>
27-
2825
#include<Arduino.h>
2926
#include"Schedule.h"
3027
extern"C" {
@@ -175,16 +172,8 @@ bool esp_try_delay(const uint32_t start_ms, const uint32_t timeout_ms, const uin
175172
if (expired >= timeout_ms) {
176173
returntrue;// expired
177174
}
178-
179-
// compute greatest chunked delay with respect to scheduled recurrent functions
180-
uint32_t grain_ms =std::gcd(intvl_ms,compute_scheduled_recurrent_grain());
181-
182-
// recurrent scheduled functions will be called from esp_delay()->esp_suspend()
183-
esp_delay(grain_ms >0 ?
184-
std::min((timeout_ms - expired), grain_ms):
185-
(timeout_ms - expired));
186-
187-
returnfalse;// expiration must be checked again
175+
esp_delay(std::min((timeout_ms - expired), intvl_ms));
176+
returnfalse;
188177
}
189178

190179
extern"C"void__yield() {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp