Skip to content

Commit

Permalink
Fix poll_runout_states bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and Emmanuel Viala committed Aug 21, 2020
1 parent c93e418 commit 512fe20
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class FilamentSensorBase {
#define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN);
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT)
#undef _INIT_RUNOUT
#undef INIT_RUNOUT_PIN
}

// Return a bitmask of runout pin states
Expand All @@ -151,10 +152,8 @@ class FilamentSensorBase {

// Return a bitmask of runout flag states (1 bits always indicates runout)
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)
Expand Down

0 comments on commit 512fe20

Please sign in to comment.