Skip to content

Commit

Permalink
⚡️ Reduce edit_screen code size (MarlinFirmware#25420)
Browse files Browse the repository at this point in the history
  • Loading branch information
gudnimg authored and EvilGremlin committed Apr 8, 2023
1 parent aac22d0 commit 4b6c826
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
// Reset repeat_delay for Touch Buttons
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
// Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
ui.encoderPosition = constrain(int32_t(ui.encoderPosition), 0, maxEditValue);
// If drawing is flagged then redraw the (whole) edit screen
if (ui.should_draw())
draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
Expand Down

0 comments on commit 4b6c826

Please sign in to comment.