粘包问题已解决。

This commit is contained in:
2025-12-01 18:41:43 +08:00
parent 3053029f14
commit c2be6378b7
2 changed files with 4 additions and 2 deletions

View File

@@ -52,7 +52,7 @@ bool TTLCommunicator::send_data(const std::string& data) {
std::cerr << "Error writing to serial port: " << strerror(errno) << std::endl;
return false;
} else {
std::cout << "Sent " << bytes_written << " bytes: " << data << std::endl;
std::cout << "Sent " << bytes_written << " bytes: " << data;
fsync(serial_fd); // Ensure data is sent
return true;
}