diff --git a/Batterie/module.php b/Batterie/module.php index aa87b7b..20adb84 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -139,7 +139,11 @@ private function GeneratePowerSteps($additionalValue) if ($minleistung > 0) $minleistung = 0; // Grundarray: von min bis max in 250er Schritten - $array_powersteps = range($minleistung, $maxleistung, $stepSize); + $neg = ($minleistung < 0) ? range($minleistung, 0, $stepSize) : [0]; + $pos = range(0, $maxleistung, $stepSize); + + $array_powersteps = array_values(array_unique(array_merge($neg, $pos))); + sort($array_powersteps, SORT_NUMERIC); // Zusätzlichen Wert auf 50er abrunden (floor, nicht round!) // (wichtig: floor bei negativen Zahlen geht "weiter runter", daher extra Logik)