Implement fsensor raii event suppression

This commit is contained in:
Alex Voinea 2022-04-21 15:48:06 +02:00 committed by D.R.racer
parent 1211ad9360
commit 74fad4f8f6
1 changed files with 16 additions and 3 deletions

View File

@ -7,8 +7,21 @@ FilamentState WhereIsFilament(){
return fsensor.getFilamentPresent() ? FilamentState::IN_NOZZLE : FilamentState::NOT_PRESENT;
}
// on AVR this does nothing
BlockRunoutRAII::BlockRunoutRAII() { }
BlockRunoutRAII::~BlockRunoutRAII() { }
BlockRunoutRAII::BlockRunoutRAII() {
#ifdef FILAMENT_SENSOR
fsensor.setRunoutEnabled(false); //suppress filament runouts while loading filament.
fsensor.setAutoLoadEnabled(false); //suppress filament autoloads while loading filament.
#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
fsensor.setJamDetectionEnabled(false); //suppress filament jam detection while loading filament.
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
#endif
}
BlockRunoutRAII::~BlockRunoutRAII() {
#ifdef FILAMENT_SENSOR
fsensor.settings_init(); // restore filament runout state.
#endif
}
} // namespace MMU2