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)) }