Particle.connected() is returning true even if I am still negotiating wifi (and WiFi.ready() is false).
Is Particle.connected() a state variable set with Particle.connect()?
Particle.connected() is returning true even if I am still negotiating wifi (and WiFi.ready() is false).
Is Particle.connected() a state variable set with Particle.connect()?
Particle.connected()
should be false when not breathing cyan.
If WiFi.ready()
is false Particle.connected()
should always be false.
Hmm. I will double check my code, but looking at the code below, I never see the “no network” message, even though the first two loops of showing the time don’t have the network time correct. After I see the device connect and heartbeat cyan, the time is correct.
/Run the Cloud stuffs in a second thread to prevent blocking when connecting to the cloud
SYSTEM_THREAD(ENABLED);
//Don't attempt to connect to the cloud until after blocking fucntions have been called.
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
Particle.function("mem_lookup", read_mem);
Particle.function("mem_write", write_mem_value);
Particle.connect();
Particle.subscribe("hook-response/AQI", handleAqiHook, MY_DEVICES);
Time.setFormat("%a %b %e, %I:%M %p");
Time.zone((int32_t)read_mem("timezone"));
}
void loop() {
//if(WiFi.ready() && Particle.connected){
if(Particle.connected){
scroll_message(Time.format(), 50, 1);
delay(1000);
} else {
scroll_message("No Network", 50, 1);
delay(1000);
}
}
You're missing the function call, it should be if(Particle.connected())
Whoah.
Thank you.
Why did this compile?
Without the ()
it’s still valid C++ code, unfortunately. You’re checking to see if the method pointer is non-null, which it is, because the function exists. It’s a common and annoying C++ non-error.
Thank you!