clamp rate
This commit is contained in:
parent
e7a07b30ae
commit
7dd32ea667
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue