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 thinkyhead committed Apr 7, 2023
1 parent 53698b8 commit c4ac8a2
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 c4ac8a2

Please sign in to comment.