How to handle wifi disconnect event in firmware?

How to handle wifi disconnect event in firmware?

Suppose photon is connected to wifi and suddenly connection drops
how do I handle that event in firmware?

If you use SYSTEM_THREAD(ENABLED); and SYSTEM_MODE(SEMI_AUTOMATIC/AUTOMATIC); then once connected the device will automatically try to reconnect in the background so long as in your application:

  1. You handle Internet connection lost - to avoid blocking when a Particle.publish() is made check for Particle.connected() beforehand. It is not just publish() but also TimeSync, etc.

  2. You handle loss of WLAN connection - to detect this check for WiFi.ready() before certain blocking calls. I have a WiFi connection symbol on a screen and checking the connection every 10 seconds works fine.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.