Improve FILAMENT_RUNOUT_SENSOR, FILRUNOUT_PIN

This commit is contained in:
Scott Lahteine 2016-06-19 18:05:57 -07:00
parent 43ec24158e
commit add0032820
4 changed files with 26 additions and 11 deletions

View File

@ -686,15 +686,17 @@ void setup_killpin() {
#endif #endif
} }
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
void setup_filrunoutpin() { void setup_filrunoutpin() {
#if HAS_FILRUNOUT
pinMode(FILRUNOUT_PIN, INPUT); pinMode(FILRUNOUT_PIN, INPUT);
#if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT) #if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT)
WRITE(FILRUNOUT_PIN, HIGH); WRITE(FILRUNOUT_PIN, HIGH);
#endif #endif
#endif
} }
#endif
// Set home pin // Set home pin
void setup_homepin(void) { void setup_homepin(void) {
#if HAS_HOME #if HAS_HOME
@ -802,8 +804,12 @@ void setup() {
MCUCR = 0x80; MCUCR = 0x80;
#endif #endif
setup_killpin(); #if ENABLED(FILAMENT_RUNOUT_SENSOR)
setup_filrunoutpin(); setup_filrunoutpin();
#endif
setup_killpin();
setup_powerhold(); setup_powerhold();
#if HAS_STEPPER_RESET #if HAS_STEPPER_RESET
@ -8144,7 +8150,7 @@ void idle(
*/ */
void manage_inactivity(bool ignore_stepper_queue/*=false*/) { void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#if HAS_FILRUNOUT #if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING)) if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
handle_filament_runout(); handle_filament_runout();
#endif #endif

View File

@ -124,6 +124,17 @@
#endif #endif
#endif #endif
/**
* Filament Runout needs a pin and SD Support
*/
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if !HAS_FILRUNOUT
#error "FILAMENT_RUNOUT_SENSOR requires FILRUNOUT_PIN."
#elif DISABLED(SDSUPPORT)
#error "FILAMENT_RUNOUT_SENSOR requires SDSUPPORT."
#endif
#endif
/** /**
* Filament Change with Extruder Runout Prevention * Filament Change with Extruder Runout Prevention
*/ */

View File

@ -67,7 +67,7 @@
//common I/O //common I/O
//#define TEMP_CHAMBER_PIN 13 // ANALOG INPUT !! //#define TEMP_CHAMBER_PIN 13 // ANALOG INPUT !!
//#define FILAMENT_RUNOUT_SENSOR 18 #define FILRUNOUT_PIN 18
//#define PWM_1_PIN 12 //#define PWM_1_PIN 12
//#define PWM_2_PIN 13 //#define PWM_2_PIN 13
//#define SPARE_IO 17 //#define SPARE_IO 17

View File

@ -98,10 +98,8 @@
#define Z_MIN_PROBE_PIN 32 #define Z_MIN_PROBE_PIN 32
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
#define FILRUNOUT_PIN 4 #define FILRUNOUT_PIN 4
#endif
#if MB(RAMPS_14_EFF) || MB(RAMPS_13_EFF) || ENABLED(IS_RAMPS_EFB) #if MB(RAMPS_14_EFF) || MB(RAMPS_13_EFF) || ENABLED(IS_RAMPS_EFB)
#define FAN_PIN 9 // (Sprinter config) #define FAN_PIN 9 // (Sprinter config)