feat(ADC): 重构ADC采样系统以支持同步电流采集

- 将ADC缓冲区从6通道减少到3通道,专门用于MCU温度、DRV温度和VBUS监测
- 实现了注入组ADC同步采样,通过TIMER1 TRGO触发三相电流同时采样
- 添加了PWM中心对齐模式以提供更好的采样窗口
- 在FOC控制器中增加了ADC错误检查和三相公共模偏置消除
- 优化了电流采样更新机制,使用中断驱动的数据搬运
- 调整了ADC通道配置,规则组用于后台温度/VBUS采样,注入组用于PWM同步电流采样
This commit is contained in:
cbb
2026-05-16 13:09:57 +08:00
parent 12b2577d6b
commit c6e00e1a49
4 changed files with 116 additions and 78 deletions
+9 -7
View File
@@ -9,13 +9,13 @@ extern "C" {
class sampler {
private:
float vbus_samples[ADC_FILTER_SIZE + 1];
float currU_samples[ADC_FILTER_SIZE + 1];
float currV_samples[ADC_FILTER_SIZE + 1];
float currW_samples[ADC_FILTER_SIZE + 1];
float mcu_temp_samples[ADC_FILTER_SIZE + 1];
float drv_temp_samples[ADC_FILTER_SIZE + 1];
u8 current_sample_index;
float vbus_samples[ADC_FILTER_SIZE];
float currU_samples[ADC_FILTER_SIZE];
float currV_samples[ADC_FILTER_SIZE];
float currW_samples[ADC_FILTER_SIZE];
float mcu_temp_samples[ADC_FILTER_SIZE];
float drv_temp_samples[ADC_FILTER_SIZE];
u8 current_sample_head;
float tempora_sample;
@@ -32,6 +32,8 @@ class sampler {
float get_current(char);
};
void ADC0_1_IRQHandler(void);
#ifdef __cplusplus
}
#endif