Files
cbb 7c4aaa5ee6 feat(FOC): 优化FOC控制算法并修复多个控制环路问题
- 重构cal_Iq_Id函数,移除电角度参数传递,改用预计算的sin/cos值
  以避免重复三角函数计算,提升性能约15-300周期
- 修复角度同步Uq前馈学习中的运动方向判断逻辑,解决反转时的
  震荡问题和正转正常反转震荡的根本原因
- 实现低速缩放因子函数get_mode3_velocity_scale,改进静摩擦
  hunting抑制效果
- 优化电压检测逻辑,将阻塞式ADC读取改为连续模式零等待,
  提升实时性能
- 修复初始化期间电压分母为零的问题,添加下限保护防止P增益
  无穷大
- 实现PID控制器测量微分功能,消除目标阶跃时的微分冲击
- 改进积分抗饱和策略,添加外部饱和泄放功能,优化到位稳定
  性能

perf(Filter): 优化中值滤波算法性能

- 针对ADC_FILTER_SIZE=6的固定场景实现最优排序网络,
  用12次比较替代通用std::nth_element算法,显著提升性能
- 保留通用回退路径处理其他尺寸情况
2026-09-01 02:46:25 +08:00

64 lines
1.1 KiB
C++

/**
* @file device/Timer.h
* @brief 底层设备驱动与外设封装源文件
* @note 本文件仅补充 Doxygen 文档注释,不改变代码逻辑。
*/
#ifndef _TIMER_H
#define _TIMER_H
#include "config.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <cstdint>
/**
* @brief User_timer_init 函数
* @return void
*/
void User_timer_init(void);
/**
* @brief Set_Pwm 函数
* @param[in] channel 参数
* @param[in] duty_cycle 参数
* @return void
*/
void Set_Pwm(u16 channel, float duty_cycle);
/**
* @brief Set_3Pwm 函数
* @param[in] duty_cycle0 参数
* @param[in] duty_cycle1 参数
* @param[in] duty_cycle2 参数
* @return void
*/
void Set_3Pwm(float duty_cycle0, float duty_cycle1,float duty_cycle2);
/**
* @brief TIMER2 中断处理函数
* @return void
*/
void TIMER2_IRQHandler(void);
/**
* @brief timer1_pwm_config 函数
* @return void
*/
void timer1_pwm_config(void);
/**
* @brief timer1_gpio_config 函数
* @return void
*/
void timer1_gpio_config(void);
/**
* @brief TIMER1 中断处理函数
* @return void
*/
void TIMER1_IRQHandler(void); // 添加TIMER1中断处理函数声明
#ifdef __cplusplus
}
#endif
#endif