I have a use case where my DeviceOS v1.0.1, P1 device needs to operate in an offline mode ie without WiFi.
Am using modified @rickkas7 WiFi strategy so as to enable operation in an intranet situation, ie with WiFi but no Internet. This works a treat, but I have a very specific issue:
- WiFi + Internet - OK
- WiFi + NO Internet - OK
- No WiFi - ISSUE
Here is a log showing that there is No WiFi - notice specifically the "TRACE: connect cancel" which, I think, means a Particle.disconnect has been called internally (can anyone confirm this?):
0000012692 [app] INFO: waitFor(WiFi)
0000012692 [app] INFO: WiFi.connect()
0000012739 [hal.wlan] INFO: Joining UMDHOTSPOT2
0000012739 [hal.wlan] TRACE: Free RAM connect: 20192
0000019830 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1024
0000019830 [hal.wlan] INFO: Joining UMDHOTSPOT2
0000019830 [hal.wlan] TRACE: Free RAM connect: 20192
0000026921 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1024
0000026921 [hal.wlan] INFO: Joining UMDHOTSPOT2
0000026921 [hal.wlan] TRACE: Free RAM connect: 20192
0000034014 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1024
0000036114 [hal.wlan] TRACE: connect cancel
0000036114 [hal] TRACE: 20015ae8 socket list: 0 active sockets closed
0000036114 [hal] TRACE: 20015af0 socket list: 0 active sockets closed
0000036912 [hal.wlan] INFO: Using internal antenna
0000036961 [hal.wlan] INFO: Joining UMDHOTSPOT2
0000036961 [hal.wlan] TRACE: Free RAM connect: 20224
0000042892 [app] WARN: WiFi NOT ready!
The issue shows itself within the keypad scanning class. I have a 5 x 3 matrix keypad connected to the P1's digital I/O.
One of the lines, ROW_1, is connected to P1S6. I have followed the instructions:
To enable GPIO use of P1S6, must add the following code to the setup() function or as an argument to STARTUP():
System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK);
We have not used any external pullup resistors on the ROW_x lines, just configured the ROW pins to be INPUTS and to use their internal pullups.
The bad side effect that we are seeing via code (NOTE have not attached a logic analyser to positively confirm) is the P1S6 line is going LOW when there is no WiFi access point to connect with.
Can anyone comment on this? Is this expected?
I will now try the following software work around to this issue and report back:
- swap columns to be inputs
- swap rows (specifically P1S6) to be outputs