feat(FOC): 优化开环速度控制逻辑并提升性能
refactor(ADC): 重构采样逻辑并封装为 sampler 类 refactor(CAN): 更新 CAN 发送器以使用新的sampler 接口 refactor(timer): 调整定时器中断结构并优化任务调度
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
extern CAN_transmiter CAN0_transmiter;
|
||||
extern FOC_Controlroller FOC;
|
||||
extern sampler sampler;
|
||||
|
||||
/*!
|
||||
\brief initialize CAN GPIO
|
||||
@@ -363,9 +364,9 @@ CAN_transmiter::CAN_transmiter() {
|
||||
void CAN_transmiter::update(void) {
|
||||
limit_velocity_union.f = FOC.limit_velocity;
|
||||
limit_voltage = FOC.limit_voltage * 1000;
|
||||
mcu_temp = get_mcu_temp() * 100;
|
||||
motor_temp = get_drv_temp() * 100;
|
||||
Power_Voltage = get_vbus_voltage() * 1000;
|
||||
mcu_temp = sampler.get_mcu_temp() * 100;
|
||||
motor_temp = sampler.get_drv_temp() * 100;
|
||||
Power_Voltage = sampler.get_vbus_voltage() * 1000;
|
||||
rt_angle_union.f = 0.0f;
|
||||
rt_velocity_union.f = 0.0f;
|
||||
Status_code = (gpio_input_bit_get(GPIOB, GPIO_PIN_2) == SET) ? 0 : 1;
|
||||
@@ -375,9 +376,9 @@ void CAN_transmiter::update(void) {
|
||||
|
||||
target_angle_union.f = FOC.target_angle;
|
||||
target_velocity_union.f = FOC.target_velocity;
|
||||
u_current_union.f = get_current('U') * 1000;
|
||||
w_current_union.f = get_current('W') * 1000;
|
||||
v_current_union.f = get_current('V') * 1000;
|
||||
u_current_union.f = sampler.get_current('U') * 1000;
|
||||
w_current_union.f = sampler.get_current('W') * 1000;
|
||||
v_current_union.f = sampler.get_current('V') * 1000;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user