调试初版

This commit is contained in:
xu
2026-10-14 18:22:41 +08:00
parent d3a355bd3f
commit e5efdea06e
26 changed files with 289 additions and 140 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ const int kDataLen = 8;
// 车端 CAN 的 UDP 端口:本机 9000 收(车端反馈),上行命令发往 9001
const quint16 kCanRxPort = 9000;
const quint16 kCanTxPort = 9001;
const char* kCanTxHost = "127.0.0.1";
const char* kCanTxHost = "0.0.0.0";
quint8 canChecksum(quint32 canId, quint8 dlc, const quint8* data)
{
@@ -497,8 +497,8 @@ void CarCommunication::handleFrame(quint32 canId, const quint8* d)
// ---------- 0x18368180 洗消工作状态1:模式 / 泵 / 球阀 / 液位 / 流量 ----------
case kIdDecontamFb1: {
const quint8 mode = quint8(intelBits(d, 0, 2));
m_tel->washMode = (mode == 3) ? QString::fromUtf8("消毒作业")
: (mode == 2) ? QString::fromUtf8("消除作业")
m_tel->washMode = (mode == 3) ? QString::fromUtf8("手动消毒")
: (mode == 2) ? QString::fromUtf8("手动消除")
: QString("--");
m_tel->washStart = intelBits(d, 2, 1) != 0;
m_tel->plunger = intelBits(d, 3, 1) != 0;
+1 -1
View File
@@ -30,7 +30,7 @@ struct CanFault {
// 下行 分类二/三 12 条(车端 → 遥控器):底盘 4 条、机械臂 4 条、洗消 2 条、气体检测仪 2 条,
// 按 canId 分流转 handleFrame() 写入 Telemetry。
// 全部为 29 位扩展帧、信号一律 Intel(小端)位序。
// 传输走 UDP:bind 本机 9000 端口收下行反馈,上行命令发往 127.0.0.1:9001。
// 传输走 UDP:bind 本机 9000 端口收下行反馈,上行命令发往 0.0.0.0:9001。
// UDP 载荷统一为 18 字节:帧头 0x5AA5FF00 + canId + DLC + 8 字节数据 + 校验和。
// 通信超时判定:连续 2s 未收到任何合法帧则判为通信异常(最慢的下行周期 1000ms)。
class CarCommunication : public QObject
-1
View File
@@ -37,7 +37,6 @@ Q_DECLARE_METATYPE(RcFrame)
// ===================== 遥控器串口接收层 =====================
// 独占 rc/device(默认 /dev/ttyS7),115200 / 8 数据位 / 1 停止位 / 无校验。
// 车端 CAN 改走 UDP(见 car.h,收 9000 / 发 9001),不再占用串口。
// 只负责收包、校验、解析与链路超时判定,不决定遥控器数据的用途。
class RcCommunication : public QObject
{