I am having a problem using WiFi.ready() where it looks like it returns before the WiFi is actually ready. If I run the following I will get an IP of 0.0.0.0 unless I un-comment the delay line. I found this thread which discussed a similar issue so I tried to use the solution provided by @ScruffR and replaced delay() with particle.process() and that did nothing. I tried both waitUntil and just a simple while loop (as seen below) and I still can’t get an IP unless I give it some time.
Is this expected? WiFi works and is connected, I just think it’s odd that it can’t give me an IP when it thinks it’s ready.
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
Serial.begin();
delay(1000);
Serial.println("Starting WiFI");
WiFi.connect();
waitUntil (WiFi.ready);
while (!WiFi.ready()) delay(1);
//delay(1);
Serial.print("Local IP: ");
Serial.println(WiFi.localIP());
Particle.connect();
}
void loop() {
// nothing to see here... move along...
}