|
|
@ -24,8 +24,8 @@ using namespace iflytop; |
|
|
|
} |
|
|
|
#define GET_PARAM(buff, off) ((((int32_t*)(buff))[off]))
|
|
|
|
|
|
|
|
#define CLEAR_BIT(val, bit) (val &= ~(1 << bit))
|
|
|
|
#define SET_BIT(val, bit) (val |= (1 << bit))
|
|
|
|
#define ZCLEAR_BIT(val, bit) (val &= ~(1 << bit))
|
|
|
|
#define ZSET_BIT(val, bit) (val |= (1 << bit))
|
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* VAR_LIST * |
|
|
@ -110,7 +110,7 @@ static void basic_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t |
|
|
|
} |
|
|
|
|
|
|
|
else if (packet->function_id == kcmd_clear_reset_flag) { |
|
|
|
CLEAR_BIT(m_dflag, 0); |
|
|
|
ZCLEAR_BIT(m_dflag, 0); |
|
|
|
zcanbus_send_ack(packet, NULL, 0); |
|
|
|
} |
|
|
|
// 触发一次强制上报事件
|
|
|
@ -256,7 +256,7 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t |
|
|
|
} |
|
|
|
|
|
|
|
// ping
|
|
|
|
else if (packet->function_id == kcmd_pump_get_subic_reg) { |
|
|
|
else if (packet->function_id == kcmd_pump_ping) { |
|
|
|
CHECK_PARAM_LEN(paramNum, 1); |
|
|
|
|
|
|
|
int32_t subindex = GET_PARAM(packet->params, 0); |
|
|
@ -359,7 +359,7 @@ static void zcanbus_on_connected(bool connected) { |
|
|
|
ZLOGI(TAG, "disconnected from host"); |
|
|
|
} |
|
|
|
} |
|
|
|
#if 0
|
|
|
|
#if 1
|
|
|
|
static void onPressureSensorDataReportTimer(void const* argument) { |
|
|
|
// 压力传感器数据上报
|
|
|
|
static uint8_t reportcache[100]; |
|
|
@ -433,16 +433,16 @@ void protocol_impl_service_init() { // |
|
|
|
ForceReportFlagMgr::ins()->init(); |
|
|
|
motorErrorFlagCacheLock.init(); |
|
|
|
m_dflag = 0x00; |
|
|
|
SET_BIT(m_dflag, 0); |
|
|
|
ZSET_BIT(m_dflag, 0); |
|
|
|
|
|
|
|
zcanbus_init(deviceInfo_getBoardId()); |
|
|
|
zcanbus_reglistener(zcanbus_on_rx); |
|
|
|
zcanbus_reg_on_connected_listener(zcanbus_on_connected); |
|
|
|
|
|
|
|
#if 0
|
|
|
|
#if 1
|
|
|
|
osTimerDef(PressureSensorDataReportTimer, onPressureSensorDataReportTimer); |
|
|
|
PressureSensorDataReportTimerId = osTimerCreate(osTimer(PressureSensorDataReportTimer), osTimerPeriodic, NULL); |
|
|
|
osTimerStart(PressureSensorDataReportTimerId, m_pressureSensorDataReportPeriodMs); |
|
|
|
// osTimerStart(PressureSensorDataReportTimerId, m_pressureSensorDataReportPeriodMs);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
osTimerDef(MotorMonitorTimer, onMotorMonitorTimer); |
|
|
|