Skip to content

Commit

Permalink
refactor: 移除根据target fps统一化变化频率速度
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow3aaa committed Oct 30, 2024
1 parent a768bfe commit f15e01d
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions src/framework/scheduler/looper/policy/pid_controll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,27 @@ pub fn pid_control(
let margin = Duration::from_millis(margin);
let target = Duration::from_secs(1) + margin;

Some(
pid_control_inner(
pid_params,
frame,
target,
buffer
.frametime_state
.frametimes
.iter()
.copied()
.take(30)
.sum::<Duration>()
.mul_f64(target_fps),
buffer
.frametime_state
.frametimes
.iter()
.copied()
.take(60)
.sum::<Duration>()
.mul_f64(target_fps),
) * 60
/ target_fps as isize,
)
Some(pid_control_inner(
pid_params,
frame,
target,
buffer
.frametime_state
.frametimes
.iter()
.copied()
.take(30)
.sum::<Duration>()
.mul_f64(target_fps),
buffer
.frametime_state
.frametimes
.iter()
.copied()
.take(60)
.sum::<Duration>()
.mul_f64(target_fps),
))
}

fn pid_control_inner(
Expand Down

0 comments on commit f15e01d

Please sign in to comment.