@@ -764,12 +764,42 @@ void MarlinUI::update() {
764
764
765
765
// If the action button is pressed...
766
766
static bool wait_for_unclick; // = 0
767
- if (!external_control && button_pressed ()) {
768
- if (!wait_for_unclick) { // If not waiting for a debounce release:
769
- wait_for_unclick = true ; // - Set debounce flag to ignore continous clicks
770
- lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
771
- wait_for_user = false ; // - Any click clears wait for user
772
- quick_feedback (); // - Always make a click sound
767
+ if (touch_buttons) {
768
+ if (buttons & EN_C) {
769
+ if (!wait_for_unclick) { // If not waiting for a debounce release:
770
+ wait_for_unclick = true ; // - Set debounce flag to ignore continous clicks
771
+ lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
772
+ wait_for_user = false ; // - Any click clears wait for user
773
+ quick_feedback (); // - Always make a click sound
774
+ }
775
+ }
776
+ else if (buttons & (EN_A | EN_B)) { // Ignore the encoder if clicked, to prevent "slippage"
777
+ const millis_t ms = millis ();
778
+ if (ELAPSED (ms, next_button_update_ms)) {
779
+ next_button_update_ms = ms + 50 ;
780
+ encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP);
781
+ if (buttons & EN_A) encoderDiff *= -1 ;
782
+ if (!wait_for_unclick) {
783
+ next_button_update_ms += 250 ;
784
+ #if HAS_BUZZER
785
+ buzz (LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
786
+ #endif
787
+ wait_for_unclick = true ; // - Set debounce flag to ignore continous clicks
788
+ }
789
+ }
790
+ }
791
+ }
792
+ else {
793
+ //
794
+ // Integrated LCD click handling via button_pressed()
795
+ //
796
+ if (!external_control && button_pressed ()) {
797
+ if (!wait_for_unclick) { // If not waiting for a debounce release:
798
+ wait_for_unclick = true ; // - Set debounce flag to ignore continous clicks
799
+ lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
800
+ wait_for_user = false ; // - Any click clears wait for user
801
+ quick_feedback (); // - Always make a click sound
802
+ }
773
803
}
774
804
}
775
805
else wait_for_unclick = false ;
@@ -784,7 +814,9 @@ void MarlinUI::update() {
784
814
#endif // HAS_LCD_MENU
785
815
786
816
#if ENABLED(INIT_SDCARD_ON_BOOT)
787
-
817
+ //
818
+ // SPI SD Card detection (and first card init when the LCD is present)
819
+ //
788
820
const uint8_t sd_status = (uint8_t )IS_SD_INSERTED ();
789
821
if (sd_status != lcd_sd_status && detected ()) {
790
822
0 commit comments