<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — millis() overflow is an issue]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=258</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=258&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in millis() overflow is an issue.]]></description>
		<lastBuildDate>Thu, 30 Nov 2017 14:07:07 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: millis() overflow is an issue]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=1098#p1098</link>
			<description><![CDATA[<p>Fixed in vers. 2.3.3 (29.11.2017) of library</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Thu, 30 Nov 2017 14:07:07 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=1098#p1098</guid>
		</item>
		<item>
			<title><![CDATA[Re: millis() overflow is an issue]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=927#p927</link>
			<description><![CDATA[<p>Oh, yes, I understood this problem</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Wed, 20 Sep 2017 07:10:20 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=927#p927</guid>
		</item>
		<item>
			<title><![CDATA[Re: millis() overflow is an issue]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=924#p924</link>
			<description><![CDATA[<p>The value returned by millis will rollover (go back to 0 in case of a unsigned integer) after 49.7 days.</p><p>Let&#039;s say the microcontroller is running since 49.69 days, millis() is about to rollover and you add something to it, the result is now too big to be stored in a uint32_t so the variable rolled over, and the result is not what you expect.</p><p>Basically, using substraction, the result will be what is expected, even when millis rolls over.</p><p>I won&#039;t go into details but if you search google &quot;millis rollover&quot; you will find better explanation of the problem.</p>]]></description>
			<author><![CDATA[null@example.com (Guillaume)]]></author>
			<pubDate>Sat, 16 Sep 2017 20:26:36 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=924#p924</guid>
		</item>
		<item>
			<title><![CDATA[Re: millis() overflow is an issue]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=923#p923</link>
			<description><![CDATA[<p>Yes, I see, this can be a problem after 49 days...</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Sat, 16 Sep 2017 19:37:13 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=923#p923</guid>
		</item>
		<item>
			<title><![CDATA[millis() overflow is an issue]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=920#p920</link>
			<description><![CDATA[<p>Hello</p><p>In module esp8266wifi, there is this timeout thing:</p><div class="codebox"><pre><code>if ( serverTimeOut &lt; millis () )

...

void resetServerTimeOut()
{
    serverTimeOut = millis() + REMOTEXY_SERVER_TIMEOUT;
}</code></pre></div><p>This is not the correct way to calculate time differences.</p><p>You must replace it by something like this:</p><div class="codebox"><pre><code>if ( millis() - serverTimeOut &gt;= REMOTEXY_SERVER_TIMEOUT )

...

void resetServerTimeOut()
{
    serverTimeOut = millis();
}</code></pre></div><p>I don&#039;t remember if I already asked you this, but why don&#039;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.</p><br /><p>Edit:</p><p>Here is the list of all &quot;millis&quot; used in your code.<br /></p><div class="quotebox"><blockquote><p>Search &quot;millis&quot; (15 hits in 4 files)<br />&nbsp; D:\Arduino\libraries\RemoteXY\classes\RemoteXY_API.h (9 hits)<br />&nbsp; &nbsp; Line 173:&nbsp; &nbsp; &nbsp;if (wireTimeOut&lt;millis()) {<br />&nbsp; &nbsp; Line 318:&nbsp; &nbsp; &nbsp;wireTimeOut=millis()+REMOTEXY_TIMEOUT;<br />&nbsp; &nbsp; Line 320:&nbsp; &nbsp; &nbsp;if (cloudState==3) cloudTimeOut=millis()+REMOTEXY_CLOUD_ECHO_TIMEOUT;<br />&nbsp; &nbsp; Line 371:&nbsp; &nbsp; &nbsp;cloudTimeOut = millis()+REMOTEXY_CLOUD_RECONNECT_TIMEOUT;<br />&nbsp; &nbsp; Line 383:&nbsp; &nbsp; &nbsp; &nbsp;if (cloudTimeOut&lt;=millis()) {<br />&nbsp; &nbsp; Line 393:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cloudTimeOut = millis()+REMOTEXY_CLOUD_RECONNECT_TIMEOUT;<br />&nbsp; &nbsp; Line 400:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cloudTimeOut = millis()+500;<br />&nbsp; &nbsp; Line 406:&nbsp; &nbsp; &nbsp; &nbsp;cloudTimeOut = millis()+ REMOTEXY_CLOUD_CONNECT_TIMEOUT; <br />&nbsp; &nbsp; Line 410:&nbsp; &nbsp; &nbsp; &nbsp;if (cloudTimeOut&lt;=millis()) {<br />&nbsp; D:\Arduino\libraries\RemoteXY\classes\RemoteXY_AT.h (2 hits)<br />&nbsp; &nbsp; Line 69:&nbsp; &nbsp; &nbsp;uint32_t timeOut = millis()+delay;<br />&nbsp; &nbsp; Line 72:&nbsp; &nbsp; &nbsp;while (timeOut&gt;millis()) {<br />&nbsp; D:\Arduino\libraries\RemoteXY\modules\esp8266wifi.h (2 hits)<br />&nbsp; &nbsp; Line 101:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (serverTimeOut&lt;millis ()) {<br />&nbsp; &nbsp; Line 173:&nbsp; &nbsp; &nbsp;serverTimeOut = millis ()+REMOTEXY_SERVER_TIMEOUT;<br />&nbsp; D:\Arduino\libraries\RemoteXY\modules\ethernet.h (2 hits)<br />&nbsp; &nbsp; Line 63:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (serverTimeOut&lt;millis ()) {<br />&nbsp; &nbsp; Line 119:&nbsp; &nbsp; &nbsp;serverTimeOut = millis ()+REMOTEXY_SERVER_TIMEOUT;</p></blockquote></div><p>All those lines need to be changed like in my example above.</p>]]></description>
			<author><![CDATA[null@example.com (Guillaume)]]></author>
			<pubDate>Fri, 15 Sep 2017 12:39:43 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=920#p920</guid>
		</item>
	</channel>
</rss>
