-
Notifications
You must be signed in to change notification settings - Fork 3k
Enable deepsleep for LowPowerXXX objects #5148
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
Enable deepsleep for LowPowerXXX objects #5148
Conversation
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.
What if I initialize a ticker with the following expression:
Ticker foo(get_lp_ticker_data());
The change is broken too easily.
what is your suggestion? introduce
|
@pan- This example breaks using convention of the Ticker class. If you want to use low power ticker you should use LowPowerTicker class. |
No its not breaking conventions, there is a public constructor for it. The LowPowerTicker class has always been a shorthand for
My suggestion would be to expose whether the ticker continue to work in deep sleep or not in the ticker data so it can be reused by upper layers. I'd also drop the virtual keyword off As a side note I'd also make sure that |
A similar change will also be needed for Timer, as LowPowerTimer has a similar problem. @pan- did you have any ideas on where to expose ticker deep sleep operation info? This could be part of ticker get_info which is in PR #5028. Alternatively, this could be passed into the constructor like the ticker data itself is. |
@pan- you beat me to the post by 8 seconds |
@pan @0xc0170
It looks like lock_deepsleep()/unlock_deepsleep() functions implement protection against multi calls to attache() / detatch() functions. Lock is performed only for the initial callback setup and unlock only when callback is registered.
Fix to the Timer/LowPowerTimer should be provided in the additional PR? |
I would clean it all within one patch.
That should be the case, if it's not is a bug.
How far are with with 5028? If we can make progress with that one fast (there is Ci running now). We will need to add there that info plus fix these classes also. Because I can see also another path. To fix this by just getting ticker data - if it's lp ticker, deepsleep locking is disabled (that is what we have now, no info). This would be intermediate fix that 5028 could clean up once we get the proper info in. |
I understand that this solution is a workaround for now. Should i proceed with this fix? |
Yes, I discussed it with @pan- , agrees also. please update |
That's the best solution for now, it doesn't require API changes and it should always work.
That's right, apologies I misread the code. |
380ba30
to
06a3db9
Compare
06a3db9
to
10ee2fa
Compare
} | ||
|
||
void Timer::start() { | ||
core_util_critical_section_enter(); | ||
if (!_running) { | ||
sleep_manager_lock_deep_sleep(); | ||
if(_lock_deepsleep) { |
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.
There should be space if (
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Fix for issue #5076.
Description
This PR contains fix to be able to enter deep-sleep mode while using low power ticker/timer.
Status
READY
Migrations
YES
After this fix is when low power ticker/timer is in use deep-sleep will not be disabled.