Auto commit on 2025-05-23 17:43:56

This commit is contained in:
cxh 2025-05-23 17:43:56 +08:00
parent 268e4e125f
commit 7688e9f3f5
2 changed files with 32 additions and 7 deletions

25
git_update.sh Executable file
View File

@ -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

View File

@ -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<std::chrono::seconds>(now - last_receive_time).count() > 2) // 超过2秒没数据
{
failsafe_status = SBUS_SIGNAL_LOST;
}
// auto now = std::chrono::steady_clock::now();
// if (std::chrono::duration_cast<std::chrono::seconds>(now - last_receive_time).count() > 2) // 超过2秒没数据
// {
// failsafe_status = SBUS_SIGNAL_LOST;
// }
usleep(1000);
}
else