From f8e3261033eedb82ea50466da53033ee3bdfb94f Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 8 Nov 2019 09:46:55 +0100 Subject: [PATCH] added delay for wifi stability on ESP8266 clones --- src/MyESP.cpp | 4 ++++ src/MyESP.h | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/MyESP.cpp b/src/MyESP.cpp index 89930b269..d26329099 100644 --- a/src/MyESP.cpp +++ b/src/MyESP.cpp @@ -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. } diff --git a/src/MyESP.h b/src/MyESP.h index d7ea53dce..3e78588fb 100644 --- a/src/MyESP.h +++ b/src/MyESP.h @@ -9,7 +9,7 @@ #ifndef MyESP_h #define MyESP_h -#define MYESP_VERSION "1.2.16" +#define MYESP_VERSION "1.2.17" #include #include @@ -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