I’m finding strange results with WiFi.connect(); tested on 0.7.0 and 0.8.0-rc11. From all my forum research and testing, it seems WiFi.connect is a (permanent) blocking call. When the WAP is not available, out of range or have no internet connection either my Photon ends up in some red flashing SOS state restarting automatically or forever green flashing. The code is blocked and doesn’t move on to further evaluations. This makes for an extremely unstable connection situation.
However, testing WiFi.connect(time_out) as in WiFi.connect(5000); works! It seems from my testing it tries to connect, but stops after the time out period and moves on to my next code. This is definitely not documented and couldn’t find any post on the forum talking about it.
I’d like someone else to confirm my observation or who knows the firmware code to acknowledge. I’m happy to try and submit a pull request to update the documentation if this is accurate.
PS: When using SYSTEM_MODE(SEMI_AUTOMATIC); SYSTEM_THREAD(ENABLED);
EDIT: Maybe premature. I’m still getting an SOS on restart if no WiFi networks are available. Still it compiles with the timeout and makes a difference in some situations.