Commit a8cf290 1 parent 032e5c9 commit a8cf290 Copy full SHA for a8cf290
File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -680,7 +680,31 @@ class MarlinUI {
680
680
#endif
681
681
682
682
static void update_buttons ();
683
- static bool button_pressed () { return BUTTON_CLICK () || TERN (TOUCH_SCREEN, touch_pressed (), false ); }
683
+
684
+ #if HAS_ENCODER_NOISE
685
+ #ifndef ENCODER_SAMPLES
686
+ #define ENCODER_SAMPLES 10
687
+ #endif
688
+
689
+ /* *
690
+ * Some printers may have issues with EMI noise especially using a motherboard with 3.3V logic levels
691
+ * it may cause the logical LOW to float into the undefined region and register as a logical HIGH
692
+ * causing it to errorenously register as if someone clicked the button and in worst case make the printer
693
+ * unusable in practice.
694
+ */
695
+ static bool hw_button_pressed () {
696
+ LOOP_L_N (s, ENCODER_SAMPLES) {
697
+ if (!BUTTON_CLICK ()) return false ;
698
+ safe_delay (1 );
699
+ }
700
+ return true ;
701
+ }
702
+ #else
703
+ static bool hw_button_pressed () { return BUTTON_CLICK (); }
704
+ #endif
705
+
706
+ static bool button_pressed () { return hw_button_pressed () || TERN0 (TOUCH_SCREEN, touch_pressed ()); }
707
+
684
708
#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
685
709
static void wait_for_release ();
686
710
#endif
You can’t perform that action at this time.
0 commit comments