- 引入新的三值约束宏 `_constrain3` 用于SVPWM计算优化 - 修改 `setPhaseVoltage` 函数签名,移除冗余的角度参数,内部自动计算电气角度 - 调整PWM占空比计算方式,提高电压利用率和控制精度 - 移除旧的DEG2RAD和RAD2DEG常量定义,改由initial.h统一管理 - 在initial.h中新增减速比常量REDUCTION_RATIO,并修正拼写错误 - 为角度传感器类更新速度滤波器尺寸,提升速度估算稳定性 - 更新PID控制器时间片常量,简化dt计算逻辑,提高执行效率 - 切换角度闭环控制至新NPID版本,增强系统响应性能 - 修正CAN通信中的目标角度解析逻辑,确保指令正确应用
31 lines
625 B
C++
31 lines
625 B
C++
#ifndef _INITIAL_H
|
|
#define _INITIAL_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#include "stdint.h"
|
|
#include <stdio.h>
|
|
#include "gd32c10x_eval.h"
|
|
|
|
constexpr u16 REDUCTION_RATIO = 25;
|
|
constexpr float DEG2RAD = 1.0f / 360.0f * 6.28318530718f;
|
|
constexpr float RAD2DEG = 360.0f / 6.28318530718f;
|
|
|
|
void rcu_config(void);
|
|
static volatile uint32_t timer_delay_count = 0; // volatile 很重要!
|
|
int fputc(int ch, FILE *f); // 声明fputc函数以重载标准库实现
|
|
|
|
u8 tle5210b_init(void);
|
|
u8 USART0_init(void);
|
|
u8 watchdog_init(u32 time);
|
|
void driver_init(void);
|
|
void angsens_MG_test(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|