Skip to content
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 for scheduling recurrent functions while inside scheduled function #6307

Closed
wants to merge 2 commits into from

Conversation

dok-net
Copy link
Contributor

@dok-net dok-net commented Jul 16, 2019

Dear @d-a-v,
I hope to have come up with a relatively small fix to Schedule that allows scheduling from inside already scheduled functions. I am using this with my CoopTask scheduling, without this patch, the sketch crashed, with it, it performs correctly. I don't see any reason for side-effects, like poorer performance. Memory use is minimally increased by the use of a recurrent_fn_t instance for rFirst instead of the previous pointer, but the logic looked cleaner to me when I began the patch, and I'd rather not change it back if there's no compelling reason.
Could you please review this?

@dok-net
Copy link
Contributor Author

dok-net commented Jul 17, 2019

Just food for thought, after concerning myself with #6212. Is there really any power-saving on the ESP8266 by leaving "cont", like delay() does with the timer and yielding to sys? I was under the impression that all the power-saving modes come with some limition, such that the user sketch must decide what it wants to do. On the other hand, leaving "cont" like in delay() with a 1 millisecond resolution, but using microsecond times in Schedule.h, is that sensible? I see between 20-30µs cycle times in loop in tests of my coop scheduler, which doesn't block the whole user context for delays in separate tasks.

If so, maybe the recurrent scheduling loop could check for the delay until the next timed function and "sleep"?

@dok-net
Copy link
Contributor Author

dok-net commented Sep 11, 2019

Superseded by #6485

@dok-net dok-net closed this Sep 11, 2019
@dok-net dok-net deleted the nested_scheduling branch September 11, 2019 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant