Currently the USB Serial.flush() is an empty function.
Would be nice if it would force any outstanding write requests to be output, like it does on Hardware Serial ports.
I know it is implemented on a few different platforms, like Teensy and I believe at least some of the AVR platforms.
I personally use it for at least two reasons:
a) Debug: What I was doing now... If I have code that might Crash/Hang - I might do something like:
Serial.println("Before Foo");Serial.flush()
(something that may crash)
Serial.println("After Foo"); Serial.flush();
b) To reduce latency. Example if the board is used to listen to requests from a host board, who is waiting for our reply, You may want to call flush right after generating the reply, to shorten the time for the host to get the reply (I do that on my Servo controller boards...)
I don't yet know enough of the USB code here on how to emulate a timeout...
Currently the USB Serial.flush() is an empty function.
Would be nice if it would force any outstanding write requests to be output, like it does on Hardware Serial ports.
I know it is implemented on a few different platforms, like Teensy and I believe at least some of the AVR platforms.
I personally use it for at least two reasons: a) Debug: What I was doing now... If I have code that might Crash/Hang - I might do something like:
b) To reduce latency. Example if the board is used to listen to requests from a host board, who is waiting for our reply, You may want to call flush right after generating the reply, to shorten the time for the host to get the reply (I do that on my Servo controller boards...)
I don't yet know enough of the USB code here on how to emulate a timeout...