From 323ccbead5f3c8487e9a185a62fdf5f8eb44ec2b Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 29 Apr 2020 10:25:40 -0700 Subject: [PATCH] BUGFIX: Use unsigned variables for things that can't be negative (#8) --- src/WebOTA.cpp | 4 ++-- src/WebOTA.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WebOTA.cpp b/src/WebOTA.cpp index 0a2005c..a00571f 100644 --- a/src/WebOTA.cpp +++ b/src/WebOTA.cpp @@ -201,8 +201,8 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) { // 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(); +void WebOTA::delay(unsigned int ms) { + unsigned int last = millis(); while ((millis() - last) < ms) { OTAServer.handleClient(); diff --git a/src/WebOTA.h b/src/WebOTA.h index 794a90c..801f60d 100644 --- a/src/WebOTA.h +++ b/src/WebOTA.h @@ -16,7 +16,7 @@ class WebOTA { int init(const unsigned int port, const char *path); int init(const unsigned int port); int init(); - void delay(int ms); + void delay(unsigned int ms); #ifdef ESP8266 int add_http_routes(ESP8266WebServer *server, const char *path);