From 9841eaaa83b5094367cdee6f2f4d6c933cd59c2c Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 28 Apr 2024 20:40:09 +0800 Subject: [PATCH] V2 --- iflytop_canbus_protocol | 2 +- usrc/protocol_impl/protocol_impl_service.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/iflytop_canbus_protocol b/iflytop_canbus_protocol index 4ff5401..85c0e8a 160000 --- a/iflytop_canbus_protocol +++ b/iflytop_canbus_protocol @@ -1 +1 @@ -Subproject commit 4ff540143bbaea7da71f4eacc1e1dd72f4dcd26e +Subproject commit 85c0e8a9af9990eab8ac9ae9378f48d502e687d3 diff --git a/usrc/protocol_impl/protocol_impl_service.cpp b/usrc/protocol_impl/protocol_impl_service.cpp index ed07797..e1ee1a1 100644 --- a/usrc/protocol_impl/protocol_impl_service.cpp +++ b/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); } }