zhaohe 1 year ago
parent
commit
9841eaaa83
  1. 2
      iflytop_canbus_protocol
  2. 8
      usrc/protocol_impl/protocol_impl_service.cpp

2
iflytop_canbus_protocol

@ -1 +1 @@
Subproject commit 4ff540143bbaea7da71f4eacc1e1dd72f4dcd26e
Subproject commit 85c0e8a9af9990eab8ac9ae9378f48d502e687d3

8
usrc/protocol_impl/protocol_impl_service.cpp

@ -275,7 +275,7 @@ static void others_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_
}
// 压力传感器数据上报
else if (packet->function_id == kcmd_read_pressure_data) {
else if (packet->function_id == kcmd_pressure_sensor_bus_read_data) {
CHECK_PARAM_LEN(paramNum, 1);
int32_t index = GET_PARAM(packet->params, 0);
@ -293,7 +293,7 @@ static void others_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_
}
// 压力传感器数据上报
else if (packet->function_id == kcmd_set_pressure_data_report_period_ms) {
else if (packet->function_id == kcmd_pressure_sensor_bus_set_report_period_ms) {
CHECK_PARAM_LEN(paramNum, 1);
int32_t period = GET_PARAM(packet->params, 0);
@ -381,6 +381,7 @@ static void onMotorMonitorTimer(void const* argument) {
} else {
auto gstate = Hardware::ins().motor(i)->getGState();
bool flag = gstate.reset || gstate.drv_err || gstate.uv_cp;
// flag = true;
if (!flag && motorErrorFlagCache[i]) {
motorErrorFlagCache[i] = false;
} else if (flag && !motorErrorFlagCache[i]) {
@ -391,8 +392,11 @@ static void onMotorMonitorTimer(void const* argument) {
data.ecode = kerr_motor_undervoltage_error;
} else if (gstate.drv_err) {
data.ecode = kerr_motor_driver_error;
} else {
data.ecode = kerr_motor_unkown_error;
}
data.subid = i;
motorErrorFlagCache[i] = true;
zcanbus_send_emergency_report(kreport_exception_error, (uint8_t*)&data, sizeof(data), 100);
}
}

Loading…
Cancel
Save