-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Refactor timer suspend portion of node.sleep (pmsleep) #2287
Conversation
Terry, in light of the discussion in #2056 I took the liberty to assign you as a reviewer, hope you don't mind. |
@marcel, thanks . I am up to my arm-pits in some weird GC interaction on my LFS testing that is proving really hard to track down. I'll post separately on that, but one I've cleared this, I will run this one, and reply to you guys. |
Added swtimer debug module option to user_modules.h. Added comments to user_config.h.
2dc0ee4
to
040c887
Compare
@dnc40085, we are still at cross purposes, here I think. As far as I can see, the aim of this patch is to offer those developers that wish to make use of the the light sleep functions, the ability for any timers that have need defined to time shift sensibly across the sleep period, and to do this in a runtime-efficient manner. So the % of active firmware users who will want to use light sleep is very small. And some of these might want to handle timers across light sleep themselves. However for those that don't, it makes sense to make this as transparent as possible with minimum runtime impact. Your move to using a registration process which uses a one-time flag so that registration is a single startup event is great as is moving this content into the registry. So now there is only an initialisation overhead, plus a sleep / wake overhead and no overhead on a per timer arm / fire. But in another way this patch also is a major step back. Specifically
So now whether or not Can I suggest that the entire callable interface to swtmr_* is encapsulated in |
My mistake, I felt like I was forgetting something when I re-submitted the PR. |
@dnc40085, have you done a build with Having had a quick scan through the source, I think that you've covered off all of the cases, but it's always good to do the "belt and braces" check. |
I double checked and I found no occurrences of any of the swtimer components. |
OK, I will merge this after the dev to master cut-over. The functional changes are too great so move this into master without at leat a few weeks testing in dev. |
Fixes #2048.
docs/en/*
.dev
branch rather than formaster
.The previous version of the timer suspend code was large, difficult to read and had some problems.
This PR changes the way the timer suspend uses memory, rather than storing the necessary data in memory blocks allocated with
c_malloc()
, the new implementation stores its data in the Lua registry and in doing so a lot of extra code was able to be removed.A message has been left in the following functions notifying the developer that the feature has been removed.
tmr.suspend()
tmr.suspend_all()
tmr.resume()
tmr.resume_all()
Due to my not fully understanding the function of each callback registered with
os_timer_setfn
, I have not been able to fully test the suspend behaviour for each instance ofSWTIMER_REG_CB(cb_ptr, suspend_behaviour)
, It would be much appreciated if someone could go over each instance ofSWTIMER_REG_CB()
to verify that the configured suspend behaviour is correct.This PR is a resubmit of #2056 and includes the changes suggested by TerryE