<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — set a time to disconnect connection between smartphone and esp8266]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1184&amp;type=atom" />
	<updated>2020-11-02T15:51:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1184</id>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3440#p3440" />
			<content type="html"><![CDATA[<p>Dear Guillaume <br />Could you please provide another try to help</p>]]></content>
			<author>
				<name><![CDATA[yoyoml]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1566</uri>
			</author>
			<updated>2020-11-02T15:51:13Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3440#p3440</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3432#p3432" />
			<content type="html"><![CDATA[<p>i have used your example to make if phone connected wait 5 seconds then stop app for 10 seconds and it doesnt work properly so could you help me to figure out the issue and help me to make this code run as i plan to </p><p>unsigned long ledStarted = 0;<br />const long interval = 5000;</p><p>void loop()<br />{<br /> bool stopRemoteXYFor10Seconds = false; // set this variable to true whenever you need to stop remotexy for 10 seconds.</p><p>&nbsp; uint32_t now = millis();<br />&nbsp; static bool stopRemoteXY = false;<br />&nbsp; static uint32_t stopRemoteXYMillis = now;</p><p>&nbsp; if ( !stopRemoteXY &amp;&amp; stopRemoteXYFor10Seconds )<br />&nbsp; {<br />&nbsp; &nbsp; stopRemoteXY = true;<br />&nbsp; &nbsp; stopRemoteXYMillis = now;<br />&nbsp; }</p><p>&nbsp; if ( stopRemoteXY &amp;&amp; now - stopRemoteXYMillis &gt;= 10000UL )<br />&nbsp; {<br />&nbsp; &nbsp; stopRemoteXY = false;<br />&nbsp; }</p><p>&nbsp; if ( !stopRemoteXY )<br />&nbsp; {<br />&nbsp; &nbsp; &nbsp;remotexy.handler();<br />&nbsp; }<br />&nbsp; &nbsp;unsigned long currentMillis = millis();<br />&nbsp; if (currentMillis - ledStarted &gt;= interval &amp;&amp; remotexyStruct.connect_flag!=0 ) {<br />&nbsp; &nbsp; ledStarted = currentMillis;<br />stopRemoteXYFor10Seconds = true;<br />&nbsp; }<br />}</p>]]></content>
			<author>
				<name><![CDATA[yoyoml]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1566</uri>
			</author>
			<updated>2020-10-22T17:04:38Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3432#p3432</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3422#p3422" />
			<content type="html"><![CDATA[<p>Something like this<br /></p><div class="codebox"><pre><code>void loop()
{
  bool stopRemoteXYFor10Seconds = false; // set this variable to true whenever you need to stop remotexy for 10 seconds.

  uint32_t now = millis();
  static bool stopRemoteXY = false;
  static uint32_t stopRemoteXYMillis = now;

  if ( !stopRemoteXY &amp;&amp; stopRemoteXYFor10Seconds )
  {
    stopRemoteXY = true;
    stopRemoteXYMillis = now;
  }

  if ( stopRemoteXY &amp;&amp; now - stopRemoteXYMillis &gt;= 10000UL )
  {
    stopRemoteXY = false;
  }

  if ( !stopRemoteXY )
  {
    RemoteXY_Handler ();
  }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Guillaume]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=23</uri>
			</author>
			<updated>2020-10-18T23:02:24Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3422#p3422</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3415#p3415" />
			<content type="html"><![CDATA[<p>Thanks for your continuous help, could you please give an example to stop remotexy handler using millis</p>]]></content>
			<author>
				<name><![CDATA[yoyoml]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1566</uri>
			</author>
			<updated>2020-10-16T12:54:46Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3415#p3415</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3407#p3407" />
			<content type="html"><![CDATA[<p>As far as I know, it&#039;s not possible to detect when a device try to connect.</p><p>To stop remotexy handler, just stop calling RemoteXY_Handler() from loop(), using delay() (noob&#039;s way), or using millis() like in the Blink Without Delay example from Arduino IDE.</p><p>Note that you can possibly create more than one RemoteXY interface in the same program. So multiple users could connect to these multiples interfaces. You can use the same RemoteXY_CONF array for all interfaces but the RemoteXY struct must be unique to each interface.</p><p><a target="_blank" href="http://forum.remotexy.com/viewtopic.php?id=15">http://forum.remotexy.com/viewtopic.php?id=15</a></p>]]></content>
			<author>
				<name><![CDATA[Guillaume]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=23</uri>
			</author>
			<updated>2020-10-13T16:57:24Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3407#p3407</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3402#p3402" />
			<content type="html"><![CDATA[<p>First of all thanks for your fast response <br />Actually I&#039;d like to know how can I stop remotexy handler , another thing can I edit remotexy library in order to detect if another device try to connect and there is device already connected , to disconnect the first connection and establish another one</p>]]></content>
			<author>
				<name><![CDATA[yoyoml]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1566</uri>
			</author>
			<updated>2020-10-09T10:12:08Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3402#p3402</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3399#p3399" />
			<content type="html"><![CDATA[<p>Welcome</p><p>There is no proper way to do that</p><p>When a Control (Buttons, Sliders etc) value has changed, assign millis() to a variable, and periodically check if ( RemoteXY.connect_flag == 1 &amp;&amp; millis() - variable &gt;= e.g. 30 seconds ), if true then stop calling RemoteXY_Handler() for like 10 seconds, this will kick the currently connected client and allow a new connection</p><p>It&#039;s possible to do something more elegant, but requires to write a custom remotexy library</p>]]></content>
			<author>
				<name><![CDATA[Guillaume]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=23</uri>
			</author>
			<updated>2020-10-07T14:28:57Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3399#p3399</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[set a time to disconnect connection between smartphone and esp8266]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3398#p3398" />
			<content type="html"><![CDATA[<p>considering that remotexy did not support to connect more than one phone at same time so i&#039;d like to make a timer to disconnect the connection between phone and esp8266 so, if the application has been held in background , it will not effect the efficency of our device and the phone will be disconnected and give a chance to another phone to connect again </p><p>also , if it is possible to make it if device connected and another one try to connect disconnect the first connection and esablish another one </p><p>so please help me to make this idea come into reality</p>]]></content>
			<author>
				<name><![CDATA[yoyoml]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1566</uri>
			</author>
			<updated>2020-10-07T11:29:52Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3398#p3398</id>
		</entry>
</feed>
