Export to GitHub

as3-arduino-connector - issue #22

reconnecting to device sometimes causes application to crash.


Posted on May 28, 2013 by Helpful Bear

I have made an air for desktop app on win 7 which communicates to an atmega 8 based system.

When I first connect to the system it works absolutely fine but if I lose connection for example the system goes off or to simulate I sometimes disconnect and reconnect the USB from my laptop. Sometimes it will reconnect but most of the time it will crash my application like it went into a infinite while loop.

I will attach a simple version of my code here. The corresponding atmega system for this is setup to echo the letter "H" when I send it from the app by clicking button b1. Button b1 is used to reconnect and textfield t1 displayed the received string.

This is what I do to recreate the problem.

  1. First open the app and while connected to a system that will echo u.
  2. Press b1 to connect.
  3. Press b2 to send H and see the reply displayed in the textfield t1
  4. Now disconnect the USB cable from the computer and reconnect it.
  5. Try to send H again by pressing b2 to check if the connection is still open. Usually here you will not receive anything.
  6. Try to reconnect by pressing b1. Here the application usually crashes for me. if it reconnects repeat steps 4,5 and 6. It connects around 2 out of 5 times the other times the app crashes.

Thank you for your help

Regards,

Gautham

Attachments

Status: New

Labels:
Type-Defect Priority-Medium