WiFi.ready() == FALSE but WiFi is connected

Running DeviceOS 1.5.0 on a P1, SEMI_AUTOMATIC mode.

Issue with WiFi.ready():

  • It returns TRUE when connected to Particle (good).
  • It returns FALSE when connected to the Access Point (confirmed by pinging the device on the WLAN) when it does not have connection to Particle (bad).

This is an issue if one wants to work in an “intranet only” mode - as one wants to know if the WiFi connection is up or not.

Not sure if this problem has always been there in earlier incarnations of DeviceOS or not.

I have a ticket open because this appears to have been introduced in OS 1.2.1 onwards and it is impacting my products - I don’t run regression testing on everything with Device OSs but appears this is becoming necessary as unwanted behaviour has been introduced again :unamused:

@armor, have you filed this a support ticket or merely as GitHub issue?

GitHub issues don’t count as bug reports anymore - I heard.

@UMD Any example application that you can provide to showcase the issue? Any logs? It’s not reproducible with:

SYSTEM_MODE(SEMI_AUTOMATIC);

SerialLogHandler dbg(LOG_LEVEL_ALL);

void setup() {
    waitUntil(Serial.isConnected);
    WiFi.on();
    WiFi.connect();
}

void loop() {
    Log.trace("WiFi.ready() = %d", WiFi.ready());
    delay(1000);
}

1 Like

Yes I have logged an issue - it is on a support plan! Edit: Mine is a different issue about behaviour when WAP is out of range/not available or Internet connection is lost

2 Likes

@avtolstoy, APOLOGIES!

It was my LOGGING that was wrong:

log.trace("WS_PRTCL_PEND icd=%d W.cncting=%d W.rdy=%d IP=%d",
										nInternetCheckCountDown, WiFi.connecting(),	
										bWiFiReady, bHaveIP);

Should be:

log.trace("WS_PRTCL_PEND icd=%d W.cncting=%d W.rdy=%d IP=%d",
										nInternetCheckCountDown, WiFi.connecting(),
										WiFi.ready(), WiFi.localIP());

Case closed - there is no issue, WiFi.ready() works as advertised.