fix(FOC): 修正大角度下会导致角度控制失控的问题

移除冗余的 `_electricalAngle` 函数,修正 `setPhaseVoltage` 中电气角度的计算方式
在定时器中断中增加实时角度更新,支持新增的无 PID 角度控制模式。
This commit is contained in:
cbb
2025-11-10 02:08:03 +08:00
parent b33574d392
commit 7a602dda48
6 changed files with 35 additions and 28 deletions
+6 -4
View File
@@ -1,12 +1,13 @@
#include "adc.h"
#include "Filter.h"
#include "Can.h"
#include "gd32c10x_can.h"
#include "gd32c10x_eval.h"
#include "math.h"
#include <cstring>
#include "gd32c10x_eval.h"
#include <gd32c10x_dma.h>
#include <stdint.h>
constexpr float ERROR_ADC_VAL = 255.0f;
constexpr float ADC_SCALE = 3.3f / 4096.0f;
constexpr float TEMP_FACTOR = 1000.0f / 4.3f;
@@ -17,10 +18,11 @@ constexpr float CURRENT_FACTOR =
1.0f / 50.0f * 100.0f; // 50倍放大,100倍电流采样电阻, 单位mA
constexpr float MAX_TEMP = 150.0f;
constexpr float MIN_TEMP = -40.0f;
constexpr float MAX_CURRENT = 65.0f;
constexpr float MIN_CURRENT = -0.1f;
constexpr float MAX_CURRENT = 40.0f;
constexpr float MIN_CURRENT = -40.0f;
constexpr float MAX_VCC = 65.0f;
constexpr float MIN_VCC = -0.1f;
extern CAN_transmiter CAN0_transmiter;
u16 adc_value[6] = {0}; // 显式初始化数组元素为0
/*!