|
|
@ -186,7 +186,8 @@ class FilamentSensorBase {
|
|
|
|
old_state = new_state;
|
|
|
|
old_state = new_state;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
|
|
|
|
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
|
|
|
|
if (change) SERIAL_PROTOCOLLNPAIR("Motion detected: ", int(change));
|
|
|
|
for (uint8_t e = 0; e < EXTRUDERS; e++)
|
|
|
|
|
|
|
|
if (TEST(change, e)) SERIAL_PROTOCOLLNPAIR("Motion detected T", e);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
motion_detected |= change;
|
|
|
|
motion_detected |= change;
|
|
|
@ -295,9 +296,12 @@ class FilamentSensorBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void block_completed(const block_t* const b) {
|
|
|
|
static inline void block_completed(const block_t* const b) {
|
|
|
|
const uint8_t e = b->extruder;
|
|
|
|
if (b->steps[X_AXIS] || b->steps[Y_AXIS] || b->steps[Z_AXIS]) {
|
|
|
|
const int32_t steps = b->steps[E_AXIS];
|
|
|
|
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
|
|
|
|
runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.steps_to_mm[E_AXIS_N(e)];
|
|
|
|
const uint8_t e = b->extruder;
|
|
|
|
|
|
|
|
const int32_t steps = b->steps[E_AXIS];
|
|
|
|
|
|
|
|
runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.steps_to_mm[E_AXIS_N(e)];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|