Rejigger Filament Runout class (#12428)

This commit is contained in:
Scott Lahteine
2018-11-14 11:45:57 -06:00
committed by GitHub
parent f4c128ecaa
commit edfd106bc5
4 changed files with 153 additions and 118 deletions

View File

@@ -30,23 +30,29 @@
#include "runout.h"
FilamentRunoutSensor runout;
FilamentMonitor runout;
bool FilamentSensorBase::enabled = true,
FilamentSensorBase::filament_ran_out; // = false
bool FilamentMonitorBase::enabled = true,
FilamentMonitorBase::filament_ran_out; // = false
void FilamentSensorTypeBase::filament_present(const uint8_t extruder) {
runout.filament_present(extruder);
/**
* Called by FilamentSensorSwitch::run when filament is detected.
* Called by FilamentSensorEncoder::block_completed when motion is detected.
*/
void FilamentSensorBase::filament_present(const uint8_t extruder) {
runout.filament_present(extruder); // calls response.filament_present(extruder)
}
uint8_t FilamentSensorTypeEncoder::motion_detected,
FilamentSensorTypeEncoder::old_state; // = 0
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected,
FilamentSensorEncoder::old_state; // = 0
#endif
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
int32_t RunoutResponseDelayed::steps_since_detection[EXTRUDERS];
volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS];
#else
uint8_t RunoutResponseDebounced::runout_count; // = 0
int8_t RunoutResponseDebounced::runout_count; // = 0
#endif
#endif // FILAMENT_RUNOUT_SENSOR