8000 Fix flush · mishafarms/arduino-esp32@ab96650 · GitHub
[go: up one dir, main page]

Skip to content

Commit ab96650

Browse files
authored
Fix flush
flush should not flush the read buffer, it should wait till all output is drained from the write buffer.
1 parent cec3fca commit ab96650

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,11 @@ size_t BluetoothSerial::write(const uint8_t *buffer, size_t size)
652652

653653
void BluetoothSerial::flush()
654654
{
655-
while(read() >= 0){}
655+
if (_spp_tx_queue != NULL){
656+
while(uxQueueMessagesWaiting(_spp_tx_queue) > 0){
657+
delay(50);
658+
}
659+
}
656660
}
657661

658662
void BluetoothSerial::end()

0 commit comments

Comments
 (0)
0