Skip to content

Commit 9541cbb

Browse files
committed
Serial: Only read a single character at a time to emulate RXTX behavior
1 parent 46ae5a0 commit 9541cbb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java/libraries/serial/src/processing/serial/Serial.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void clear() {
200200

201201
public void debug() {
202202
float secs = (System.nanoTime()-firstEvent)/1000000000.0f;
203-
System.out.println("\nSerial: test #3");
203+
System.out.println("\nSerial: test #4");
204204
System.out.println(port.getPortName()+" @ "+baudRate+" bps");
205205
System.out.println(secs+" sec receiving data:");
206206
System.out.println(countEvents+" events, "+(countEvents/secs)+" per sec");
@@ -461,6 +461,7 @@ public void serialEvent(SerialPortEvent event) {
461461
long start = System.nanoTime();
462462
// this method can be called from the context of another thread
463463
synchronized (buffer) {
464+
toRead = 1;
464465
long len = System.nanoTime()-start;
465466
if (maxReadSyncTime < len) {
466467
maxReadSyncTime = len;

0 commit comments

Comments
 (0)