Show Posts
Pages: [1]
1  Development / Suggestions for the Arduino Project / SoftwareSerial::flush() broken on: July 30, 2012, 06:29:41 pm
There's a bug in the 1.0.1 version of the SoftwareSerial flush() method.

The action for flush() changed in Arduino 1.0.  It now waits for the transmission of outgoing serial data to complete.  (Prior to 1.0, flush() instead removed any buffered incoming serial data.)  It works correctly for hardware serial I/O, but someone forgot to change this behavior for SoftwareSerial, so it still behaves the old way and deletes any previously buffered received characters and doesn't care anything about the characters being transmitted.

So if your code does something like this:

//Make sure TX has completed
    mySerial.flush();

...it's not going to work as expected.
2  Using Arduino / Programming Questions / Re: Device to Nano Serial Communication at 38400 Failing on: July 30, 2012, 06:20:51 pm
There's a bug in the 1.0.1 version of SoftwareSerial that's likely affecting your code:

//Make sure TX has completed
    obd.flush();

The action for flush() changed in Arduino 1.0.  It now waits for the transmission of outgoing serial data to complete, as your code expects.  (Prior to 1.0, flush() instead removed any buffered incoming serial data.)  EXCEPT someone forgot to change this behavior for SoftwareSerial, so it still behaves the old way and deletes any previously buffered received characters and doesn't care anything about characters being transmitted.

I just tracked this down today for a problem I'm having and saw your report while searching the forum.  Not sure this will fix your problem, but it's sure not going to help any.  I'll cross-post this to the Installation and Troubleshooting forum and hopefully it will get fixed by the next release.
 
Pages: [1]