-
Notifications
You must be signed in to change notification settings - Fork 511
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
Gen2: network connection is established unexpectedly. #2309
Conversation
@@ -40,6 +40,7 @@ uint32_t wlan_watchdog_duration = 0; | |||
|
|||
volatile uint8_t SPARK_WLAN_RESET = 0; | |||
volatile uint8_t SPARK_WLAN_SLEEP = 0; | |||
volatile uint8_t SPARK_WLAN_CONNECT_RESTORE = 0; |
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.
How about SPARK_WLAN_CONNECT
instead? Can be set in network_connect()
and where appropriate as well (e.g. manage_network_connection
or restored after sleep).
Fine to leave as-is as well.
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.
I was considering to use SPARK_WLAN_CONNECT
, yet we need to set/clear it in many places to make sure its state is well set, that will even complicate the system network manager for Gen2 and easier to cause race condition under unknown conditions. So I just suffix it with _RESTORE
so that it just need to be set where necessary, like resetting the modem or after sleep. The caller who has called network_off()
should take the responsibility to see if the connection should be restored.
cc48796
to
363db1a
Compare
3b701ea
to
8eeb151
Compare
363db1a
to
9608641
Compare
…connection properly after waking up
8eeb151
to
644aab7
Compare
Problem
Network.on()
and there is something wrong processing the modem events to cause a WLAN_WD to fire or somehow theSPARK_WLAN_RESET
is set to reset the modem, device will try connecting to the network after the modem is reset.Network.on()
and system sleep API is called to make device enter sleep mode, after the device wakes up it will try connecting to the network. (Gen2 with all sleep API and Gen3 with sleep 1.0 API)Solution
Introduce a new flag to indicate if network connection should be restored after powering cycle the modem. The flag is set
Finally the
manage_network_connection()
will handle the connection accordingly:Steps to Test
Network.connect()
in the example. The device should not initiate connection after it wakes up.Example App
References
N/A
Completeness