Fix poll_runout_states bug

This commit is contained in:
Scott Lahteine 2020-05-06 01:15:05 -05:00
parent a4c981469e
commit 544b16639e

View file

@ -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)