rp2040_app: Fix rounding to step in crement

This commit is contained in:
2023-06-10 00:38:31 +02:00
parent 81b5ccfbe8
commit b512372b19

View File

@@ -144,8 +144,14 @@ static int crement_val(bool inc, int val, int min, int max, int step, bool wrap)
{
// round to step in correct direction
if (inc) {
if (val < 0)
val = ((val - step + 1) / step) * step;
else
val = (val / step) * step;
} else {
if (val < 0)
val = (val / step) * step;
else
val = ((val + step - 1) / step) * step;
}
if (inc) {