fix(bw): cannot select all numeric values for some fields (#5420)

This commit is contained in:
philmoz
2024-08-13 20:02:17 +10:00
committed by GitHub
parent 756bda0389
commit 0594dab1f3
5 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
lcdDrawNumber(x, y, v.value, attr);
if (attr & (~RIGHT)) {
value = checkIncDec(event, value, min, max, sourceMin, sourceMax,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS|INCDEC_SKIP_VAL_CHECK_FUNC,
isValueAvailable);
}
}
+1 -1
View File
@@ -138,7 +138,7 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
lcdDrawNumber(x, y, v.value, attr);
if (attr & (~RIGHT)) {
value = checkIncDec(event, value, min, max, sourceMin, sourceMax,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS|INCDEC_SKIP_VAL_CHECK_FUNC,
isValueAvailable);
}
}
+1
View File
@@ -75,6 +75,7 @@ extern int8_t s_editMode; // global editmode
#define NO_DBLKEYS 0x80
#define INCDEC_SOURCE_INVERT 0x100
#define INCDEC_SOURCE_VALUE 0x200 // Field can be source or value
#define INCDEC_SKIP_VAL_CHECK_FUNC 0x400 // Skip isValueAvailable function when changing value (only used for popup)
int checkIncDec(event_t event, int val, int i_min, int i_max,
unsigned int i_flags = 0, IsValueAvailable isValueAvailable = nullptr,
+2 -2
View File
@@ -63,7 +63,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, int srcMin, int sr
else {
newval++;
}
} while (isValueAvailable && !isValueAvailable(newval) &&
} while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) &&
newval <= i_max);
if (newval > i_max) {
@@ -79,7 +79,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, int srcMin, int sr
} else {
newval--;
}
} while (isValueAvailable && !isValueAvailable(newval) &&
} while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) &&
newval >= i_min);
if (newval < i_min) {
+2 -2
View File
@@ -79,7 +79,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, int srcMin, int sr
newval += min<int>(rotaryEncoderGetAccel(), i_max - val);
}
while (isValueAvailable && !isValueAvailable(newval) && newval <= i_max) {
while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) && newval <= i_max) {
newval++;
}
@@ -96,7 +96,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, int srcMin, int sr
newval -= min<int>(rotaryEncoderGetAccel(), val - i_min);
}
while (isValueAvailable && !isValueAvailable(newval) && newval >= i_min) {
while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) && newval >= i_min) {
newval--;
}