mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
添加了大量调试log,新增了dwt计时宏,增加了USB软件复位防止主控复位后上位机无法连接usb
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "stdlib.h"
|
||||
#include "crc8.h"
|
||||
#include "bsp_dwt.h"
|
||||
#include "bsp_log.h"
|
||||
|
||||
/**
|
||||
* @brief 重置CAN comm的接收状态和buffer
|
||||
@@ -59,7 +60,7 @@ static void CANCommRxCallback(CANInstance *_instance)
|
||||
if (comm->raw_recvbuf[comm->recv_buf_len - 2] == crc_8(comm->raw_recvbuf + 2, comm->recv_data_len))
|
||||
{ // 数据量大的话考虑使用DMA
|
||||
memcpy(comm->unpacked_recv_data, comm->raw_recvbuf + 2, comm->recv_data_len);
|
||||
comm->update_flag = 1; // 数据更新flag置为1
|
||||
comm->update_flag = 1; // 数据更新flag置为1
|
||||
DaemonReload(comm->comm_daemon); // 重载daemon,避免数据更新后一直不被读取而导致数据更新不及时
|
||||
}
|
||||
}
|
||||
@@ -69,6 +70,13 @@ static void CANCommRxCallback(CANInstance *_instance)
|
||||
}
|
||||
}
|
||||
|
||||
static void CANCommLostCallback(void *cancomm)
|
||||
{
|
||||
CANCommInstance *comm = (CANCommInstance *)cancomm;
|
||||
CANCommResetRx(comm);
|
||||
LOGWARNING("[can_comm] can comm rx[%d] lost, reset rx state.", &comm->can_ins->rx_id);
|
||||
}
|
||||
|
||||
CANCommInstance *CANCommInit(CANComm_Init_Config_s *comm_config)
|
||||
{
|
||||
CANCommInstance *ins = (CANCommInstance *)malloc(sizeof(CANCommInstance));
|
||||
|
||||
Reference in New Issue
Block a user