Filament Runout Inverting => State (#18537)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
c8f7aceb20
commit
c02451b602
@ -1167,7 +1167,7 @@
|
|||||||
//#define FILAMENT_RUNOUT_SENSOR
|
//#define FILAMENT_RUNOUT_SENSOR
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
||||||
#define FIL_RUNOUT_INVERTING false // Set to true to invert the logic of the sensor.
|
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
|
||||||
#define FIL_RUNOUT_PULLUP // Use internal pullup 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.
|
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ uint8_t MMU2::get_current_tool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
|
#if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
|
||||||
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING)
|
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MMU2::mmu_loop() {
|
void MMU2::mmu_loop() {
|
||||||
|
@ -148,7 +148,7 @@ class FilamentSensorBase {
|
|||||||
|
|
||||||
// Return a bitmask of runout flag states (1 bits always indicates runout)
|
// Return a bitmask of runout flag states (1 bits always indicates runout)
|
||||||
static inline uint8_t poll_runout_states() {
|
static inline uint8_t poll_runout_states() {
|
||||||
return poll_runout_pins() ^ uint8_t(TERN(FIL_RUNOUT_INVERTING, 0, _BV(NUM_RUNOUT_SENSORS) - 1));
|
return poll_runout_pins() ^ uint8_t(TERN(FIL_RUNOUT_STATE, 0, _BV(NUM_RUNOUT_SENSORS) - 1));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void GcodeSuite::M600() {
|
|||||||
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
||||||
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
|
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
|
||||||
if (dxc_is_duplicating())
|
if (dxc_is_duplicating())
|
||||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING) ? 1 : 0;
|
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0;
|
||||||
#else
|
#else
|
||||||
DXC_ext = active_extruder;
|
DXC_ext = active_extruder;
|
||||||
#endif
|
#endif
|
||||||
|
@ -513,6 +513,17 @@
|
|||||||
#error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
|
#error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FIL_RUNOUT_INVERTING
|
||||||
|
#if FIL_RUNOUT_INVERTING
|
||||||
|
#warning "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH. Please update Configuration.h."
|
||||||
|
#else
|
||||||
|
#warning "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW. Please update Configuration.h."
|
||||||
|
#endif
|
||||||
|
#ifndef FIL_RUNOUT_STATE
|
||||||
|
#define FIL_RUNOUT_STATE ((FIL_RUNOUT_INVERTING) ? HIGH : LOW)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Probe temp compensation requirements
|
* Probe temp compensation requirements
|
||||||
*/
|
*/
|
||||||
|
@ -92,12 +92,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
|
|||||||
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
|
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
|
||||||
PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT_INVERTING)
|
PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT_STATE)
|
||||||
#else
|
#else
|
||||||
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
|
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) && EXTRUDERS > 1
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) && EXTRUDERS > 1
|
||||||
PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_INVERTING)
|
PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_STATE)
|
||||||
#else
|
#else
|
||||||
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
|
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
|
||||||
#endif
|
#endif
|
||||||
|
@ -459,7 +459,7 @@ void _O2 Endstops::report_states() {
|
|||||||
#endif
|
#endif
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
#if NUM_RUNOUT_SENSORS == 1
|
#if NUM_RUNOUT_SENSORS == 1
|
||||||
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
|
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
|
||||||
#else
|
#else
|
||||||
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
|
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
|
||||||
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
|
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
|
||||||
@ -470,7 +470,7 @@ void _O2 Endstops::report_states() {
|
|||||||
}
|
}
|
||||||
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
|
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
|
||||||
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
||||||
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_INVERTING);
|
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE);
|
||||||
}
|
}
|
||||||
#undef _CASE_RUNOUT
|
#undef _CASE_RUNOUT
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user