Hello my Blynk friends.
If made a programm on ESP for Homeautomation.
Everything is working well.
Now I test some failure cases which could be.
One of them is, that on Start up, no WLAN is available.
The Other test case, is if Blynk server is down or do not can reach.
For WLan only , this if have on my Sketch insert and It works well.
So if WLAN is not available, I get a measage on screen and the programm
goes further in Startupsequence in Sketch
After Wlan is connected and availabe I go to connect to Blynk.
And there I see, if Blynk connection do not come together, the Programm stops here and
go not further. It looks like it was waiting.and waiting and waiting…
I test this in that wise , that I make for a try, an emulate “no Blynk connection” by set a wrong Token.
So the Question is:
How can I make it , that my Programm see that there is no Blynk connection and
goes further in programm sequence and do not “stop”.
Unlucky I do not can see on Serial Monitor, because I Have this Pins on my Hardware for Leds
and Watchdog…
Here is the Part in void setup() , where I be after all Init´s and so on and after a stable Wlan Connection.
For better understanding, i is the value for 20 tryings to connect Wlan.
It “stops” or “hang up” or “wait” for sure on : Blynk.begin(auth, ssid, pass); // new Blynk IOT
if (i >=20 ) // Anzeige , wenn nach 20 Versuchen keine WLAN Aufbau
{
u8g2.setFont(u8g2_font_courB10_tf);
u8g2.setCursor(0, 10);
u8g2.clearBuffer();
u8g2.println("No WLAN ");
u8g2.setCursor(0, 30);
u8g2.println("----");
u8g2.setCursor(0, 50);
u8g2.println("Connection");
u8g2.sendBuffer();
u8g2.clearBuffer();
delay(800);
}
else
{
Blynk.begin(auth, ssid, pass); // new Blynk IOT
}
delay(800);
bool result = Blynk.connected();
if (result == false) // damit Programm nicht hängt, wenn Bynk am Anfang nicht vorhanden ist.
{
u8g2.setFont(u8g2_font_courB10_tf);
u8g2.setCursor(0, 10);
u8g2.clearBuffer();
u8g2.println("No Blynk");
Blynk.disconnect();
delay(800);
´´´