-
Notifications
You must be signed in to change notification settings - Fork 513
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
Restores the modem state after device is woken up. #2308
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.
Rejecting because of status.on
logic.
wiring/sleep20
also needs to be updated to have a set of tests to validate this behavior.
system/src/system_sleep.cpp
Outdated
network_wait_off(index, 120000/*ms*/, nullptr); | ||
return resume; | ||
if (!network_is_off(index, nullptr)) { | ||
status.on = true; |
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 it's being powered off right now (IF_POWER_STATE_POWERING_DOWN
on Gen 3)? This might need to have separate implementation for Gen 2 and Gen 3: SPARK_WLAN_XXX
for Gen 2 and going into network manager on Gen 3 for pwrState
value.
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.
Good catch! Will work around it.
system/src/system_sleep.cpp
Outdated
} | ||
|
||
static int system_sleep_network_resume(network_interface_index index) { | ||
int system_sleep_network_resume(network_interface_index index, network_status_t& status) { |
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 is no need to pass network_status_t
by reference here, which semantically means that it may be modified. Either by value (preferred) or at least const reference.
cc48796
to
363db1a
Compare
363db1a
to
9608641
Compare
Problem
For sleep 2.0 API, if the modem is powered on, but not establishing connection, it won't restore the modem power state after device is woken up.
Solution
Tracks the modem power state and connection state respectively in system sleep.
Steps to Test
Running the example below building against develop branch you won't see the modem is on after device is woken up, but you will if you build it against the current branch.
Example App
References
N/A
Completeness