mirror of
https://github.com/scottchiefbaker/ESP-WebOTA.git
synced 2024-08-30 18:12:33 +00:00
Add webota_delay() to handle OTA friendly delay() calls
This commit is contained in:
parent
926844a420
commit
a933ec00da
@ -148,3 +148,16 @@ int init_web_ota(WebServer *server) {
|
|||||||
|
|
||||||
server->begin();
|
server->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the MCU is in a delay() it cannot respond to HTTP OTA requests
|
||||||
|
// We do a "fake" looping delay and listen for incoming HTTP requests while waiting
|
||||||
|
void webota_delay(int ms) {
|
||||||
|
int last = millis();
|
||||||
|
|
||||||
|
extern WebServer OTAServer;
|
||||||
|
|
||||||
|
while ((millis() - last) < ms) {
|
||||||
|
OTAServer.handleClient();
|
||||||
|
delay(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
|
|
||||||
|
extern WebServer OTAServer;
|
||||||
|
|
||||||
int init_wifi(const char *ssid, const char *password, const char *mdns_hostname);
|
int init_wifi(const char *ssid, const char *password, const char *mdns_hostname);
|
||||||
String ip2string(IPAddress ip);
|
String ip2string(IPAddress ip);
|
||||||
int init_mdns(const char *host);
|
int init_mdns(const char *host);
|
||||||
int init_web_ota(WebServer *server);
|
int init_web_ota(WebServer *server);
|
||||||
|
void webota_delay(int ms);
|
||||||
|
Loading…
Reference in New Issue
Block a user