added delay for wifi stability on ESP8266 clones

This commit is contained in:
Paul
2019-11-08 09:46:55 +01:00
parent 804ed62d67
commit f8e3261033
2 changed files with 9 additions and 1 deletions

View File

@@ -3129,6 +3129,10 @@ void MyESP::loop() {
ESP.restart();
}
if (MYESP_DELAY) {
delay(MYESP_DELAY); // some time to WiFi and everything else to catch up, and prevent overheating
}
yield(); // ... and breath.
}

View File

@@ -9,7 +9,7 @@
#ifndef MyESP_h
#define MyESP_h
#define MYESP_VERSION "1.2.16"
#define MYESP_VERSION "1.2.17"
#include <ArduinoJson.h>
#include <ArduinoOTA.h>
@@ -66,6 +66,10 @@ extern struct rst_info resetInfo;
#define MYESP_WIFI_CONNECT_TIMEOUT 20000 // Connecting timeout for WIFI in ms (20 seconds)
#define MYESP_WIFI_RECONNECT_INTERVAL 600000 // If could not connect to WIFI, retry after this time in ms. 10 minutes
// set to value >0 if the ESP is overheating or there are timing issues. Recommend a value of 1.
// initially set to 0 for no delay. Change to 1 if getting WDT resets from wifi
#define MYESP_DELAY 1
// MQTT
#define MQTT_PORT 1883 // MQTT port
#define MQTT_RECONNECT_DELAY_MIN 2000 // Try to reconnect in 3 seconds upon disconnection