Topic: millis() overflow is an issue
Hello
In module esp8266wifi, there is this timeout thing:
if ( serverTimeOut < millis () )
...
void resetServerTimeOut()
{
serverTimeOut = millis() + REMOTEXY_SERVER_TIMEOUT;
}This is not the correct way to calculate time differences.
You must replace it by something like this:
if ( millis() - serverTimeOut >= REMOTEXY_SERVER_TIMEOUT )
...
void resetServerTimeOut()
{
serverTimeOut = millis();
}I don't remember if I already asked you this, but why don't you put the library on github? That would be a better place to discuss about issues, and I could even make fixes and pull requests. Also users will be able to download updates of your library with the Arduino IDE / PlatformIO IDE library managers, or whatever they are using.
Edit:
Here is the list of all "millis" used in your code.
Search "millis" (15 hits in 4 files)
D:\Arduino\libraries\RemoteXY\classes\RemoteXY_API.h (9 hits)
Line 173: if (wireTimeOut<millis()) {
Line 318: wireTimeOut=millis()+REMOTEXY_TIMEOUT;
Line 320: if (cloudState==3) cloudTimeOut=millis()+REMOTEXY_CLOUD_ECHO_TIMEOUT;
Line 371: cloudTimeOut = millis()+REMOTEXY_CLOUD_RECONNECT_TIMEOUT;
Line 383: if (cloudTimeOut<=millis()) {
Line 393: cloudTimeOut = millis()+REMOTEXY_CLOUD_RECONNECT_TIMEOUT;
Line 400: cloudTimeOut = millis()+500;
Line 406: cloudTimeOut = millis()+ REMOTEXY_CLOUD_CONNECT_TIMEOUT;
Line 410: if (cloudTimeOut<=millis()) {
D:\Arduino\libraries\RemoteXY\classes\RemoteXY_AT.h (2 hits)
Line 69: uint32_t timeOut = millis()+delay;
Line 72: while (timeOut>millis()) {
D:\Arduino\libraries\RemoteXY\modules\esp8266wifi.h (2 hits)
Line 101: if (serverTimeOut<millis ()) {
Line 173: serverTimeOut = millis ()+REMOTEXY_SERVER_TIMEOUT;
D:\Arduino\libraries\RemoteXY\modules\ethernet.h (2 hits)
Line 63: if (serverTimeOut<millis ()) {
Line 119: serverTimeOut = millis ()+REMOTEXY_SERVER_TIMEOUT;
All those lines need to be changed like in my example above.