chore: simplify #20183

This commit is contained in:
andig 2025-04-04 08:42:45 +02:00
parent 61ae848296
commit f41e8b523b

View file

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