clamp rate

This commit is contained in:
Alex Janka 2024-01-17 08:35:00 +11:00
parent e7a07b30ae
commit 7dd32ea667

View file

@ -129,7 +129,7 @@ fn get_control(pl_state: &PlState, charge_state: &ChargeState) -> Option<Interfa
fn valid_rate(rate: i64, other: i64) -> Option<i64> { fn valid_rate(rate: i64, other: i64) -> Option<i64> {
let config = access_config(); let config = access_config();
let new = rate.min(config.max_rate).max(config.min_rate); let new = rate.clamp(config.min_rate, config.max_rate);
if new == other { if new == other {
None None
} else { } else {