mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 12:04:19 +00:00
⚡️ Reduce edit_screen code size (#25420)
This commit is contained in:
parent
53698b8f62
commit
c4ac8a2573
@ -117,8 +117,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
|
|||||||
// Reset repeat_delay for Touch Buttons
|
// Reset repeat_delay for Touch Buttons
|
||||||
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
|
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
|
||||||
// Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
|
// Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
|
||||||
if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
|
ui.encoderPosition = constrain(int32_t(ui.encoderPosition), 0, maxEditValue);
|
||||||
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
|
|
||||||
// If drawing is flagged then redraw the (whole) edit screen
|
// If drawing is flagged then redraw the (whole) edit screen
|
||||||
if (ui.should_draw())
|
if (ui.should_draw())
|
||||||
draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
|
draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
|
||||||
|
Loading…
Reference in New Issue
Block a user