@shur1k your sketch seems to be running fine here.
I have made a few changes like baud at 115200 as 9600 is only for super slow Arduinoās.
I have reduced the 60s timer to 10s and added a blinking Blynk LED on V0.
Providing your router doesnāt crash and that you manually reset your ESP after each local flash it should run forever without any connection management modifications.
I am using the following settings:
Blynk library v0.5.0 on their cloud server. Android app version 2.18.2
lwIP v1.4 Prebuilt and master Core as it was about 3 weeks ago (not 2.4.0 release).
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
char auth[] = "xxxxx";
char ssid[] = "xxxx";
char pass[] = "xxxx";
BlynkTimer timer;
void myTimerEvent()
{
Blynk.virtualWrite(V0, 0);
delay(100);
if (Blynk.connected()) {
Serial.print("[");
Serial.print(millis()/1000);
Serial.print("]");
Serial.println(" Blynk is connected");
if (WiFi.status() == WL_CONNECTED) Serial.println("WiFi is Connected");
else Serial.println("WiFi Connection is lost");
}
else {
Serial.print("[");
Serial.print(millis()/1000);
Serial.print("]");
Serial.println(" Blynk is not Connected any more");
if (WiFi.status() == WL_CONNECTED) Serial.println("WiFi is Connected");
else Serial.println("WiFi Connection is lost");
}
delay(100);
Blynk.virtualWrite(V0, 255);
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(10000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
Please note the team behind the ESP8266 Core development are not entirely happy with their SSL implementation of axTLS. They are looking to switch to BearSSL. ESP8266ās really start to struggle with axTLS when you start to add complex libraries to your sketch so you would need to add functions one at a time and see if the ESP still runs OK. That is, donāt add 100 widgets and then test your project, build it up slowly.
This is Serial Monitor for your sketch:
[24006] Connecting to Myhomewifi-2797
[25009] Connected to WiFi
[25009] IP: 192.168.1.239
[25510] Got time: Wed Feb 28 15:02:19 2018
[25510]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.0 on Arduino
[25530] Connecting to blynk-cloud.com:8441
[26231] Certificate OK
[26295] Ready (ping: 62ms).
[36] Blynk is connected
WiFi is Connected
[46] Blynk is connected
WiFi is Connected
[56] Blynk is connected
WiFi is Connected
[66] Blynk is connected
WiFi is Connected
I will leave it running for a few hours but with the correct Core settings it looks OK.