diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 5f6db8196..fb4db9742 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -143,6 +143,9 @@ void MenuItem_gcode::action(PGM_P const pgcode) { queue.inject_P(pgcode); } * MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) */ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { + #if ENABLED(TOUCH_BUTTONS) + ui.repeat_delay = 50; + #endif if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0; if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue; if (ui.should_draw()) @@ -212,6 +215,10 @@ bool printer_busy() { void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { if (currentScreen != screen) { + #if ENABLED(TOUCH_BUTTONS) + repeat_delay = 250; + #endif + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) // Shadow for editing the fade height lcd_z_fade_height = planner.z_fade_height; diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 797abe006..d8db1a823 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -195,6 +195,10 @@ millis_t MarlinUI::next_button_update_ms; // = 0 int8_t MarlinUI::encoderDirection = ENCODERBASE; #endif + #if ENABLED(TOUCH_BUTTONS) + uint8_t MarlinUI::repeat_delay; + #endif + bool MarlinUI::lcd_clicked; float move_menu_scale; @@ -792,7 +796,7 @@ void MarlinUI::update() { if (touch_buttons & (EN_A | EN_B)) { // A and/or B button? encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection; if (touch_buttons & EN_A) encoderDiff *= -1; - next_button_update_ms = ms + 50; // Assume the repeat delay + next_button_update_ms = ms + repeat_delay; // Assume the repeat delay if (!wait_for_unclick && !arrow_pressed) { // On click prepare for repeat next_button_update_ms += 250; // Longer delay on first press arrow_pressed = true; // Mark arrow as pressed diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index a6be315e6..47f5806a2 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -406,6 +406,10 @@ public: #if HAS_LCD_MENU + #if ENABLED(TOUCH_BUTTONS) + static uint8_t repeat_delay; + #endif + #if ENABLED(ENCODER_RATE_MULTIPLIER) static bool encoderRateMultiplierEnabled; static millis_t lastEncoderMovementMillis;