fix(bw): cannot select all numeric values for some fields (#5420)
This commit is contained in:
@@ -180,7 +180,7 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
|
|||||||
lcdDrawNumber(x, y, v.value, attr);
|
lcdDrawNumber(x, y, v.value, attr);
|
||||||
if (attr & (~RIGHT)) {
|
if (attr & (~RIGHT)) {
|
||||||
value = checkIncDec(event, value, min, max, sourceMin, sourceMax,
|
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);
|
isValueAvailable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
|
|||||||
lcdDrawNumber(x, y, v.value, attr);
|
lcdDrawNumber(x, y, v.value, attr);
|
||||||
if (attr & (~RIGHT)) {
|
if (attr & (~RIGHT)) {
|
||||||
value = checkIncDec(event, value, min, max, sourceMin, sourceMax,
|
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);
|
isValueAvailable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ extern int8_t s_editMode; // global editmode
|
|||||||
#define NO_DBLKEYS 0x80
|
#define NO_DBLKEYS 0x80
|
||||||
#define INCDEC_SOURCE_INVERT 0x100
|
#define INCDEC_SOURCE_INVERT 0x100
|
||||||
#define INCDEC_SOURCE_VALUE 0x200 // Field can be source or value
|
#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,
|
int checkIncDec(event_t event, int val, int i_min, int i_max,
|
||||||
unsigned int i_flags = 0, IsValueAvailable isValueAvailable = nullptr,
|
unsigned int i_flags = 0, IsValueAvailable isValueAvailable = nullptr,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, int srcMin, int sr
|
|||||||
else {
|
else {
|
||||||
newval++;
|
newval++;
|
||||||
}
|
}
|
||||||
} while (isValueAvailable && !isValueAvailable(newval) &&
|
} while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) &&
|
||||||
newval <= i_max);
|
newval <= i_max);
|
||||||
|
|
||||||
if (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 {
|
} else {
|
||||||
newval--;
|
newval--;
|
||||||
}
|
}
|
||||||
} while (isValueAvailable && !isValueAvailable(newval) &&
|
} while (!(i_flags & INCDEC_SKIP_VAL_CHECK_FUNC) && isValueAvailable && !isValueAvailable(newval) &&
|
||||||
newval >= i_min);
|
newval >= i_min);
|
||||||
|
|
||||||
if (newval < i_min) {
|
if (newval < i_min) {
|
||||||
|
|||||||
@@ -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);
|
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++;
|
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);
|
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--;
|
newval--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user