diff --git a/Firmware/mmu2_fsensor.cpp b/Firmware/mmu2_fsensor.cpp index 1e03814f5..3d1bc8fb4 100644 --- a/Firmware/mmu2_fsensor.cpp +++ b/Firmware/mmu2_fsensor.cpp @@ -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