From b394cfa3d4a060f97d23ad1773bec6daede2033a Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 23 Sep 2020 20:50:50 +0200 Subject: [PATCH] main: remove special handling for PwmPin::ISet --- src/main.rs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6bbaf6e..d8eeb21 100644 --- a/src/main.rs +++ b/src/main.rs @@ -303,23 +303,20 @@ fn main() -> ! { let _ = writeln!(socket, "channel {}: PID enabled to control PWM", channel ); } - Command::Pwm { channel, pin: PwmPin::ISet, value } => { - channels.channel_state(channel).pid_engaged = false; - leds.g3.off(); - let current = ElectricCurrent::new::(value); - let (current, max) = channels.set_i(channel, current); - let _ = writeln!( - socket, "channel {}: i_set DAC output set to {:.3} / {:.3}", - channel, - current.into_format_args(ampere, Abbreviation), - max.into_format_args(ampere, Abbreviation), - ); - } Command::Pwm { channel, pin, value } => { match pin { - PwmPin::ISet => - // Handled above - unreachable!(), + PwmPin::ISet => { + channels.channel_state(channel).pid_engaged = false; + leds.g3.off(); + let current = ElectricCurrent::new::(value); + let (current, max) = channels.set_i(channel, current); + let _ = writeln!( + socket, "channel {}: i_set DAC output set to {:.3} / {:.3}", + channel, + current.into_format_args(ampere, Abbreviation), + max.into_format_args(ampere, Abbreviation), + ); + } PwmPin::MaxV => { let voltage = ElectricPotential::new::(value); let (voltage, max) = channels.set_max_v(channel, voltage);