From f41e8b523b8c3258ac9be89abe5f3c716b7392ae Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 4 Apr 2025 08:42:45 +0200 Subject: [PATCH] chore: simplify #20183 --- core/circuit/circuit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/circuit/circuit.go b/core/circuit/circuit.go index cda95e975..c77b463b1 100644 --- a/core/circuit/circuit.go +++ b/core/circuit/circuit.go @@ -326,7 +326,7 @@ func (c *Circuit) ValidatePower(old, new float64, charging bool) float64 { var capped float64 if charging { - capped = min(maxPower, min(max(0, potential+old), new)) + capped = min(maxPower, new, max(0, potential+old)) } else { capped = max(0, min(new, potential)) } @@ -350,7 +350,7 @@ func (c *Circuit) ValidateCurrent(old, new float64, charging bool) float64 { var capped float64 if charging { - capped = min(maxCurrent, min(max(0, potential+old), new)) + capped = min(maxCurrent, new, max(0, potential+old)) } else { capped = max(0, min(new, potential)) }