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.
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.
AIUI,
optimistic_yield
willpanic()
if not in the CONT context. This would make any SYS-callback printouts (TCP, others) potentially crash.@devyte, @d-a-v, any comments/ideas? I like the idea, but the forced panic seems worse than a potential WDT...
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.
optimistic_yield() checks if it can yield (i. e. in CONT), and if enough time has elapsed since the start of the current loop. If true, it yield()s, otherwise does nothing.
So it shouldn't panic.
However: I seem to remember there was a change to its behavior so that yield actually only happens once every blah ms instead of after blah ms since loop start.
In any case:
Uh oh!
There was an error while loading. Please reload this page.
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.
The unit is
µs
so 10k is 10ms.It should be fine.
Maybe 1ms is better to sustain high throughput in case of a network transfer.
edit all functions taking time as parameter should have the unit in their names, starting with
delay()
... ah it's arduino API, we can't change it :) Our polled time structure have it though. We also could changeoptimistic_yield()
as it is internal API.