Skip to content

Commit

Permalink
Fix issue 20224 by again supporting pull-up and pull-down again
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurt Haenen authored and Kurt Haenen committed Nov 20, 2020
1 parent 28e315c commit 4ddd2a5
Show file tree
Hide file tree
Showing 7 changed files with 406 additions and 396 deletions.
34 changes: 25 additions & 9 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1176,25 +1176,41 @@
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.

#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#define FIL_RUNOUT_PULL // Use internal pullup / pulldown for filament runout pins.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
// Override individually if the runout sensors vary
//#define FIL_RUNOUT1_STATE LOW
//#define FIL_RUNOUT1_PULL
//#define FIL_RUNOUT1_PULLUP
//#define FIL_RUNOUT1_PULLDOWN
//#define FIL_RUNOUT2_STATE LOW
//#define FIL_RUNOUT2_PULL
//#define FIL_RUNOUT2_PULLUP
//#define FIL_RUNOUT2_PULLDOWN
//#define FIL_RUNOUT3_STATE LOW
//#define FIL_RUNOUT3_PULL
//#define FIL_RUNOUT3_PULLUP
//#define FIL_RUNOUT3_PULLDOWN
//#define FIL_RUNOUT4_STATE LOW
//#define FIL_RUNOUT4_PULL
//#define FIL_RUNOUT4_PULLUP
//#define FIL_RUNOUT4_PULLDOWN
//#define FIL_RUNOUT5_STATE LOW
//#define FIL_RUNOUT5_PULL
//#define FIL_RUNOUT5_PULLUP
//#define FIL_RUNOUT5_PULLDOWN
//#define FIL_RUNOUT6_STATE LOW
//#define FIL_RUNOUT6_PULL
//#define FIL_RUNOUT6_PULLUP
//#define FIL_RUNOUT6_PULLDOWN
//#define FIL_RUNOUT7_STATE LOW
//#define FIL_RUNOUT7_PULL
//#define FIL_RUNOUT7_PULLUP
//#define FIL_RUNOUT7_PULLDOWN
//#define FIL_RUNOUT8_STATE LOW
//#define FIL_RUNOUT8_PULL
//#define FIL_RUNOUT8_PULLUP
//#define FIL_RUNOUT8_PULLDOWN
// Set one or more commands to execute on filament runout.
// (After 'M412 H' Marlin will ask the host to handle the process.)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class FilamentSensorBase {

public:
static inline void setup() {
#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)
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0)
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN)
#if NUM_RUNOUT_SENSORS >= 1
INIT_RUNOUT_PIN(1);
#endif
Expand Down
56 changes: 40 additions & 16 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,64 +708,88 @@
#ifndef FIL_RUNOUT1_STATE
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT1_PULL
#define FIL_RUNOUT1_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT1_PULLUP
#define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT1_PULLDOWN
#define FIL_RUNOUT1_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 2
#ifndef FIL_RUNOUT2_STATE
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT2_PULL
#define FIL_RUNOUT2_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT2_PULLUP
#define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT2_PULLDOWN
#define FIL_RUNOUT2_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 3
#ifndef FIL_RUNOUT3_STATE
#define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT3_PULL
#define FIL_RUNOUT3_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT3_PULLUP
#define FIL_RUNOUT3_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT3_PULLDOWN
#define FIL_RUNOUT3_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 4
#ifndef FIL_RUNOUT4_STATE
#define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT4_PULL
#define FIL_RUNOUT4_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT4_PULLUP
#define FIL_RUNOUT4_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT4_PULLDOWN
#define FIL_RUNOUT4_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 5
#ifndef FIL_RUNOUT5_STATE
#define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT5_PULL
#define FIL_RUNOUT5_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT5_PULLUP
#define FIL_RUNOUT5_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT5_PULLDOWN
#define FIL_RUNOUT5_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 6
#ifndef FIL_RUNOUT6_STATE
#define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT6_PULL
#define FIL_RUNOUT6_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT6_PULLUP
#define FIL_RUNOUT6_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT6_PULLDOWN
#define FIL_RUNOUT6_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 7
#ifndef FIL_RUNOUT7_STATE
#define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT7_PULL
#define FIL_RUNOUT7_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT7_PULLUP
#define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT7_PULLDOWN
#define FIL_RUNOUT7_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 8
#ifndef FIL_RUNOUT8_STATE
#define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT8_PULL
#define FIL_RUNOUT8_PULL FIL_RUNOUT_PULL
#ifndef FIL_RUNOUT8_PULLUP
#define FIL_RUNOUT8_PULLUP FIL_RUNOUT_PULLUP
#endif
#ifndef FIL_RUNOUT8_PULLDOWN
#define FIL_RUNOUT8_PULLDOWN FIL_RUNOUT_PULLDOWN
#endif
#endif
#endif // FILAMENT_RUNOUT_SENSOR
Expand Down
Loading

0 comments on commit 4ddd2a5

Please sign in to comment.