Skip to content

Commit

Permalink
Fix clamping of CV
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Horacek <petr@zlosynth.com>
  • Loading branch information
phoracek committed Nov 12, 2023
1 parent ffebb4a commit 67a6491
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firmware/src/system/inputs/cvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ fn transpose_adc(sample: u32, slope: u32) -> f32 {
// extremes.
let compensation = 10.0 / 9.94;
let phase = (slope as f32 - sample as f32) / slope as f32;
let scaled = (min + phase * span).clamp(min, min + span);
scaled * compensation
let scaled = min + phase * span;
(scaled * compensation).clamp(min, min + span)
}

0 comments on commit 67a6491

Please sign in to comment.