<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — ESP32 - Delay when disconnected]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=1329</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1329&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in ESP32 - Delay when disconnected.]]></description>
		<lastBuildDate>Thu, 03 Jun 2021 01:34:43 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: ESP32 - Delay when disconnected]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4023#p4023</link>
			<description><![CDATA[<div class="quotebox"><cite>santo.minniti wrote:</cite><blockquote><p>I use RemoteXY.connect_flag for making DC motors stop when ESP32 lost Bluetooth connection</p></blockquote></div><p>What is the code you used for this method?&nbsp; I personally couldn&#039;t get any response from that flag... or perhaps I didn&#039;t wait long enough?</p><p>Instead, I used this in my <strong>void loop()</strong>…&nbsp; Which gives me the required failsafe stop (and visual disconnection notice) for my rover within a few seconds.</p><div class="codebox"><pre><code>// Connection Failsafe
  if (RemoteXY_isConnected() == 0) {
    RemoteXY.joystick_1_x = 0; // Set for dead stop
    RemoteXY.joystick_1_y = 0; // Set for dead stop
    // Flash headlamp LED when App not connected.
    digitalWrite(PIN_LED, !digitalRead(PIN_LED));
    delay(500);
  }</code></pre></div><br /><p>Also,&nbsp; I use WiFi in my rover, which I believe is just quicker at responding to feedback than Serial, which being slower needs more leeway in it&#039;s timeout settings else it may never stay stably connected.&nbsp; Perhaps try switching to WiFi and see if it is quicker for you as well.</p><p>Otherwise, I suppose you could try some changes to the <strong>RemoteXYComm_AT.h</strong> library (I think that would be applicable for BT/BLE), which does have a few timeout settings in what looks like millisecond ranges.</p><p>NOTE: I have no idea if this would be the proper way to accomplish your goal, but experimenting is half the fun.... make backups <img src="https://forum.remotexy.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><div class="codebox"><pre><code>#define REMOTEXYCOMM_AT__COMMAND_TIMEOUT 1000
#define REMOTEXYCOMM_AT__SEND_TIMEOUT 5000
#define REMOTEXYCOMM_AT__TEST_TIMEOUT 30000
#define REMOTEXYCOMM_AT__CONNECT_TIMEOUT 20000</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Gunner)]]></author>
			<pubDate>Thu, 03 Jun 2021 01:34:43 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4023#p4023</guid>
		</item>
		<item>
			<title><![CDATA[ESP32 - Delay when disconnected]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4022#p4022</link>
			<description><![CDATA[<p>Hello everyone, I&#039;m noob so forgive me if I ask a stupid question!<br />I&#039;m making my first project with Esp32 and RemoteXY via Bluetooth.</p><p>I use ESP32 board with an H bridge to control two DC Motors.</p><p>I use RemoteXY.connect_flag for making DC motors stop when ESP32 lost Bluetooth connection,but if I disconnect bluetooth from my phone it takes 8-10 seconds for dc motors to stop.</p><p>How can I solve this problem?<br />thank you very much for your attention!</p>]]></description>
			<author><![CDATA[null@example.com (santo.minniti)]]></author>
			<pubDate>Wed, 02 Jun 2021 23:40:43 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4022#p4022</guid>
		</item>
	</channel>
</rss>
