Simple sketch:
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(MANUAL);
const uint32_t RETRY = 1000;
uint32_t ms;
void setup()
{
Serial.begin(9600);
System.on(network_status, handle_all_the_events);
Serial.println("setup end");
WiFi.on();
WiFi.connect();
}
void loop()
{
if (millis() - ms > RETRY )
{
ms = millis();
Serial.print(WiFi.ready());
Serial.print(" | ");
Serial.println(ms);
}
}
void handle_all_the_events(system_event_t event, int param)
{
Serial.printlnf("got event %d with value %d");
}
In serail output i see only:
setup end
0 | 2000
1 | 3000
1 | 4000 and so on…
If I turn on/off router - photon lost wifi and make reconnect. I see it by blinking green led, but no Serial output for this events.
Any assumptions - why?