From 7688e9f3f5e5881d39c6da25e4efee246dae939d Mon Sep 17 00:00:00 2001 From: cxh Date: Fri, 23 May 2025 17:43:56 +0800 Subject: [PATCH] Auto commit on 2025-05-23 17:43:56 --- git_update.sh | 25 +++++++++++++++++++++++++ src/radio_ctrl/src/uart_handler.cpp | 14 +++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100755 git_update.sh diff --git a/git_update.sh b/git_update.sh new file mode 100755 index 0000000..6566bc5 --- /dev/null +++ b/git_update.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +REPO_DIR="/home/cxh/sweeper_truck_ros" + +cd "$REPO_DIR" || { echo "目录不存在: $REPO_DIR"; exit 1; } + +# 配置用户名和邮箱(如果没配置) +git config user.name "cxh" +git config user.email "zxwl@56.com" + +# 添加所有改动 +git add . + +# 自动提交,提交信息用当前时间 +COMMIT_MSG="Auto commit on $(date '+%Y-%m-%d %H:%M:%S')" +git commit -m "$COMMIT_MSG" + +# 推送到远程 main 分支 +git push origin main + +if [ $? -eq 0 ]; then + echo "推送成功!" +else + echo "推送失败!" +fi diff --git a/src/radio_ctrl/src/uart_handler.cpp b/src/radio_ctrl/src/uart_handler.cpp index 087d468..3ac15c7 100644 --- a/src/radio_ctrl/src/uart_handler.cpp +++ b/src/radio_ctrl/src/uart_handler.cpp @@ -108,24 +108,24 @@ void UartHandler::stop_reading() void UartHandler::read_loop() { uint8_t buf[512]; - auto last_receive_time = std::chrono::steady_clock::now(); + // auto last_receive_time = std::chrono::steady_clock::now(); while (reading) { int n = read(fd, buf, sizeof(buf)); if (n > 0) { - last_receive_time = std::chrono::steady_clock::now(); + // last_receive_time = std::chrono::steady_clock::now(); parse_data(buf, n); } else if (n == 0 || (n < 0 && errno == EAGAIN)) { // 检查超时 - auto now = std::chrono::steady_clock::now(); - if (std::chrono::duration_cast(now - last_receive_time).count() > 2) // 超过2秒没数据 - { - failsafe_status = SBUS_SIGNAL_LOST; - } + // auto now = std::chrono::steady_clock::now(); + // if (std::chrono::duration_cast(now - last_receive_time).count() > 2) // 超过2秒没数据 + // { + // failsafe_status = SBUS_SIGNAL_LOST; + // } usleep(1000); } else