Browse Source

Distinct runout states (#19965)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Costas Basdekis 4 years ago
parent
commit
0465e0ae3a
No account linked to committer's email address

+ 20
- 2
Marlin/Configuration.h View File

@@ -1186,9 +1186,27 @@
1186 1186
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
1187 1187
   #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
1188 1188
   #define NUM_RUNOUT_SENSORS   1          // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
1189
+
1189 1190
   #define FIL_RUNOUT_STATE     LOW        // Pin state indicating that filament is NOT present.
1190
-  #define FIL_RUNOUT_PULLUP               // Use internal pullup for filament runout pins.
1191
-  //#define FIL_RUNOUT_PULLDOWN           // Use internal pulldown for filament runout pins.
1191
+  #define FIL_RUNOUT_PULL                 // Use internal pullup / pulldown for filament runout pins.
1192
+
1193
+  // Override individually if the runout sensors vary
1194
+  //#define FIL_RUNOUT1_STATE LOW
1195
+  //#define FIL_RUNOUT1_PULL
1196
+  //#define FIL_RUNOUT2_STATE LOW
1197
+  //#define FIL_RUNOUT2_PULL
1198
+  //#define FIL_RUNOUT3_STATE LOW
1199
+  //#define FIL_RUNOUT3_PULL
1200
+  //#define FIL_RUNOUT4_STATE LOW
1201
+  //#define FIL_RUNOUT4_PULL
1202
+  //#define FIL_RUNOUT5_STATE LOW
1203
+  //#define FIL_RUNOUT5_PULL
1204
+  //#define FIL_RUNOUT6_STATE LOW
1205
+  //#define FIL_RUNOUT6_PULL
1206
+  //#define FIL_RUNOUT7_STATE LOW
1207
+  //#define FIL_RUNOUT7_PULL
1208
+  //#define FIL_RUNOUT8_STATE LOW
1209
+  //#define FIL_RUNOUT8_PULL
1192 1210
 
1193 1211
   // Set one or more commands to execute on filament runout.
1194 1212
   // (After 'M412 H' Marlin will ask the host to handle the process.)

+ 3
- 0
Marlin/src/HAL/DUE/fastio.h View File

@@ -163,6 +163,9 @@
163 163
 #define SET_INPUT(IO)        _SET_INPUT(IO)
164 164
 // Set pin as input with pullup (wrapper)
165 165
 #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
166
+// Set pin as input with pulldown (substitution)
167
+#define SET_INPUT_PULLDOWN   SET_INPUT
168
+
166 169
 // Set pin as output (wrapper) -  reads the pin and sets the output to that value
167 170
 #define SET_OUTPUT(IO)       _SET_OUTPUT(IO)
168 171
 // Set pin as PWM

+ 3
- 0
Marlin/src/HAL/ESP32/fastio.h View File

@@ -52,6 +52,9 @@
52 52
 // Set pin as input with pullup wrapper
53 53
 #define SET_INPUT_PULLUP(IO)    do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
54 54
 
55
+// Set pin as input with pulldown (substitution)
56
+#define SET_INPUT_PULLDOWN      SET_INPUT
57
+
55 58
 // Set pin as output wrapper
56 59
 #define SET_OUTPUT(IO)          do{ _SET_OUTPUT(IO); }while(0)
57 60
 

+ 1
- 1
Marlin/src/feature/mmu2/mmu2.cpp View File

@@ -163,7 +163,7 @@ uint8_t MMU2::get_current_tool() {
163 163
 }
164 164
 
165 165
 #if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
166
-  #define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE)
166
+  #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
167 167
 #endif
168 168
 
169 169
 void MMU2::mmu_loop() {

+ 52
- 15
Marlin/src/feature/runout.h View File

@@ -149,18 +149,34 @@ class FilamentSensorBase {
149 149
 
150 150
   public:
151 151
     static inline void setup() {
152
-      #if ENABLED(FIL_RUNOUT_PULLUP)
153
-        #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P)
154
-      #elif ENABLED(FIL_RUNOUT_PULLDOWN)
155
-        #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P)
156
-      #else
157
-        #define INIT_RUNOUT_PIN(P) SET_INPUT(P)
152
+      #define _INIT_RUNOUT_PIN(P,S,U) do{ if (DISABLED(U)) SET_INPUT(P); else if (S) SET_INPUT_PULLDOWN(P); else SET_INPUT_PULLUP(P); }while(0)
153
+      #define  INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
154
+      #if NUM_RUNOUT_SENSORS >= 1
155
+        INIT_RUNOUT_PIN(1);
158 156
       #endif
159
-
160
-      #define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN);
161
-      REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT)
162
-      #undef _INIT_RUNOUT
163
-      #undef INIT_RUNOUT_PIN
157
+      #if NUM_RUNOUT_SENSORS >= 2
158
+        INIT_RUNOUT_PIN(2);
159
+      #endif
160
+      #if NUM_RUNOUT_SENSORS >= 3
161
+        INIT_RUNOUT_PIN(3);
162
+      #endif
163
+      #if NUM_RUNOUT_SENSORS >= 4
164
+        INIT_RUNOUT_PIN(4);
165
+      #endif
166
+      #if NUM_RUNOUT_SENSORS >= 5
167
+        INIT_RUNOUT_PIN(5);
168
+      #endif
169
+      #if NUM_RUNOUT_SENSORS >= 6
170
+        INIT_RUNOUT_PIN(6);
171
+      #endif
172
+      #if NUM_RUNOUT_SENSORS >= 7
173
+        INIT_RUNOUT_PIN(7);
174
+      #endif
175
+      #if NUM_RUNOUT_SENSORS >= 8
176
+        INIT_RUNOUT_PIN(8);
177
+      #endif
178
+      #undef _INIT_RUNOUT_PIN
179
+      #undef  INIT_RUNOUT_PIN
164 180
     }
165 181
 
166 182
     // Return a bitmask of runout pin states
@@ -172,11 +188,32 @@ class FilamentSensorBase {
172 188
 
173 189
     // Return a bitmask of runout flag states (1 bits always indicates runout)
174 190
     static inline uint8_t poll_runout_states() {
175
-      return poll_runout_pins()
176
-        #if FIL_RUNOUT_STATE == LOW
177
-          ^ uint8_t(_BV(NUM_RUNOUT_SENSORS) - 1)
191
+      return poll_runout_pins() ^ uint8_t(0
192
+        #if NUM_RUNOUT_SENSORS >= 1
193
+          | (FIL_RUNOUT1_STATE ? 0 : _BV(1 - 1))
194
+        #endif
195
+        #if NUM_RUNOUT_SENSORS >= 2
196
+          | (FIL_RUNOUT2_STATE ? 0 : _BV(2 - 1))
197
+        #endif
198
+        #if NUM_RUNOUT_SENSORS >= 3
199
+          | (FIL_RUNOUT3_STATE ? 0 : _BV(3 - 1))
200
+        #endif
201
+        #if NUM_RUNOUT_SENSORS >= 4
202
+          | (FIL_RUNOUT4_STATE ? 0 : _BV(4 - 1))
203
+        #endif
204
+        #if NUM_RUNOUT_SENSORS >= 5
205
+          | (FIL_RUNOUT5_STATE ? 0 : _BV(5 - 1))
206
+        #endif
207
+        #if NUM_RUNOUT_SENSORS >= 6
208
+          | (FIL_RUNOUT6_STATE ? 0 : _BV(6 - 1))
209
+        #endif
210
+        #if NUM_RUNOUT_SENSORS >= 7
211
+          | (FIL_RUNOUT7_STATE ? 0 : _BV(7 - 1))
212
+        #endif
213
+        #if NUM_RUNOUT_SENSORS >= 8
214
+          | (FIL_RUNOUT8_STATE ? 0 : _BV(8 - 1))
178 215
         #endif
179
-      ;
216
+      );
180 217
     }
181 218
 };
182 219
 

+ 1
- 1
Marlin/src/gcode/feature/pause/M600.cpp View File

@@ -88,7 +88,7 @@ void GcodeSuite::M600() {
88 88
                               // In this case, for duplicating modes set DXC_ext to the extruder that ran out.
89 89
       #if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
90 90
         if (idex_is_duplicating())
91
-          DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0;
91
+          DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
92 92
       #else
93 93
         DXC_ext = active_extruder;
94 94
       #endif

+ 67
- 0
Marlin/src/inc/Conditionals_LCD.h View File

@@ -675,6 +675,73 @@
675 675
   #define HAS_BED_PROBE 1
676 676
 #endif
677 677
 
678
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
679
+  #if NUM_RUNOUT_SENSORS >= 1
680
+    #ifndef FIL_RUNOUT1_STATE
681
+      #define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
682
+    #endif
683
+    #ifndef FIL_RUNOUT1_PULL
684
+      #define FIL_RUNOUT1_PULL FIL_RUNOUT_PULL
685
+    #endif
686
+  #endif
687
+  #if NUM_RUNOUT_SENSORS >= 2
688
+    #ifndef FIL_RUNOUT2_STATE
689
+      #define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
690
+    #endif
691
+    #ifndef FIL_RUNOUT2_PULL
692
+      #define FIL_RUNOUT2_PULL FIL_RUNOUT_PULL
693
+    #endif
694
+  #endif
695
+  #if NUM_RUNOUT_SENSORS >= 3
696
+    #ifndef FIL_RUNOUT3_STATE
697
+      #define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
698
+    #endif
699
+    #ifndef FIL_RUNOUT3_PULL
700
+      #define FIL_RUNOUT3_PULL FIL_RUNOUT_PULL
701
+    #endif
702
+  #endif
703
+  #if NUM_RUNOUT_SENSORS >= 4
704
+    #ifndef FIL_RUNOUT4_STATE
705
+      #define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
706
+    #endif
707
+    #ifndef FIL_RUNOUT4_PULL
708
+      #define FIL_RUNOUT4_PULL FIL_RUNOUT_PULL
709
+    #endif
710
+  #endif
711
+  #if NUM_RUNOUT_SENSORS >= 5
712
+    #ifndef FIL_RUNOUT5_STATE
713
+      #define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
714
+    #endif
715
+    #ifndef FIL_RUNOUT5_PULL
716
+      #define FIL_RUNOUT5_PULL FIL_RUNOUT_PULL
717
+    #endif
718
+  #endif
719
+  #if NUM_RUNOUT_SENSORS >= 6
720
+    #ifndef FIL_RUNOUT6_STATE
721
+      #define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
722
+    #endif
723
+    #ifndef FIL_RUNOUT6_PULL
724
+      #define FIL_RUNOUT6_PULL FIL_RUNOUT_PULL
725
+    #endif
726
+  #endif
727
+  #if NUM_RUNOUT_SENSORS >= 7
728
+    #ifndef FIL_RUNOUT7_STATE
729
+      #define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
730
+    #endif
731
+    #ifndef FIL_RUNOUT7_PULL
732
+      #define FIL_RUNOUT7_PULL FIL_RUNOUT_PULL
733
+    #endif
734
+  #endif
735
+  #if NUM_RUNOUT_SENSORS >= 8
736
+    #ifndef FIL_RUNOUT8_STATE
737
+      #define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
738
+    #endif
739
+    #ifndef FIL_RUNOUT8_PULL
740
+      #define FIL_RUNOUT8_PULL FIL_RUNOUT_PULL
741
+    #endif
742
+  #endif
743
+#endif // FILAMENT_RUNOUT_SENSOR
744
+
678 745
 #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
679 746
   #undef PROBE_MANUALLY
680 747
 #endif

+ 15
- 15
Marlin/src/inc/SanityCheck.h View File

@@ -111,7 +111,7 @@
111 111
 #elif defined(FILAMENT_SENSOR)
112 112
   #error "FILAMENT_SENSOR is now FILAMENT_WIDTH_SENSOR. Please update your configuration."
113 113
 #elif defined(ENDSTOPPULLUP_FIL_RUNOUT)
114
-  #error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULLUP. Please update your configuration."
114
+  #error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULL. Please update your configuration."
115 115
 #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
116 116
   #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
117 117
 #elif defined(LANGUAGE_INCLUDE)
@@ -660,8 +660,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
660 660
 
661 661
 #if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS)
662 662
   #error "Enable only one of ENDSTOPPULLUPS or ENDSTOPPULLDOWNS."
663
-#elif BOTH(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN)
664
-  #error "Enable only one of FIL_RUNOUT_PULLUP or FIL_RUNOUT_PULLDOWN."
665 663
 #elif BOTH(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX)
666 664
   #error "Enable only one of ENDSTOPPULLUP_X_MAX or ENDSTOPPULLDOWN_X_MAX."
667 665
 #elif BOTH(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX)
@@ -814,18 +812,20 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
814 812
     #error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN."
815 813
   #elif NUM_RUNOUT_SENSORS > E_STEPPERS
816 814
     #error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
817
-  #elif NUM_RUNOUT_SENSORS > 1 && !PIN_EXISTS(FIL_RUNOUT2)
818
-    #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 1 requires FIL_RUNOUT2_PIN."
819
-  #elif NUM_RUNOUT_SENSORS > 2 && !PIN_EXISTS(FIL_RUNOUT3)
820
-    #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 2 requires FIL_RUNOUT3_PIN."
821
-  #elif NUM_RUNOUT_SENSORS > 3 && !PIN_EXISTS(FIL_RUNOUT4)
822
-    #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 3 requires FIL_RUNOUT4_PIN."
823
-  #elif NUM_RUNOUT_SENSORS > 4 && !PIN_EXISTS(FIL_RUNOUT5)
824
-    #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 4 requires FIL_RUNOUT5_PIN."
825
-  #elif NUM_RUNOUT_SENSORS > 5 && !PIN_EXISTS(FIL_RUNOUT6)
826
-    #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 5 requires FIL_RUNOUT6_PIN."
827
-  #elif NONE(SDSUPPORT, PRINTJOB_TIMER_AUTOSTART)
828
-    #error "FILAMENT_RUNOUT_SENSOR requires SDSUPPORT or PRINTJOB_TIMER_AUTOSTART."
815
+  #elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
816
+    #error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
817
+  #elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
818
+    #error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3."
819
+  #elif NUM_RUNOUT_SENSORS >= 4 && !PIN_EXISTS(FIL_RUNOUT4)
820
+    #error "FIL_RUNOUT4_PIN is required with NUM_RUNOUT_SENSORS >= 4."
821
+  #elif NUM_RUNOUT_SENSORS >= 5 && !PIN_EXISTS(FIL_RUNOUT5)
822
+    #error "FIL_RUNOUT5_PIN is required with NUM_RUNOUT_SENSORS >= 5."
823
+  #elif NUM_RUNOUT_SENSORS >= 6 && !PIN_EXISTS(FIL_RUNOUT6)
824
+    #error "FIL_RUNOUT6_PIN is required with NUM_RUNOUT_SENSORS >= 6."
825
+  #elif NUM_RUNOUT_SENSORS >= 7 && !PIN_EXISTS(FIL_RUNOUT7)
826
+    #error "FIL_RUNOUT7_PIN is required with NUM_RUNOUT_SENSORS >= 7."
827
+  #elif NUM_RUNOUT_SENSORS >= 8 && !PIN_EXISTS(FIL_RUNOUT8)
828
+    #error "FIL_RUNOUT8_PIN is required with NUM_RUNOUT_SENSORS >= 8."
829 829
   #elif FILAMENT_RUNOUT_DISTANCE_MM < 0
830 830
     #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
831 831
   #elif DISABLED(ADVANCED_PAUSE_FEATURE)

+ 2
- 2
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp View File

@@ -76,8 +76,8 @@ namespace Anycubic {
76 76
     #endif
77 77
 
78 78
     // Filament runout is handled by Marlin settings in Configuration.h
79
-    // set FIL_RUNOUT_STATE HIGH  // Pin state indicating that filament is NOT present.
80
-    // enable FIL_RUNOUT_PULLUP
79
+    // opt_set    FIL_RUNOUT_STATE HIGH  // Pin state indicating that filament is NOT present.
80
+    // opt_enable FIL_RUNOUT_PULL
81 81
 
82 82
     TFTSer.begin(115200);
83 83
 

+ 3
- 3
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp View File

@@ -87,7 +87,7 @@ void AnycubicTFTClass::OnSetup() {
87 87
     SET_INPUT_PULLUP(SD_DETECT_PIN);
88 88
   #endif
89 89
   #if ENABLED(FILAMENT_RUNOUT_SENSOR)
90
-    SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
90
+    SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
91 91
   #endif
92 92
 
93 93
   mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
@@ -935,7 +935,7 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() {
935 935
   #if ENABLED(FILAMENT_RUNOUT_SENSOR)
936 936
     // NOTE: ExtUI::getFilamentRunoutState() only returns the runout state if the job is printing
937 937
     // we want to actually check the status of the pin here, regardless of printstate
938
-    if (READ(FIL_RUNOUT_PIN)) {
938
+    if (READ(FIL_RUNOUT1_PIN)) {
939 939
       if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
940 940
         // play tone to indicate filament is out
941 941
         ExtUI::injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
@@ -983,7 +983,7 @@ void AnycubicTFTClass::PausePrint() {
983 983
 void AnycubicTFTClass::ResumePrint() {
984 984
   #if ENABLED(SDSUPPORT)
985 985
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
986
-      if (READ(FIL_RUNOUT_PIN)) {
986
+      if (READ(FIL_RUNOUT1_PIN)) {
987 987
         #if ENABLED(ANYCUBIC_LCD_DEBUG)
988 988
           SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
989 989
         #endif

+ 2
- 2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.cpp View File

@@ -92,12 +92,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
92 92
     PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
93 93
   #endif
94 94
   #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
95
-    PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT_STATE)
95
+    PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT1_STATE)
96 96
   #else
97 97
     PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
98 98
   #endif
99 99
   #if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2)
100
-    PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_STATE)
100
+    PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT2_STATE)
101 101
   #else
102 102
     PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
103 103
   #endif

+ 4
- 3
Marlin/src/module/endstops.cpp View File

@@ -459,18 +459,19 @@ void _O2 Endstops::report_states() {
459 459
   #endif
460 460
   #if HAS_FILAMENT_SENSOR
461 461
     #if NUM_RUNOUT_SENSORS == 1
462
-      print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
462
+      print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
463 463
     #else
464
-      #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
464
+      #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
465 465
       LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
466 466
         pin_t pin;
467
+        uint8_t state;
467 468
         switch (i) {
468 469
           default: continue;
469 470
           REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
470 471
         }
471 472
         SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
472 473
         if (i > 1) SERIAL_CHAR(' ', '0' + i);
473
-        print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE);
474
+        print_es_state(extDigitalRead(pin) != state);
474 475
       }
475 476
       #undef _CASE_RUNOUT
476 477
     #endif

+ 14
- 1
buildroot/tests/BIGTREE_GTR_V1_0-tests View File

@@ -24,7 +24,20 @@ opt_set E2_AUTO_FAN_PIN PC12
24 24
 opt_set X_DRIVER_TYPE TMC2208
25 25
 opt_set Y_DRIVER_TYPE TMC2130
26 26
 opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
27
-exec_test $1 $2 "BigTreeTech GTR 8 Extruders with Auto-Fan and Mixed TMC Drivers"
27
+opt_enable FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE
28
+opt_set FIL_RUNOUT_PIN 3
29
+opt_set FIL_RUNOUT2_PIN 4
30
+opt_set FIL_RUNOUT3_PIN 5
31
+opt_set FIL_RUNOUT4_PIN 6
32
+opt_set FIL_RUNOUT5_PIN 7
33
+opt_set FIL_RUNOUT6_PIN 8
34
+opt_set FIL_RUNOUT7_PIN 9
35
+opt_set FIL_RUNOUT8_PIN 10
36
+opt_set FIL_RUNOUT4_STATE HIGH
37
+opt_enable FIL_RUNOUT4_PULL
38
+opt_set FIL_RUNOUT8_STATE HIGH
39
+opt_enable FIL_RUNOUT8_PULL
40
+exec_test $1 $2 "BigTreeTech GTR 8 Extruders with Auto-Fan, Mixed TMC Drivers, and Runout Sensors with distinct states"
28 41
 
29 42
 restore_configs
30 43
 opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0

+ 15
- 0
buildroot/tests/mega2560-tests View File

@@ -76,6 +76,21 @@ opt_enable ZONESTAR_LCD Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_
76 76
 exec_test $1 $2 "RAMPS | ZONESTAR + Chinese | MMU2 | Servo | 3-Point + Debug | G38 ..."
77 77
 
78 78
 #
79
+# 5 runout sensors with distinct states
80
+#
81
+restore_configs
82
+opt_set EXTRUDERS 5
83
+opt_set NUM_SERVOS 1
84
+opt_enable ZONESTAR_LCD Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE BOOT_MARLIN_LOGO_ANIMATED \
85
+           AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL \
86
+           NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \
87
+           PRUSA_MMU2 MMU2_MENUS PRUSA_MMU2_S_MODE DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \
88
+           FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULL
89
+opt_set MIXING_STEPPERS 5
90
+opt_set FIL_RUNOUT3_STATE HIGH
91
+exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states"
92
+
93
+#
79 94
 # Test MINIRAMBO with PWM_MOTOR_CURRENT and many features
80 95
 #
81 96
 restore_configs

Loading…
Cancel
Save