blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.81k stars 1.38k forks source link

Update BlynkSimpleEsp8266.h #524

Open EarlVadim opened 3 years ago

EarlVadim commented 3 years ago

modified the library so that it was possible to limit the time of attempts to establish a connection and their number, in order to be able to somehow fork the connection script.

Description

Add 2 functions connectWiFi_t and begin_t

Usage example

int conB_count = 5;
while ((!Blynk.begin_t(auth, ssid, pass, IPAddress(172,18,0,100), 8080, 30000)) && (conB_count>0))  --conB_count;
if (WiFi.status() != WL_CONNECTED) ESP.restart();

Issues Resolved

after long testing, I found out that after waking up from sleep, the connection to the access point can take up to 30 seconds or more. sometimes frozen. I modified the library so that it was possible to limit the time of attempts to establish a connection and their number, in order to be able to somehow fork the connection script.