I’m working with ESP8266/32 and I am stuck with something,
I build myself a “smartconnect” función that attempts to connect to wifi credentials savef on the spiff
If it fails, it host a website to enter ssid,pass, auth token, and after saving the credentials the esp restarts.
It works just fine, also if the ESP is connected to they wifi network, It host anothe website to change some parameters…
but this is the issue, if I enter a wrong token, the esp connects to the wifi network, and get stucks forever at “invalid token”… pseudo code as example…
The same problems hapens if by any reasone internet goes down and the esp dot get the heartbeat from blynk server.
the idea of the app is to be able to acces the website hosted on the ESP even if the token is invalid, or if the internet goes down.
I try to raise a flag as “invalid token” fllag, to try Blyk.disconnect() but, the issue is with the Blink.Beguin, it get stuck forever.
Is there any workarround? this is a pseudo code
Blynk.begin(auth, ssid, pass);
Serial.println(“this will never be printed if internet is down or if token is not valid”);
validTokenFlag = Blynk.isTokenInvalid();
@Andres_Alvarez, the problem you have is that you’re using Blynk.begin which is a blocking command. If it can’t establish a connection to the Blynk server, either because it doesn’t get past the process of connecting to WiFi, or because you’ve entered an incorrect Auth code, code execution will stop at this point.
You need to shift to using Blynk.config and Blynk.connect, and you also need to manage your own WiFi connection process.