- Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix optimistic_yield to not yield on each call after x µs #6804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix optimistic_yield to not yield on each call after x µs #6804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should use instead the very light esp_get_cycle_count()
here
@d-a-v I've used the ESP.get… wrappers instead... do you approve of the possible overflowing for large interval numbers? Adding corrective code probably ruins any advantage from not using micros()? |
c0bc8d3
to fa55a4f
Compare d8a07c1
to 6c50e74
Compare 2448189
to 2a15fbc
Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a very good fix of a long-standing problem. My only concern is the change in Schedule.cpp which seems to be orthogonal to the optimistic_yield change and replaces an esp_schedule/cont_yield
with a yield
...
e997d25
to e91221e
Compare e91221e
to 00b7dfe
Compare d326448
to 6f672a9
Compare 6a24767
to 62cd62b
Compare 4b6b570
to 7e5dd70
Compare … x us, but yield only every x us between optimistic_yield calls.
…rval_us can overflow - 26s at 160MHz CPU clock.
… with a literal parameter value.
…uino>, have to resort to preprocessor definition for inlining.
7e5dd70
to 50fab51
Compare
Before, once an invocation of
loop()
runs for x µs, each call tooptimistic_yield()
does reallyyield()
.Now, only yield every x µs between
optimistic_yield()
oryield()
calls.