From c2be6378b7d6eaed5df9775f60a05ab133ec85cf Mon Sep 17 00:00:00 2001 From: lyf <169361657@qq.com> Date: Mon, 1 Dec 2025 18:41:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=98=E5=8C=85=E9=97=AE=E9=A2=98=E5=B7=B2?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MindVisionMain.cpp | 4 +++- src/TTLCommunicator.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MindVisionMain.cpp b/src/MindVisionMain.cpp index 7ce0269..3e96743 100644 --- a/src/MindVisionMain.cpp +++ b/src/MindVisionMain.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -37,11 +38,12 @@ void output_control_data(const cv::Point2f* ballistic_point, else if (target_color == "blue") simplified_color = "b"; // Construct send string - send_str << "s " << simplified_color << " " << std::to_string(ballistic_offset_x) << " " << std::to_string(ballistic_offset_y); + send_str << "s " << simplified_color << " " << std::to_string(ballistic_offset_x) << " " << std::to_string(ballistic_offset_y) << "\n"; // Send data if (ttl_communicator != nullptr) { ttl_communicator->send_data(send_str.str()); + }else{ std::cerr << "Error: TTLCommunicator is a null pointer!" << std::endl; } diff --git a/src/TTLCommunicator.cpp b/src/TTLCommunicator.cpp index cc0e9da..f0bdd19 100644 --- a/src/TTLCommunicator.cpp +++ b/src/TTLCommunicator.cpp @@ -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; }