适配新班子

This commit is contained in:
2024-06-30 14:44:35 +08:00
parent ac05ce6f32
commit 50b5cd3f2d
3 changed files with 42 additions and 36 deletions

View File

@@ -12,11 +12,11 @@
#define FAN_LB_PWM_A_PIN TIM4_PWM_MAP1_CH1_D12 // 右后
#define FAN_LB_PWM_B_PIN TIM4_PWM_MAP1_CH3_D14 // 右后
// M3
#define FAN_RS_PWM_B_PIN TIM10_PWM_MAP3_CH3_D5 //
#define FAN_RS_PWM_A_PIN TIM10_PWM_MAP3_CH1_D1 //
#define FAN_RS_PWM_B_PIN TIM10_PWM_MAP3_CH1_D1 //
#define FAN_RS_PWM_A_PIN TIM10_PWM_MAP3_CH3_D5 // you
// M2
#define FAN_LS_PWM_B_PIN TIM4_PWM_MAP1_CH4_D15 //
#define FAN_LS_PWM_A_PIN TIM4_PWM_MAP1_CH2_D13 //
#define FAN_LS_PWM_B_PIN TIM4_PWM_MAP1_CH4_D15 //
#define FAN_LS_PWM_A_PIN TIM4_PWM_MAP1_CH2_D13 //
int32_t pwm_duty_ls_g;
int32_t pwm_duty_rs_g;
@@ -67,7 +67,7 @@ void by_pwm_init(void)
pwm_init(FAN_RS_PWM_B_PIN, 20000, 0);
pwm_init(FAN_LB_PWM_A_PIN, 20000, 0);
pwm_init(FAN_LB_PWM_B_PIN, 20000, 0);
pwm_init(FAN_RB_PWM_A_PIN, 20000, 1000);
pwm_init(FAN_RB_PWM_A_PIN, 20000, 0);
pwm_init(FAN_RB_PWM_B_PIN, 20000, 0);
while (1);
#endif
@@ -105,10 +105,10 @@ void by_pwm_update_duty(uint32_t update_pwm_duty1, uint32_t update_pwm_duty2)
*/
void by_pwm_power_duty(int32_t bpwm_duty_ls, int32_t bpwm_duty_rs, int32_t bpwm_duty_lb, int32_t bpwm_duty_rb)
{
bpwm_duty_ls = clip_s32(bpwm_duty_ls, -9000, 9000);
bpwm_duty_rs = clip_s32(bpwm_duty_rs, -9000, 9000);
bpwm_duty_lb = clip_s32(bpwm_duty_lb, -9000, 9000);
bpwm_duty_rb = clip_s32(bpwm_duty_rb, -9000, 9000);
bpwm_duty_ls = clip_s32(bpwm_duty_ls, -0, 7000);
bpwm_duty_rs = clip_s32(bpwm_duty_rs, -0, 7000);
bpwm_duty_lb = clip_s32(bpwm_duty_lb, -0, 7000);
bpwm_duty_rb = clip_s32(bpwm_duty_rb, -0, 7000);
// pwm_duty_ls_g = pwm_duty_ls;
// pwm_duty_rs_g = pwm_duty_rs;