I got it .
To let any ESP8266 work automatically if any wifi issues will happen we have to update the BlynkSimpleShieldEsp8266.h library as following:
1- add #include <avr/wdt.h> library inside the BlynkSimpleShieldEsp8266.h library.
2- add wdt_enable(WDTO_1S); and wdt_reset(); to connectWiFi lines as shown down:
bool connectWiFi(const char* ssid, const char* pass)
{
::delay(500);
BLYNK_LOG2(BLYNK_F("Connecting to "), ssid);
/*if (!wifi->restart()) {
BLYNK_LOG1(BLYNK_F("Failed to restart"));
return false;
}*/
if (!wifi->kick()) {
BLYNK_LOG1(BLYNK_F("ESP is not responding"));
wdt_enable(WDTO_1S);
wdt_reset();
//TODO: BLYNK_LOG_TROUBLE(BLYNK_F("esp8266-not-responding"));
return false;
}
if (!wifi->setEcho(0)) {
BLYNK_LOG1(BLYNK_F("Failed to disable Echo"));
return false;
}
String ver = wifi->ESP8266::getVersion();
BLYNK_LOG1(ver);
if (!wifi->enableMUX()) {
BLYNK_LOG1(BLYNK_F("Failed to enable MUX"));
}
if (!wifi->setOprToStation()) {
BLYNK_LOG1(BLYNK_F("Failed to set STA mode"));
return false;
}
if (wifi->joinAP(ssid, pass)) {
String my_ip = wifi->getLocalIP();
BLYNK_LOG1(my_ip);
} else {
BLYNK_LOG1(BLYNK_F("Failed to connect WiFi"));
wdt_enable(WDTO_1S);
wdt_reset();
return false;
}