We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53698b8 commit c4ac8a2Copy full SHA for c4ac8a2
Marlin/src/lcd/menu/menu.cpp
@@ -117,8 +117,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
117
// Reset repeat_delay for Touch Buttons
118
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
119
// Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
120
- if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
121
- if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
+ ui.encoderPosition = constrain(int32_t(ui.encoderPosition), 0, maxEditValue);
122
// If drawing is flagged then redraw the (whole) edit screen
123
if (ui.should_draw())
124
draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
0 commit comments