1
0
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:
Guðni Már Gilbert 2023-02-24 03:29:47 +00:00 committed by GitHub
parent f9f6662a8c
commit c5d5c375fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));