feat: 更新测速编码器配置
This commit is contained in:
@@ -53,6 +53,7 @@ void by_buzzer_init(void)
|
||||
by_buzzer_add(1500);
|
||||
}
|
||||
|
||||
// TODO 异步写入问题,不可重入
|
||||
void by_buzzer_add(uint16_t tone)
|
||||
{
|
||||
queue_add_element(tone);
|
||||
|
||||
@@ -272,9 +272,9 @@ void EXTI15_10_IRQHandler(void)
|
||||
void TIM1_UP_IRQHandler(void)
|
||||
{
|
||||
if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
|
||||
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
||||
by_buzzer_run();
|
||||
sport_motion();
|
||||
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,10 +75,9 @@ float sport_get_speed(void)
|
||||
static float speed_now = 0;
|
||||
static float speed_last = 0;
|
||||
|
||||
speed_now = ALPHA * (float)encoder_get_count(TIM5_ENCOEDER) + (1.0f - ALPHA) * speed_last;
|
||||
speed_now = ALPHA * (float)encoder_get_count(TIM3_ENCOEDER) + (1.0f - ALPHA) * speed_last;
|
||||
speed_last = speed_now;
|
||||
|
||||
encoder_clear_count(TIM5_ENCOEDER);
|
||||
encoder_clear_count(TIM3_ENCOEDER);
|
||||
|
||||
return speed_now;
|
||||
|
||||
|
||||
@@ -43,14 +43,14 @@ int main(void)
|
||||
system_delay_init();
|
||||
debug_init();
|
||||
|
||||
encoder_quad_init(TIM5_ENCOEDER, TIM5_ENCOEDER_MAP0_CH1_A0, TIM5_ENCOEDER_MAP0_CH2_A1);
|
||||
encoder_quad_init(TIM3_ENCOEDER, TIM3_ENCOEDER_MAP3_CH1_C6, TIM3_ENCOEDER_MAP3_CH2_C7);
|
||||
ips200_init(IPS200_TYPE_SPI);
|
||||
while (imu660ra_init())
|
||||
;
|
||||
jj_param_eeprom_init();
|
||||
jj_bt_init();
|
||||
by_rb_init();
|
||||
by_pwm_init();
|
||||
// by_pwm_init();
|
||||
by_buzzer_init();
|
||||
by_frame_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user