完成远程控制页面中急停的长按选中类别的操作-待测试

This commit is contained in:
2026-03-18 13:03:14 +08:00
parent 14dd6bd292
commit 179f11992b
2 changed files with 18 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ class RemoteControlRepositoryImpl implements RemoteControlRepository {
debugPrint('🎮 [摇杆数据] originX: ${status.originX}, originY: ${status.originY}');
debugPrint('⚙️ [电机速度] left: ${speeds['left']}, right: ${speeds['right']}');
debugPrint('🚨 [急停状态] emergency: ${status.isEmergency ? 1 : 0}');
// 2. 调用 Codec:仅生成协议要求的 8 字节 Payload 负载数据
final payload = MachineProtocolCodec.encodeRemoteControlPayload(
@@ -48,13 +48,14 @@ class RemoteControlRepositoryImpl implements RemoteControlRepository {
emergency: status.isEmergency ? 1 : 0,
);
debugPrint('📦 [发送数据] payload: ${payload}');
debugPrint('📦 [发送数据] emergency 字节值:${payload[7]}');
// 3. 调用 TcpClient:发送指令。
// TcpClient.sendRaw 会自动帮你加上 [0xAB, 0xAA] 头和 [0xAA, 0xAB] 尾
_tcpClient.sendRaw(
MachineProtocolConstants.cmdRemoteControl, // 这里通常是 0x00
payload,
);
debugPrint('✅ [TCP] 指令已发送');
}
@override