feat: 更新测速编码器配置
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -88,7 +87,7 @@ float sport_get_speed(void)
|
||||
void sport_motion(void)
|
||||
{
|
||||
if (1 == in_stop) {
|
||||
bt_fly_flag = bt_run_flag = 0;
|
||||
bt_fly_flag = bt_run_flag = 0;
|
||||
}
|
||||
if (0 == in_state || 2 == in_state) {
|
||||
PID_SetTunings(&far_gyro_pid, an_Kp1, an_Ki1, an_Kd1);
|
||||
|
||||
Reference in New Issue
Block a user