修正前进后退档位上报相反的问题

This commit is contained in:
lyq 2026-02-02 13:19:41 +08:00
parent ee5f90c9ff
commit 26d7ce5bf6

View File

@ -122,6 +122,20 @@ void CanDecoder::handle_mcu_status_2(const sweeperMsg::CanFrame& msg)
int motorTemp = raw_motor_temp - 30; int motorTemp = raw_motor_temp - 30;
int feedback_gear = (ctrl_status >> 2) & 0x03; int feedback_gear = (ctrl_status >> 2) & 0x03;
switch (feedback_gear)
{
case 1:
feedback_gear = 2; // 原1错误后退改为2正确后退
break;
case 2:
feedback_gear = 1; // 原2错误前进改为1正确前进
break;
case 0:
case 3:
default:
break;
}
{ {
std::lock_guard<std::mutex> lock(ctx_.mtx); std::lock_guard<std::mutex> lock(ctx_.mtx);
ctx_.info.controllerTemp = controllerTemp; ctx_.info.controllerTemp = controllerTemp;