platforms/nuttx: Serial change fsync to tcdrain

Calling serial::write() in quick succession was blowing away the previous buffer, fsync does not guarantee that data is transmitted on serial lines. On the other hand tcdrain waits until the output buffer is empty.
This commit is contained in:
Jacob Dahl
2024-09-25 12:18:05 -04:00
committed by GitHub
parent b2c8f0539e
commit ba75b9c35e
@@ -339,7 +339,7 @@ ssize_t SerialImpl::write(const void *buffer, size_t buffer_size)
}
int written = ::write(_serial_fd, buffer, buffer_size);
::fsync(_serial_fd);
tcdrain(_serial_fd); // Wait until all output is transmitted
if (written < 0) {
PX4_ERR("%s write error %d", _port, written);