--
You received this message because you are subscribed to a topic in the Google Groups "ioio-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ioio-users/zDXx_-guywQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ioio-users+unsubscribe@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+unsubscribe@googlegroups.com.
private void _flushInput()
{
String TAG = "RpLidar._flushInput";
final int arrSize = 1000; // assume no more than this many characters in response
byte[] readBuffer = new byte[arrSize];
try
{
while( _inputStream.available() > 0 )
_inputStream.read( readBuffer );
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG,e.getLocalizedMessage()); //line 956 in LogCat
}
}
Here is the reset() method that calls _flush(). It's go a lot of waits and sleeps and yields because of troubleshooting in progress:
/**
* Reset(reboot) the RPLIDAR core
* No response is defined in documentation, but testing shows some text is returned
* and is flushed - See comments for details.
* @return true if command was placed in queue
*/
public synchronized boolean reset(){
String TAG = "RpLidar.reset";
Log.d(TAG, "Starting...");
//make sure IOIO is connected
if(!isOpen()) return false;
RplRequest req = getRplRequest(RequestTypes.RESET);
if(req==null){
Log.d(TAG,"FAIL: req = null");
return false;
}
if (!doRplRequest(req)) {
Log.d(TAG,"FAIL: doRplRequest failed");
return false;
}
//troubleshooting
// long timeoutMs = System.currentTimeMillis()+1000;
// while (System.currentTimeMillis() < timeoutMs){
// Thread.yield();
// }
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
Log.d(TAG,"FAIL: Sleep interrupted");
return false;
}
Log.d(TAG,"Before flush...");
try {
Log.d(TAG,"... inputStream.avail = "+_inputStream.available());
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG,"FAIL: IO Exception");
return false;
} catch (NullPointerException e){
//why is this happening? BT Disconnect?
e.printStackTrace();
Log.d(TAG,"FAIL: InputSteam NullPointerException");
return false;
}
_flushInput();
try {
_outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG,"FAIL: Sleep interrupted");
return false;
}
Log.d(TAG,"After flush...");
try {
Log.d(TAG,"... inputStream.avail = "+_inputStream.available());
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG,"FAIL: Sleep interrupted");
return false;
}
Log.d(TAG,"Return: SUCCESS");
return true;
}
I would try a different dongle and/or recalibrate the IOIO oscillator as described in the wiki under calibration wipe. I've seen cases where data losses occur silently with some dongle/phone combination, resulting in a disconnect.From your logs I see no evidence of disconnects though. Would you share your code?
On Dec 3, 2016 8:52 PM, "Kevin Miller" <ksmil...@gmail.com> wrote:
It looks like the problem is related to Bluetooth after all. When I use the UART for several exchanges, the Bluetooth disconnects 6 times out of 10. See attached Logcat.I've tried two different phones.--I see others have had similar issues. Any suggestions? I only need Bluetooth for debugging, but I'm dead in the water now.Kevin
On Wednesday, November 30, 2016 at 5:54:17 PM UTC-5, Kevin Miller wrote:Hello,I've got a really big project nearing completion, but now that I'm getting into the fine details of UART communication, I'm having a problem with frequent disconnect()/setup() cycles which is interfering with the serial communications. I'm using Bluetooth for developing, but I don't think that is the cause because when I run the basic HelloIOIOService example, it is rock solid. What other reasons could be causing the disconnect? Is there some way to dig deeper to see what is causing the disconnects?Thanks,Kevin
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+unsubscribe@googlegroups.com.
//start the IOIO Service
Log.d(TAG,"Creating thread for IOIO service...");
thdIoioService = new Thread() {
public void run() {
startService(new Intent(getApplicationContext(), MyIoioService.class));
}
};
thdIoioService.setName("thdIoioService");
thdIoioService.start();
//start the Lidar Service
Log.d(TAG,"Creating thread for Lidar service...");
thdLidarService = new Thread() {
public void run() {
startService(new Intent(getApplicationContext(), RpLidarService.class));
}
};
thdLidarService.setName("thdLidarService");
thdLidarService.start();