From 7dd32ea66775c4cc93ed6dd3d88e1f18836357ac Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Wed, 17 Jan 2024 08:35:00 +1100 Subject: [PATCH] clamp rate --- src/tesla_charge_rate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tesla_charge_rate.rs b/src/tesla_charge_rate.rs index abc4776..65fb5bb 100644 --- a/src/tesla_charge_rate.rs +++ b/src/tesla_charge_rate.rs @@ -129,7 +129,7 @@ fn get_control(pl_state: &PlState, charge_state: &ChargeState) -> Option Option { 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 { None } else {