ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Leornardo Serial boolean flag should be set to false when serial port is closed. #1052

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What change would like to see?
On Arduino Leonardo, "if(Serial)" allows to know when Serial CDC is open for 
the FIRST time, but this parameter isn't updated when the serial closes / when 
shutting down hyperterminal on computer. So it is not possible to detect the 
next hyperterminal/serial opening.

Why?
To reproduce the same behavior as the Uno (setup welcome messages on every 
hyperterminal openings), it would be nice to update this parameter so that we 
can detect that the serial was closed.

Would this cause any incompatibilities with previous versions?  If so, how
can these be mitigated?
No

Original issue reported on code.google.com by francois...@gmail.com on 26 Sep 2012 at 11:57

GoogleCodeExporter commented 9 years ago
Note that on Uno, each time you open hyperterminal causes a board reset, and 
the sketch restarts from the beginning.  Being able to detect the serial port 
closing would be substantially different behavior. (even if it's possible, 
which is uncertain; I don't think leonardo detects when the port OPENS, so much 
as when the port is "detected" at the USB level (enumerated.))

Original comment by wes...@gmail.com on 27 Sep 2012 at 3:54

GoogleCodeExporter commented 9 years ago
Thanks for the clarification.
My though was that port opening/closing was already being detected but that the 
closing wasn't updated properly and therefore the boolean value indicating the 
status of serial wasn't right.

It should be good to add somewhere in the documentation that the while(!Serial) 
works only once in this case. I was convinced I could use it again later in my 
sketch so that I can display new messages when the serial port is re-opened.

How does the reset happens on the Uno? Is that something reproducible on the 
Leornardo or does it need hardware changes?

Original comment by francois...@gmail.com on 27 Sep 2012 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by dmel...@gmail.com on 1 Oct 2012 at 2:36