Browse Source

Filament Runout Inverting => State (#18537)

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

+ 1
- 1
Marlin/Configuration.h View File

1167
 //#define FILAMENT_RUNOUT_SENSOR
1167
 //#define FILAMENT_RUNOUT_SENSOR
1168
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
1168
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
1169
   #define NUM_RUNOUT_SENSORS   1     // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
1169
   #define NUM_RUNOUT_SENSORS   1     // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
1170
-  #define FIL_RUNOUT_INVERTING false // Set to true to invert the logic of the sensor.
1170
+  #define FIL_RUNOUT_STATE     LOW   // Pin state indicating that filament is NOT present.
1171
   #define FIL_RUNOUT_PULLUP          // Use internal pullup for filament runout pins.
1171
   #define FIL_RUNOUT_PULLUP          // Use internal pullup for filament runout pins.
1172
   //#define FIL_RUNOUT_PULLDOWN      // Use internal pulldown for filament runout pins.
1172
   //#define FIL_RUNOUT_PULLDOWN      // Use internal pulldown for filament runout pins.
1173
 
1173
 

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

161
 }
161
 }
162
 
162
 
163
 #if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
163
 #if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
164
-  #define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING)
164
+  #define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE)
165
 #endif
165
 #endif
166
 
166
 
167
 void MMU2::mmu_loop() {
167
 void MMU2::mmu_loop() {

+ 1
- 1
Marlin/src/feature/runout.h View File

148
 
148
 
149
     // Return a bitmask of runout flag states (1 bits always indicates runout)
149
     // Return a bitmask of runout flag states (1 bits always indicates runout)
150
     static inline uint8_t poll_runout_states() {
150
     static inline uint8_t poll_runout_states() {
151
-      return poll_runout_pins() ^ uint8_t(TERN(FIL_RUNOUT_INVERTING, 0, _BV(NUM_RUNOUT_SENSORS) - 1));
151
+      return poll_runout_pins() ^ uint8_t(TERN(FIL_RUNOUT_STATE, 0, _BV(NUM_RUNOUT_SENSORS) - 1));
152
     }
152
     }
153
 };
153
 };
154
 
154
 

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

84
                               // In this case, for duplicating modes set DXC_ext to the extruder that ran out.
84
                               // In this case, for duplicating modes set DXC_ext to the extruder that ran out.
85
       #if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
85
       #if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
86
         if (dxc_is_duplicating())
86
         if (dxc_is_duplicating())
87
-          DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING) ? 1 : 0;
87
+          DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0;
88
       #else
88
       #else
89
         DXC_ext = active_extruder;
89
         DXC_ext = active_extruder;
90
       #endif
90
       #endif

+ 11
- 0
Marlin/src/inc/SanityCheck.h View File

513
   #error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
513
   #error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
514
 #endif
514
 #endif
515
 
515
 
516
+#ifdef FIL_RUNOUT_INVERTING
517
+  #if FIL_RUNOUT_INVERTING
518
+    #warning "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH. Please update Configuration.h."
519
+  #else
520
+    #warning "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW. Please update Configuration.h."
521
+  #endif
522
+  #ifndef FIL_RUNOUT_STATE
523
+    #define FIL_RUNOUT_STATE ((FIL_RUNOUT_INVERTING) ? HIGH : LOW)
524
+  #endif
525
+#endif
526
+
516
 /**
527
 /**
517
  * Probe temp compensation requirements
528
  * Probe temp compensation requirements
518
  */
529
  */

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

92
     PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
92
     PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
93
   #endif
93
   #endif
94
   #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
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_INVERTING)
95
+    PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT_STATE)
96
   #else
96
   #else
97
     PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
97
     PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
98
   #endif
98
   #endif
99
   #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) && EXTRUDERS > 1
99
   #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) && EXTRUDERS > 1
100
-    PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_INVERTING)
100
+    PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_STATE)
101
   #else
101
   #else
102
     PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
102
     PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
103
   #endif
103
   #endif

+ 2
- 2
Marlin/src/module/endstops.cpp View File

459
   #endif
459
   #endif
460
   #if HAS_FILAMENT_SENSOR
460
   #if HAS_FILAMENT_SENSOR
461
     #if NUM_RUNOUT_SENSORS == 1
461
     #if NUM_RUNOUT_SENSORS == 1
462
-      print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
462
+      print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
463
     #else
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; break;
465
       LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
465
       LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
470
         }
470
         }
471
         SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
471
         SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
472
         if (i > 1) SERIAL_CHAR(' ', '0' + i);
472
         if (i > 1) SERIAL_CHAR(' ', '0' + i);
473
-        print_es_state(extDigitalRead(pin) != FIL_RUNOUT_INVERTING);
473
+        print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE);
474
       }
474
       }
475
       #undef _CASE_RUNOUT
475
       #undef _CASE_RUNOUT
476
     #endif
476
     #endif

Loading…
Cancel
Save