Resilience and AUTOMATIC vs MANUAL

In AUTOMATIC mode if you’re connected to the Spark Cloud and the cloud goes away (ISP issue, router problem, whatever) user code stops. My application does UDP broadcasts but it doesn’t need the cloud so I thought I would improve resilience by not having it connect to the Cloud: by running it in MANUAL mode.

(In order to work around another bug, reported elsewhere, I am not running in MANUAL mode but starting in AUTOMATIC and then Spark.disconnect() is called.)

So far, so good.

But if I power cycle my router - leaving it off for a minute or two - the UDP broadcasts are not sent when the router comes back up. This is contrast to what happens with exactly the same code which never calls Spark.disconnect(). That cloud-connected version eventually forces a reboot of the Spark - the application continues.

So, the problem is this: I have not made the core more resilient by disconnecting from the Cloud! I need a way to determine there is something wrong with the WiFi connection and then to call System.reset(). But WiFi.ready() returns true after I reboot the router even though the UDP packets stop getting sent. Note that the code continues to seem to run, just the UDP packets are not sent. I want to be able (a) to detect this from inside the code - there seems to be no way to do this - and (b) effect a reset of the WiFi connection.

Is it safe or advisable to call Spark.process() when not connected to the cloud? What about SPARK_WLAN_Loop()?