From 373fab883d0effe3d6b9394f76f53815c07b3b5a Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Wed, 29 Mar 2023 09:41:14 +0200 Subject: [PATCH] Fix fsensor runout conditions And also reorder autoload and runout conditions --- Firmware/Filament_sensor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Firmware/Filament_sensor.cpp b/Firmware/Filament_sensor.cpp index f4ec2184f..2c91822d5 100644 --- a/Firmware/Filament_sensor.cpp +++ b/Firmware/Filament_sensor.cpp @@ -109,9 +109,9 @@ bool Filament_sensor::checkFilamentEvents() { void Filament_sensor::triggerFilamentInserted() { if (autoLoadEnabled && (eFilamentAction == FilamentAction::None) - && (! MMU2::mmu2.Enabled() ) // quick and dirty hack to prevent spurious runouts while the MMU is in charge && !( - moves_planned() != 0 + MMU2::mmu2.Enabled() // quick and dirty hack to prevent spurious runouts while the MMU is in charge + || moves_planned() != 0 || printJobOngoing() || (lcd_commands_type == LcdCommands::Layer1Cal) || eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE) @@ -124,12 +124,14 @@ void Filament_sensor::triggerFilamentInserted() { void Filament_sensor::triggerFilamentRemoved() { // SERIAL_ECHOLNPGM("triggerFilamentRemoved"); if (runoutEnabled - && (! MMU2::mmu2.Enabled() ) // quick and dirty hack to prevent spurious runouts just before the toolchange && (eFilamentAction == FilamentAction::None) - && !saved_printing && ( moves_planned() != 0 || printJobOngoing() + ) + && !( + saved_printing + || MMU2::mmu2.Enabled() // quick and dirty hack to prevent spurious runouts just before the toolchange || (lcd_commands_type == LcdCommands::Layer1Cal) || eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE) )