Fix poll_runout_states bug

2.0.x
Scott Lahteine 5 years ago
parent a4c981469e
commit 544b16639e

@ -140,6 +140,7 @@ class FilamentSensorBase {
#define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN); #define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN);
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT) REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT)
#undef _INIT_RUNOUT #undef _INIT_RUNOUT
#undef INIT_RUNOUT_PIN
} }
// Return a bitmask of runout pin states // Return a bitmask of runout pin states
@ -151,10 +152,8 @@ 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(TERN0(FIL_RUNOUT_INVERTING, _BV(NUM_RUNOUT_SENSORS) - 1)); return poll_runout_pins() ^ uint8_t(TERN(FIL_RUNOUT_INVERTING, 0, _BV(NUM_RUNOUT_SENSORS) - 1));
} }
#undef INIT_RUNOUT_PIN
}; };
#if ENABLED(FILAMENT_MOTION_SENSOR) #if ENABLED(FILAMENT_MOTION_SENSOR)

Loading…
Cancel
Save