Hi,
Firstly, I must congratulate the team here on supporting the community - with this level of support, I can see [more] great things happening with Particle products. We’re pretty excited here with the Electron in our sights.
I’m having an little problem with Wifi OFF/ON scenario - I have managed to strip down the problem to a small example.
So, I’m in MANUAL mode, turn WIFI on, connect, get ready and we’re good to do Wifi stuff.
At end of the loop, I turn Wifi Off (in the actual application to save power)
During the second run through, I never get Wifi.Ready() unless I call WiFi.connect() a second time, then we’re good to go, always.
If you commented out the second WiFi.connect() on line 32, we should just be waiting for IP allocation but it never happens. Interestingly, the status light flashes fast green, then white, then repeats. I understand the white light in this context may show the WiFi module as being Off.
Any thoughts? Firmware is latest 0.4.4 release.
SYSTEM_MODE(MANUAL);
void setup() {
Serial.begin(9600);
}
void loop() {
static uint32_t count = 0;
WiFi.on();
Serial.println("WIFI ON");
WiFi.connect(); // Associate with AP
while ( WiFi.connecting() ) {
// Wait for wifi connection
Serial.println("Waiting for connection");
delay(1000);
}
Serial.println("WIFI Associated");
while ( ! WiFi.ready() ) {
// Wait for IP allocation
Serial.println("Waiting for WIFI Ready");
delay(1000);
// Even though we connected and verified about,
// Unless we connect again, we never get the Ready state
// Possibly the Wifi module has disassociated or has been kicked off
// Connecting again however always reconnects without a problem
Serial.println("Connecting again, even though we connected already");
WiFi.connect(); // THIS SHOULD NOT BE NEEDED
}
Serial.println("WIFI fully ready");
int rssi = WiFi.RSSI();
Serial.println(rssi);
Serial.print("Loop: ");
Serial.println(++count);
Serial.println("=============");
// Disconnect and turn off
WiFi.disconnect();
WiFi.off();
delay(1000);
}