Procházet zdrojové kódy

Ensure pins set to INPUT after attachInterrupt (#10928)

Scott Lahteine před 6 roky
rodič
revize
a426986df8
No account linked to committer's email address

+ 9
- 9
Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h Zobrazit soubor

@@ -56,40 +56,40 @@ void endstop_ISR(void) { endstops.check_possible_change(); }
56 56
 
57 57
 void setup_endstop_interrupts(void) {
58 58
   #if HAS_X_MAX
59
-    SET_INPUT(X_MAX_PIN);
60 59
     attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE); // assign it
60
+    SET_INPUT(X_MAX_PIN);
61 61
   #endif
62 62
   #if HAS_X_MIN
63
-    SET_INPUT(X_MIN_PIN);
64 63
     attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
64
+    SET_INPUT(X_MIN_PIN);
65 65
   #endif
66 66
   #if HAS_Y_MAX
67
-    SET_INPUT(Y_MAX_PIN);
68 67
     attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
68
+    SET_INPUT(Y_MAX_PIN);
69 69
   #endif
70 70
   #if HAS_Y_MIN
71
-    SET_INPUT(Y_MIN_PIN);
72 71
     attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
72
+    SET_INPUT(Y_MIN_PIN);
73 73
   #endif
74 74
   #if HAS_Z_MAX
75
-    SET_INPUT(Z_MAX_PIN);
76 75
     attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
76
+    SET_INPUT(Z_MAX_PIN);
77 77
   #endif
78 78
   #if HAS_Z_MIN
79
-    SET_INPUT(Z_MIN_PIN);
80 79
     attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
80
+    SET_INPUT(Z_MIN_PIN);
81 81
   #endif
82 82
   #if HAS_Z2_MAX
83
-    SET_INPUT(Z2_MAX_PIN);
84 83
     attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
84
+    SET_INPUT(Z2_MAX_PIN);
85 85
   #endif
86 86
   #if HAS_Z2_MIN
87
-    SET_INPUT(Z2_MIN_PIN);
88 87
     attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
88
+    SET_INPUT(Z2_MIN_PIN);
89 89
   #endif
90 90
   #if HAS_Z_MIN_PROBE_PIN
91
-    SET_INPUT(Z_MIN_PROBE_PIN);
92 91
     attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
92
+    SET_INPUT(Z_MIN_PROBE_PIN);
93 93
   #endif
94 94
 }
95 95
 

+ 10
- 10
Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h Zobrazit soubor

@@ -31,40 +31,40 @@ void endstop_ISR(void) { endstops.check_possible_change(); }
31 31
 
32 32
 void setup_endstop_interrupts(void) {
33 33
   #if HAS_X_MAX
34
-    pinMode(X_MAX_PIN, INPUT);
35
-    attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE); // assign it
34
+    attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
35
+    SET_INPUT(X_MAX_PIN);
36 36
   #endif
37 37
   #if HAS_X_MIN
38
-    pinMode(X_MIN_PIN, INPUT);
39 38
     attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
39
+    SET_INPUT(X_MIN_PIN);
40 40
   #endif
41 41
   #if HAS_Y_MAX
42
-    pinMode(Y_MAX_PIN, INPUT);
43 42
     attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
43
+    SET_INPUT(Y_MAX_PIN);
44 44
   #endif
45 45
   #if HAS_Y_MIN
46
-    pinMode(Y_MIN_PIN, INPUT);
47 46
     attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
47
+    SET_INPUT(Y_MIN_PIN);
48 48
   #endif
49 49
   #if HAS_Z_MAX
50
-    pinMode(Z_MAX_PIN, INPUT);
51 50
     attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
51
+    SET_INPUT(Z_MAX_PIN);
52 52
   #endif
53 53
   #if HAS_Z_MIN
54
-    pinMode(Z_MIN_PIN, INPUT);
55 54
     attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
55
+    SET_INPUT(Z_MIN_PIN);
56 56
   #endif
57 57
   #if HAS_Z2_MAX
58
-    pinMode(Z2_MAX_PIN, INPUT);
59 58
     attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
59
+    SET_INPUT(Z2_MAX_PIN);
60 60
   #endif
61 61
   #if HAS_Z2_MIN
62
-    pinMode(Z2_MIN_PIN, INPUT);
63 62
     attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
63
+    SET_INPUT(Z2_MIN_PIN);
64 64
   #endif
65 65
   #if HAS_Z_MIN_PROBE_PIN
66
-    pinMode(Z_MIN_PROBE_PIN, INPUT);
67 66
     attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
67
+    SET_INPUT(Z_MIN_PROBE_PIN);
68 68
   #endif
69 69
 }
70 70
 

+ 10
- 10
Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h Zobrazit soubor

@@ -33,40 +33,40 @@ void endstop_ISR(void) { endstops.check_possible_change(); }
33 33
 
34 34
 void setup_endstop_interrupts(void) {
35 35
   #if HAS_X_MAX
36
-    pinMode(X_MAX_PIN, INPUT);
37
-    attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE); // assign it
36
+    attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
37
+    SET_INPUT(X_MAX_PIN);
38 38
   #endif
39 39
   #if HAS_X_MIN
40
-    pinMode(X_MIN_PIN, INPUT);
41 40
     attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
41
+    SET_INPUT(X_MIN_PIN);
42 42
   #endif
43 43
   #if HAS_Y_MAX
44
-    pinMode(Y_MAX_PIN, INPUT);
45 44
     attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
45
+    SET_INPUT(Y_MAX_PIN);
46 46
   #endif
47 47
   #if HAS_Y_MIN
48
-    pinMode(Y_MIN_PIN, INPUT);
49 48
     attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
49
+    SET_INPUT(Y_MIN_PIN);
50 50
   #endif
51 51
   #if HAS_Z_MAX
52
-    pinMode(Z_MAX_PIN, INPUT);
53 52
     attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
53
+    SET_INPUT(Z_MAX_PIN);
54 54
   #endif
55 55
   #if HAS_Z_MIN
56
-    pinMode(Z_MIN_PIN, INPUT);
57 56
     attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
57
+    SET_INPUT(Z_MIN_PIN);
58 58
   #endif
59 59
   #if HAS_Z2_MAX
60
-    pinMode(Z2_MAX_PIN, INPUT);
61 60
     attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
61
+    SET_INPUT(Z2_MAX_PIN);
62 62
   #endif
63 63
   #if HAS_Z2_MIN
64
-    pinMode(Z2_MIN_PIN, INPUT);
65 64
     attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
65
+    SET_INPUT(Z2_MIN_PIN);
66 66
   #endif
67 67
   #if HAS_Z_MIN_PROBE_PIN
68
-    pinMode(Z_MIN_PROBE_PIN, INPUT);
69 68
     attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
69
+    SET_INPUT(Z_MIN_PROBE_PIN);
70 70
   #endif
71 71
 }
72 72
 

Loading…
Zrušit
Uložit