DRV8313兼容版
refactor(algorithm): 移除冗余头文件 移除不必要的stdint.h头文件引用,统一使用<cstdint> refactor(sys): 清理系统级头文件依赖 移除未使用的头文件引用,统一整型类型定义,优化初始 化过程中的GPIO配置
This commit is contained in:
+4
-9
@@ -9,13 +9,8 @@
|
||||
#include "health.h"
|
||||
#include "initial.h"
|
||||
#include "motor.h"
|
||||
#include "sys/flash.h"
|
||||
#include "sys/initial.h"
|
||||
#include "systick.h"
|
||||
#include <arm_math.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <stdint.h>
|
||||
|
||||
extern CAN_transmiter CAN0_transmiter; // CAN初始化
|
||||
extern sampler sampler; // 采样器
|
||||
extern angle_sensor KTH7823; // 角度传感器
|
||||
@@ -96,11 +91,11 @@ void do_task(u32 currentTasks) {
|
||||
// 角度闭环控制,带速度限制
|
||||
&FOC_Controlroller::velocity_control, // 2: 速度闭环控制
|
||||
&FOC_Controlroller::current_control, // 3: 电流闭环控制
|
||||
&FOC_Controlroller::velocity_open_loop // 4: 速度开环控制
|
||||
&FOC_Controlroller::velocity_open_loop, // 4: 速度开环控制
|
||||
};
|
||||
|
||||
// 边界检查,防止数组越界
|
||||
if (FOC.control_mode >= 0 && FOC.control_mode < 5) {
|
||||
if (FOC.control_mode >= 0 && FOC.control_mode < 5) { // 更新为7个控制模式
|
||||
// 调用对应的控制函数
|
||||
(FOC.*control_functions[FOC.control_mode])();
|
||||
}
|
||||
@@ -120,7 +115,7 @@ void do_task(u32 currentTasks) {
|
||||
if (currentTasks & (1 << TASK_VBUS_UPDATE)) { // 更新vbus电压值
|
||||
power_manage();
|
||||
}
|
||||
if (currentTasks & (1 << TASK_CAN_TRANSMIT)) { // CAN通信
|
||||
if (currentTasks & (1 << TASK_CAN_TRANSMIT)) { // CAN通信
|
||||
// CAN0_transmiter.testfloat_union.f = cnt_test; // 负载检测
|
||||
cnt_test = 0;
|
||||
CAN0_transmiter.can0_send_flag = SET;
|
||||
|
||||
Reference in New Issue
Block a user