From 12ce420583991a43fa1c9d14a0b1b7cb37c8b147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Mon, 8 Jul 2024 11:01:24 -0300 Subject: [PATCH] lib: Use new clamp function over min max MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 39979045d8..3d7e897543 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -501,7 +501,7 @@ impl Navigator { /// nav.set_pwm_channel_duty_cycle(PwmChannel::Ch1, 0.50); // sets the duty cycle to 50% /// ``` pub fn set_pwm_channel_duty_cycle(&mut self, channel: PwmChannel, duty_cycle: f32) { - let duty_cycle = duty_cycle.max(0.0).min(1.0); + let duty_cycle = duty_cycle.clamp(0.0, 1.0); let max_value = 4095; if approx::relative_eq!(duty_cycle, 1.0) {