-
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) #2056
Conversation
Ouch! I can't gauge how big of an impact this has on our users. I guess those functions weren't the most popular ones, though. Would it make much of a difference if you left the functions in place for now but replaced their body with a "Sorry, this was removed" message? |
@marcelstoer No problem, I'll submit a PR shortly. |
You could just push to your existing branch and this PR will update. |
My mistake, I meant push a commit. |
@dnc40085 Hi dnc, can we have a discussion about the requirement and implementation here? Surely the underlying requirement is that we can add the These functions are really only need if the ESP application is battery powered and needs to use the WiFi intermittently. IMO, other usecases form the bulk of ESP applications, so my recommendation this implementation must not impact the runtime performance or RAM footprint of these majority usecases. Therefore, such functionality should not be enabled by default. It should also have as small an impact on the runtime performance or RAM footprint of applications which employ light-sleep. As I understand this, the SDK PWM and S/W timer functions use the FRC1 and FRC2 H/W timers for sequencing. These don't work with light-sleep as the CPU and its internal clock are halted and hence the H/W timer NMIs won't get delivered. The 2.1 SDK API guide only mentions restrictions "timers" in Sec 3.7 which could include FRC2 use. The S/W timer code is currently pretty lightwieght. The caller is responsible for allocating timer structures and the API marshals these in its linked timer list. No malloc/free calls are made. The S/W timer is used by both SDK internal and application functionality. I assume that we only need to have a treatment for the application ones, and what we it seems that we need to do is to stop any application timers before reqesting a sleep and then resuming them with a correction offset (whatever that should be) on awaking. This is a one per sleep / wake cycle overhead and not a once per every timer call one. As I see it, the issue -- if we want to do this at once per sleep -- is that when we walk the timer linked list we need a method of descriminating which list entries are application ones. We've got some 35
Why not use a macro to allow modules to declare a policy for each cb address? This could even use an inline static flag byte so this only calls the sleep hook once per boot, instead of once per register / unregister. OK this isn't transparent at a coding level, but I personally would rather have 30 extra source lines to add and no other runtime RAM/CPU hit than a chunky piece of hidden code being called with malloc / frees on every timer register / unregister. |
Did this happen offline or has this stalled? |
It hasn't happened. Sorry to be terse, but getting ready for my son's wedding tomorrow 😀 |
Make it build without INTERRUPT_ENABLE
* Make the rtc variables not be cleared by the .bss initialization * Move the save to the right place * Make sure that we reset the rtctime to 0 if we didn't sleep properly. * Setting the seconds to zero doesn't update the dsleep calibration
* Initial checkin * Add bloom.md into mkdocs * Added reset and improved info * Update bloom.c * Update bloom.md * Add Wikipedia link
* Add support of counting of interrupts * Update the timestamp when interrupt happens during dispatch. Also clear out interrupts when setting up a new callback
Buffer size of funtion readline is wrong (Line 480) Should be FILE_READ_CHUNK = 1024 bytes instead 256 bytes
Thank you for this change.
…u#2217) * Only load a single non-empty line from the uart at a time. * Don't fall behind in processing of uart buffer.
* mbedTLS update * mbedtls: vsnprintf macroification * Further update mbedTLS to 2.6.1 * mbedtls: make debugging work again * Silence SSL messages on normal teardown * Drop DTLS support from mbedtls
* ads1015 is supported, up to 4 devices can be connected at the same time * removed debug, updated documentation * changed to oop API * added __gc to handle active timer cleanup * reworked argument validation and error reporting * stack is no longer messed up after __del
in float build, uV and sign are included in mV in int build, uV and mV are absolute, sign is -1, 0, 1 added rounding of uV values added optional test function
Fix to start sending PINGREQ after a reconnect.
All the changes are in preparation for an eventual MkDocs 0.17 upgrade
…mcu#2262) Disable the error callback of mqtt.client:connect() after a successful connection. This will prevent this function to be called after a future disconnection. Instead the "offline" function is called.
…cu#2260) * Fix some subtle timing issues with gpio.pulse * Add the pulse:update method * Allow getstate to work on stopped pulsers * Make gpio.mode(, gpio.OUTPUT) actually set the output mode * Added some more documentation
If @dnc40085 has gone onto greater things, then I guess that I'll have to add this to my long butt list because I don't think that we can leave it as it is. |
Hello, my apologies for being gone for so long, life got in the way. I have a new commit that I'm putting some finishing touches on, I've implemented the changes suggested by @TerryE above. I'll try to get it finished and push the new commits this weekend. |
1fd9c56
to
46f0658
Compare
I think I'm gonna need to create a new PR, I messed up somewhere |
Fixes #2048.
dev
branch rather than formaster
.docs/en/*
.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.!!!IMPORTANT!!! Some functions were removed in this PR!
No deprecation notices have been included for the following functionsA 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()