rp2040_app: Fix rounding to step in crement
This commit is contained in:
@@ -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
|
// round to step in correct direction
|
||||||
if (inc) {
|
if (inc) {
|
||||||
|
if (val < 0)
|
||||||
val = ((val - step + 1) / step) * step;
|
val = ((val - step + 1) / step) * step;
|
||||||
|
else
|
||||||
|
val = (val / step) * step;
|
||||||
} else {
|
} else {
|
||||||
|
if (val < 0)
|
||||||
|
val = (val / step) * step;
|
||||||
|
else
|
||||||
val = ((val + step - 1) / step) * step;
|
val = ((val + step - 1) / step) * step;
|
||||||
}
|
}
|
||||||
if (inc) {
|
if (inc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user