Fix SerialBT.flush (#3579)

* Fix flush

flush should not flush the read buffer, it should wait till all output is drained from the write buffer.

* Update BluetoothSerial.cpp

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
This commit is contained in:
mishafarms 2020-01-20 12:34:57 -08:00 committed by Me No Dev
parent 1977370e6f
commit b4a9684a74

View File

@ -660,7 +660,11 @@ size_t BluetoothSerial::write(const uint8_t *buffer, size_t size)
void BluetoothSerial::flush() void BluetoothSerial::flush()
{ {
while(read() >= 0){} if (_spp_tx_queue != NULL){
while(uxQueueMessagesWaiting(_spp_tx_queue) > 0){
delay(5);
}
}
} }
void BluetoothSerial::end() void BluetoothSerial::end()