mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
⚡️ Reduce edit_screen code size (#25420)
This commit is contained in:
parent
f9f6662a8c
commit
c5d5c375fd
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user