We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 871e82d commit 45c6faeCopy full SHA for 45c6fae
src/output_devices.rs
@@ -457,7 +457,7 @@ macro_rules! impl_pwm_device {
457
}
458
459
fn write_state(&mut self, value: f64) {
460
- if !(value >= 0.0 && value <= 1.0) {
+ if !(0.0..=1.0).contains(&value) {
461
println!("Value must be between 0.0 and 1.0");
462
return;
463
@@ -653,7 +653,7 @@ impl Motor {
653
/// The speed at which the motor should turn.
654
/// Can be any value between 0.0 (stopped) and the default 1.0 (maximum speed)
655
pub fn set_speed(&mut self, speed: f64) {
656
- if !(speed >= 0.0 && speed <= 1.0) {
+ if !(0.0..=1.0).contains(&speed) {
657
println!("Speed must be between 0.0 and 1.0");
658
659
0 commit comments