diff --git a/src/command_handler.rs b/src/command_handler.rs index 01a6fec..0ec4100 100644 --- a/src/command_handler.rs +++ b/src/command_handler.rs @@ -204,11 +204,19 @@ impl Handler { } PwmPin::MaxIPos => { let current = ElectricCurrent::new::(value); - channels.set_max_i_pos(channel, current); + if channels.channel_state(channel).polarity_swapped { + channels.set_max_i_neg(channel, current); + } else { + channels.set_max_i_pos(channel, current); + } } PwmPin::MaxINeg => { let current = ElectricCurrent::new::(value); - channels.set_max_i_neg(channel, current); + if channels.channel_state(channel).polarity_swapped { + channels.set_max_i_pos(channel, current); + } else { + channels.set_max_i_neg(channel, current); + } } } send_line(socket, b"{}");