From 91a23e27e1b28c50dc4ab32a3a692c62924efa7f Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Fri, 19 May 2023 13:35:28 +0200 Subject: [PATCH 1/2] Fix IRsensor with MMU saves 38bytes --- Firmware/ultralcd.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index eafcb26e7eb9..5c2b7e2eb81b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5884,9 +5884,6 @@ bool lcd_selftest() if (!MMU2::mmu2.Enabled()) { lcd_detect_IRsensor(); } - else { - fsensor.setSensorRevision(IR_sensor_analog::SensorRevision::_Old, true); - } } #endif lcd_wait_for_cool_down(); @@ -6669,6 +6666,7 @@ static bool lcd_selftest_fsensor(void) //! @retval false failed static bool selftest_irsensor() { + set_extrude_min_temp(0); class TempBackup { public: @@ -6679,13 +6677,10 @@ static bool selftest_irsensor() float m_temp; }; uint8_t progress; - { - TempBackup tempBackup; - setTargetHotend(ABS_PREHEAT_HOTEND_TEMP); - progress = lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0); - } - progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0); - MMU2::mmu2.unload(); + progress = lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0); + MMU2::mmu2.tool_change(0); //Allow cold extrusion only loads to the gears not nozzle + MMU2::mmu2.unload(); //Unload filament + set_extrude_min_temp(EXTRUDE_MINTEMP); for(uint_least8_t i = 0; i < 200; ++i) { From 9b4c8e9c9d5a8f12afa5563c2a53f933da92db31 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Tue, 23 May 2023 10:39:05 +0200 Subject: [PATCH 2/2] Thanks to @gudnimg --- Firmware/ultralcd.cpp | 47 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5c2b7e2eb81b..ba2ba7115406 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6666,48 +6666,17 @@ static bool lcd_selftest_fsensor(void) //! @retval false failed static bool selftest_irsensor() { + // Ask user which slot to load filament from + uint8_t slot = choose_menu_P(_T(MSG_SELECT_FILAMENT), _T(MSG_FILAMENT)); + + // Render self-test screen + lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0); + + // Run self-test set_extrude_min_temp(0); - class TempBackup - { - public: - TempBackup(): - m_temp(degTargetHotend(active_extruder)){} - ~TempBackup(){setTargetHotend(m_temp);} - private: - float m_temp; - }; - uint8_t progress; - progress = lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0); - MMU2::mmu2.tool_change(0); //Allow cold extrusion only loads to the gears not nozzle + MMU2::mmu2.tool_change(slot); MMU2::mmu2.unload(); //Unload filament set_extrude_min_temp(EXTRUDE_MINTEMP); - - for(uint_least8_t i = 0; i < 200; ++i) - { - if (0 == (i % 32)) progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0); - -//@@TODO mmu_load_step(false); - while (blocks_queued()) - { - if (fsensor.getFilamentPresent()) - { - lcd_selftest_error(TestError::TriggeringFsensor, "", ""); - return false; - } -#ifdef TMC2130 - manage_heater(); - // Vojtech: Don't disable motors inside the planner! - if (!tmc2130_update_sg()) - { - manage_inactivity(true); - } -#else //TMC2130 - manage_heater(); - // Vojtech: Don't disable motors inside the planner! - manage_inactivity(true); -#endif //TMC2130 - } - } return true; } #endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)