- Notifications
You must be signed in to change notification settings - Fork13.3k
recurrent scheduled functions max delay update#8949
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
dok-net wants to merge29 commits intoesp8266:masterChoose a base branch fromdok-net:fix_8947
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+97 −54
Draft
Changes from1 commit
Commits
Show all changes
29 commits Select commitHold shift + click to select a range
2757aa2 Revert `compute_scheduled_recurrent_grain`
dok-neta81e544 wip
dok-net588e153 Add function to retrieve the time remaining until the (next) timeout …
dok-neta435fa5 Rename and reformat according to review.
dok-net232961e Revert _current as member change.
dok-net210c3d4 Fix expiredOneShot to properly stay expired forever unless reset.
dok-neta6456d0 Fix "reverse notation return statement"
dok-net9863f71 Reset() was wrecked by resetting _timeout. Reverted.
dok-net9c83f9a Expired check ALWAYS executes yield policy BEFORE checking expiration…
dok-net4cbe06b Reformat
dok-net20e6378 Fix comment, remove redundant parentheses
dok-netb0eb345 expired() is not const qualified in PolledTmeout.
dok-neta3612dd expiredOneShot() qualifed as const, despite asymmetry with expired() …
dok-netc88af7b Remove alwaysExpired, it is identical to 0 and obfuscates the code.
dok-net4eab7e4 Somewhat easier on the human reader.
dok-netb5285c3 Avoid possible unnecessary time conversion.
dok-netb54576f Fix one-shot mode in resetToNeverExpires(). Add convenient stop() syn…
dok-net100d2c4 Due to review and discussion, _oneShotExpired removed again.
dok-net81b90c9 Revert removal of PolledTimeout::alwaysExpired
dok-neteaf05e9 Finalize scheduled recurrent function delay logic.
dok-neta09726d Fix millis/micros mismatch.
dok-net4d3655b ISR safety.
dok-net55d465a Returning max delay value that is uint-wrap around safe.
dok-netc41a2c2 Add pseudo-get delay function for scheduled functions
dok-net4e654d1 Worked out input from PR review.
dok-net717f4ad use single constexpr definition instead of repeated expression.
dok-net538025a Simplified roll-over logic
dok-net861cf02 Add rationale for HALF_MAX_MICROS
dok-netb3b4aa0 Use CAS to minimize critical sections.
dok-netFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Fix millis/micros mismatch.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commita09726d672a7cfbb0ceb7006c84a884eaa0a03f2
There are no files selected for viewing
14 changes: 7 additions & 7 deletionscores/esp8266/Schedule.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -120,10 +120,10 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn, | ||
| item->alarm = alarm; | ||
| // prevent new item overwriting an already expired rTarget. | ||
| const int32_t rRemaining = rTarget -micros(); | ||
| if (!rFirst || (rRemaining > 0 && static_cast<uint32_t>(rRemaining) > item->callNow.remaining())) | ||
| { | ||
| rTarget =micros() + item->callNow.remaining(); | ||
d-a-v marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
d-a-v marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| esp8266::InterruptLock lockAllInterruptsInThisScope; | ||
| @@ -141,11 +141,11 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn, | ||
| return true; | ||
| } | ||
| uint32_tget_scheduled_recurrent_delay_us() | ||
| { | ||
| if (!rFirst) return ~static_cast<uint32_t>(0); | ||
| // handle already expired rTarget. | ||
| const int32_t rRemaining = rTarget -micros(); | ||
| return (rRemaining > 0) ? static_cast<uint32_t>(rRemaining) : 0; | ||
| } | ||
| @@ -209,7 +209,7 @@ void run_scheduled_recurrent_functions() | ||
| fence = true; | ||
| } | ||
| rTarget =micros() + current->callNow.remaining(); | ||
| recurrent_fn_t* prev = nullptr; | ||
| // prevent scheduling of new functions during this run | ||
| auto stop = rLast; | ||
| @@ -249,10 +249,10 @@ void run_scheduled_recurrent_functions() | ||
| prev = current; | ||
| current = current->mNext; | ||
| // prevent current item overwriting an already expired rTarget. | ||
| const int32_t rRemaining = rTarget -micros(); | ||
| if (rRemaining > 0 && static_cast<uint32_t>(rRemaining) > current->callNow.remaining()) | ||
| { | ||
| rTarget =micros() + current->callNow.remaining(); | ||
| } | ||
| } | ||
4 changes: 2 additions & 2 deletionscores/esp8266/Schedule.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletioncores/esp8266/core_esp8266_main.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.