迁移入tty持续连接
This commit is contained in:
5
main.cpp
5
main.cpp
@@ -20,6 +20,7 @@
|
||||
#include <options.h>
|
||||
#include <additions.h>
|
||||
#include <config/setconfig.h>
|
||||
#include "serialManager.hpp"
|
||||
|
||||
#define DO_NOT_CNT_TIME
|
||||
|
||||
@@ -41,7 +42,8 @@ McuData mcu_data = { // 单片机端回传结构体
|
||||
|
||||
WrapperHead *video = nullptr; // 云台摄像头视频源
|
||||
|
||||
Serial serial(115200); // 串口对象
|
||||
Serial serial(115200); // 串口对象(旧版,供 armor_finder/energy 使用)
|
||||
SerialManager serialManager; // TTY 串口自动恢复管理器
|
||||
uint8_t last_state = ARMOR_STATE; // 上次状态,用于初始化
|
||||
// 自瞄主程序对象
|
||||
ArmorFinder armor_finder(mcu_data.enemy_color, serial, PROJECT_DIR"/tools/para/", mcu_data.anti_top);
|
||||
@@ -50,6 +52,7 @@ Energy energy(serial, mcu_data.enemy_color);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
processOptions(argc, argv); // 处理命令行参数
|
||||
serialManager.start(); // 启动 TTY 串口自动重连线程
|
||||
thread receive(uartReceive, &serial); // 开启串口接收线程
|
||||
|
||||
int from_camera = 1; // 根据条件选择视频源
|
||||
|
||||
Reference in New Issue
Block a user