diff --git a/src/base/mc/src/timer_tasks.cpp b/src/base/mc/src/timer_tasks.cpp index e77ed69..2fb3254 100644 --- a/src/base/mc/src/timer_tasks.cpp +++ b/src/base/mc/src/timer_tasks.cpp @@ -45,38 +45,35 @@ void vcuTimerTask(CANDriver& canctl) canctl.sendFrame(vcu_enable_cmd.toFrame()); // mode: 0=标准模式(刷子), 1=混合模式(刷子+洒水) - bool enable_brush = msg.sweep; // 两种模式都启用刷子 - bool enable_water = msg.sweep && (msg.sweep_mode == 1); // 仅混合模式启用洒水 + bool enable_brush = true; // 两种模式都启用刷子 + // bool enable_water = msg.sweep && (msg.sweep_mode == 1); // 仅混合模式启用洒水 + bool enable_water = true; // ===== 控制0x211报文 (电机M1-M7) ===== - vcu_motor1_cmd.setByte0(msg.sweep ? 1 : 0); // 1表示正向运行,0表示停止 - - // 标准模式和混合模式都启用的部件(刷子等) - vcu_motor1_cmd.setByte1(enable_brush ? target_value : 0); - vcu_motor1_cmd.setByte2(enable_brush ? target_value : 0); - vcu_motor1_cmd.setByte3(enable_brush ? target_value : 0); - vcu_motor1_cmd.setByte4(enable_brush ? target_value2 : 100); - vcu_motor1_cmd.setByte5(enable_brush ? target_value2 : 100); - vcu_motor1_cmd.setByte6(enable_brush ? target_value : 0); - vcu_motor1_cmd.setByte7(enable_brush ? target_value : 0); + vcu_motor1_cmd.setByte0(msg.sweep ? 1 : 0); // 电机M1方向 1表示正向运行,0表示停止 + vcu_motor1_cmd.setByte1(enable_brush ? target_value : 0); //电机M1油门 + vcu_motor1_cmd.setByte2(enable_brush ? target_value : 0);//吸尘电机 + vcu_motor1_cmd.setByte3(0);//振尘电机 + vcu_motor1_cmd.setByte4(enable_brush ? target_value2 : 0);//主刷推杆-100 100 + vcu_motor1_cmd.setByte5(enable_brush ? target_value2 : 0);//前挡皮推杆电机-100 100 + vcu_motor1_cmd.setByte6(enable_brush ? target_value : 0);//边刷电机 + vcu_motor1_cmd.setByte7(enable_brush ? target_value : 0);//边刷电机 canctl.sendFrame(vcu_motor1_cmd.toFrame()); - // ===== 控制0x212报文 (电机M8和LED输出) ===== - // 注意:这里假设某个字节控制洒水,需要根据实际硬件确认 - // 模式1(混合模式)时启用洒水相关部件 - vcu_motor2_cmd.setByte0(enable_brush ? target_value : 0); - vcu_motor2_cmd.setByte1(enable_brush ? target_value : 0); - vcu_motor2_cmd.setByte2(enable_brush ? target_value : 0); - vcu_motor2_cmd.setByte3(enable_brush ? target_value : 0); - vcu_motor2_cmd.setByte4(enable_water ? target_value : 0); // 假设Byte4控制洒水 - vcu_motor2_cmd.setByte5(enable_water ? target_value : 0); // 假设Byte5控制洒水 - vcu_motor2_cmd.setByte6(enable_brush ? target_value : 0); - vcu_motor2_cmd.setByte7(enable_brush ? target_value : 0); + // ===== 控制0x212报文 (电机M8和预留输出) ===== + vcu_motor2_cmd.setByte0(enable_brush ? target_value : 0); //水泵电机 -100 100 + vcu_motor2_cmd.setByte1(0);// + vcu_motor2_cmd.setByte2(0);// + vcu_motor2_cmd.setByte3(0);// + vcu_motor2_cmd.setByte4(0); // + vcu_motor2_cmd.setByte5(0); // + vcu_motor2_cmd.setByte6(0);// + vcu_motor2_cmd.setByte7(0);// canctl.sendFrame(vcu_motor2_cmd.toFrame()); - LOG_INFO_THROTTLE(1000, "[VCU] Sweep? %s, Mode: %d (0=标准,1=混合), Water: %s", + LOG_INFO_THROTTLE(1000, "[VCU] Sweep? %s, Mode: %d (0=标准,1=混合), Water: %s | Pump: %d", msg.sweep ? "Yes" : "No", msg.sweep_mode, - enable_water ? "On" : "Off"); + enable_water ? "On" : "Off", enable_water); } // 定时器回调:BMS 查询任务