diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index 5b554f0d..a52e48d8 100755 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -660,7 +660,11 @@ size_t BluetoothSerial::write(const uint8_t *buffer, size_t size) void BluetoothSerial::flush() { - while(read() >= 0){} + if (_spp_tx_queue != NULL){ + while(uxQueueMessagesWaiting(_spp_tx_queue) > 0){ + delay(5); + } + } } void BluetoothSerial::end()