forked from M-Labs/thermostat
Account for swapped current limits
This commit is contained in:
parent
ce4fb6090a
commit
2dd01f8a15
@ -204,11 +204,19 @@ impl Handler {
|
|||||||
}
|
}
|
||||||
PwmPin::MaxIPos => {
|
PwmPin::MaxIPos => {
|
||||||
let current = ElectricCurrent::new::<ampere>(value);
|
let current = ElectricCurrent::new::<ampere>(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 => {
|
PwmPin::MaxINeg => {
|
||||||
let current = ElectricCurrent::new::<ampere>(value);
|
let current = ElectricCurrent::new::<ampere>(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"{}");
|
send_line(socket, b"{}");
|
||||||
|
Loading…
Reference in New Issue
Block a user