Connection lost after router restart

Hello when the router restart after a power restart the arduino go up before the internet connection.
So in the monitor i see that the process is stopped in this point without errore messages:
Blynk.begin(auth, wifi, ssid, pass);
This force me to restart Arduino by power supply, after (with internet on) goes fine and it is connected.
I use a wifi connection by a esp8266 shield connected with a Arduino mega on Serial1 pins.
How can use one timeout with this library BlynkSimpleShieldEsp8266.h, so when there is not connection the process works the same without blynk?


 
//#define BLYNK_DEBUG // debugga
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

 
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "d8985243xxxxx8d40fba31ec5c3c1";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Vodafone-33734410";
char pass[] = "wifidixxxerrebecca";  

#define EspSerial Serial1

#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
 
   
 
void setup()
{
  // Set console baud rate
   Serial.begin(9600);
   delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);
  }

  
void loop()
{   Blynk.run();   
}

You could check for connection and then simply use WDT to automatically reset the Arduino.

I have the same problem. If the connection fails, the program crashes to the Blynk.begin line and does not run wdt_enable (last line of the setup).

Hello,

Use Blynk.config() instead of Blynk.begin().
The sketck will not block if there is no connection available.

Unfortunately Blynk.config() and/or it’s required WiFi setup, doesn’t play nicely with ESP as shield… at least it didn’t last time I tried to find a workaround.