Skip to content

Commit c4ac8a2

Browse files
gudnimgthinkyhead
authored andcommittedApr 7, 2023
⚡️ Reduce edit_screen code size (MarlinFirmware#25420)
1 parent 53698b8 commit c4ac8a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎Marlin/src/lcd/menu/menu.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
117117
// Reset repeat_delay for Touch Buttons
118118
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
119119
// 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;
120+
ui.encoderPosition = constrain(int32_t(ui.encoderPosition), 0, maxEditValue);
122121
// If drawing is flagged then redraw the (whole) edit screen
123122
if (ui.should_draw())
124123
draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));

0 commit comments

Comments
 (0)
Please sign in to comment.