- Notifications
You must be signed in to change notification settings - Fork 13.3k
Scheduled Interrupt#4609
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
Scheduled Interrupt #4609
Uh oh!
There was an error while loading. Please reload this page.
Conversation
igrr commented Apr 5, 2018
@hreintke have you considered proposing this to the Arduino cores (AVR/ARM) as well? It would be great if we could keep such features more or less in sync. |
hreintke commented Apr 5, 2018
@igrr No I did not (yet). Isn't schedule_function an ESP8266 only functionality ? |
devyte commented Apr 12, 2018
@hreintke I've been looking at this on and off (I keep getting interrupted... don't laugh). There is a subtlety with using the scheduled functions from a gpio isr. I am describing this here for reference. The number of functions that can be scheduled for the next loop run is currently limited. If the isr were to trigger more times than that limit before the next schedule service after the loop, calls would be lost, because the scheduled function list would be filled up.
I think there is some additional work that should accompany this implementation (not necessarily in this same PR):
|
hreintke commented Apr 12, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@devyte Nice catch on the number of interrupts, didn't think of that. Remarks on 2/ limit 3/protection. |
devyte commented Apr 26, 2018
In case of trigger during a loop pass:
If we change the execution of the scheduled functions to before the loop, the new behavior would be this:
In case of trigger during a loop pass:
|
hreintke commented Apr 29, 2018
Possible Schedule implementation. I added the following functionality :
Did not yet integrate with Schedule.h & FunctionalInterrupt. Example sketch : |
devyte commented Jun 18, 2018
@hreintke there seem to be warnings with this, hence failing CI. Could you please take a look? |
hreintke commented Jun 18, 2018
@devyte Done |
devyte commented Jun 19, 2018
ok, my (shallow) testing shows this working, I have nothing to add to the code changes, and there is one report of the memleak being fixed. I'm merging. |
(fix proposed by @shimarin, verified by @marcvtew esp8266#4866)
hreintke commented Jul 4, 2018
@devyte This PR also included the WIP of ScheduledFuncion (.h & cpp). |
devyte commented Jul 4, 2018
@hreintke you're right, and I now realize that I have some comments in there. |
hreintke commented Jul 4, 2018
@devyte Yes I will. PS : See you are busy, no problem that it takes some time. |
Hi,
This PR adds the possibility to schedule (= execute after loop) the ISR routine.
In this way
This builds on top of the functional interrupt functionality (#2745)
In this implementation I took std::function<void(InterruptInfo)>
InterruptInfo containing pin, pinstatus and micros() from time of interrupt.
@devyte : This also solves the memory leak you mentioned for FunctionalInterrupt
Comments are welcome.