feat(CAN): 添加静默模式支持并优化节点ID处理
- 添加静默模式功能,在接收到base_id=0x0000消息时停止发送10秒 - 修正节点ID加载逻辑,区分有效节点ID(0-65534)和Flash擦除状态(0xFFFF) - 添加静默模式相关的状态检查和时间管理功能 - 在CAN通信检查中集成静默模式处理流程 fix(FOC): 修复速度控制中的方向参数应用 - 在velocity_control、angle_control_with_velocity_limit和MIT_Mode函数中 正确应用DIR参数调整速度误差的符号 - 添加详细注释说明DIR参数对速度误差计算的影响 refactor(systick): 添加毫秒级系统时间功能 - 实现get_systick_ms()函数提供毫秒级系统时间 - 添加SysTick中断处理程序更新系统时间计数器 chore(init): 调整初始化顺序优化系统启动流程 - 将EEPROM初始化移至CAN初始化之前,确保正确的依赖关系
This commit is contained in:
@@ -52,9 +52,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endif
|
||||
|
||||
volatile static uint32_t delay;
|
||||
volatile static uint32_t systick_ms = 0; // 系统运行时间(毫秒)
|
||||
extern CAN_transmiter CAN0_transmiter;
|
||||
extern FlashEEPROM flashEEP;
|
||||
|
||||
/*!
|
||||
\brief get system tick time in milliseconds
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval system time in ms
|
||||
*/
|
||||
uint32_t get_systick_ms(void) {
|
||||
return systick_ms;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief configure systick
|
||||
\param[in] none
|
||||
@@ -71,6 +82,17 @@ void systick_config(void) {
|
||||
/* configure the systick handler priority */
|
||||
NVIC_SetPriority(SysTick_IRQn, 0x00U);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief SysTick handler - increment millisecond counter
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
extern "C" void SysTick_Handler(void) {
|
||||
systick_ms++; // 递增系统时间
|
||||
delay_decrement(); // 递减延时计数器
|
||||
}
|
||||
/*!
|
||||
\brief delay a time in seconds
|
||||
\param[in] count: count in seconds
|
||||
|
||||
Reference in New Issue
Block a user