Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By RichardS
#54691 [FIXED read the whole thread to see how....]

So I am current connected to AP X and I want to disconnect X and connect to AP Y, so I use

Code: Select allWiFi.disconnect();
while (WiFi.status() == WL_CONNECTED) delay(1000);


to make sure I am disconnected from X.

Why does this cause a WDT I am delay()ing....

Any other better methods?

As a side note.... sometimes it does not WDT and it gets to the famous

Code: Select all    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial..print(".");
      if (++cnt == 40) {
        break;
      }
    }


type loop, where I bailout if not connected in 20 seconds, however sometimes the "." is printed very fast across the terminal almost like delay() is broken.....

Thoughts? Is it all related?

RichardS
User avatar
By RichardS
#54702 Yep still at this, and no luck, so easy, but so hard!

Done all sorts of WAY more complicated things and this is biting me.

RichardS
User avatar
By RichardS
#54721 Fixed it, I was using ticker() and within the async nature of the function call of the timer going off it would disconnect and reconnect and it does not like this! Now the ticker function just sets a flag that I detect in the loop and call the function in a sync fashion.

So the delay function is now happy also, I need to look up if your allowed to use delay() in the function that ticker calls :-)

RichardS
User avatar
By RichardS
#54722 So it is a no-no to call delay() in a ticker() function call....

https://github.com/esp8266/Arduino/issues/668

RichardS