Переглянути джерело

🩹 Prevent Z error with UBL + Park unscaled E move (#23568)

Bob Kuhn 3 роки тому
джерело
коміт
668020777f
Аккаунт користувача з таким Email не знайдено
1 змінених файлів з 19 додано та 0 видалено
  1. 19
    0
      Marlin/src/feature/pause.cpp

+ 19
- 0
Marlin/src/feature/pause.cpp Переглянути файл

39
 #include "../module/printcounter.h"
39
 #include "../module/printcounter.h"
40
 #include "../module/temperature.h"
40
 #include "../module/temperature.h"
41
 
41
 
42
+#if ENABLED(AUTO_BED_LEVELING_UBL)
43
+  #include "bedlevel/bedlevel.h"
44
+#endif
45
+
42
 #if ENABLED(FWRETRACT)
46
 #if ENABLED(FWRETRACT)
43
   #include "fwretract.h"
47
   #include "fwretract.h"
44
 #endif
48
 #endif
440
   // Initial retract before move to filament change position
444
   // Initial retract before move to filament change position
441
   if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
445
   if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
442
     DEBUG_ECHOLNPGM("... retract:", retract);
446
     DEBUG_ECHOLNPGM("... retract:", retract);
447
+
448
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
449
+      const bool leveling_was_enabled = planner.leveling_active; // save leveling state
450
+      set_bed_leveling_enabled(false);  // turn off leveling
451
+    #endif
452
+
443
     unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
453
     unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
454
+
455
+    TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
444
   }
456
   }
445
 
457
 
446
   // If axes don't need to home then the nozzle can park
458
   // If axes don't need to home then the nozzle can park
640
     prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
652
     prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
641
   }
653
   }
642
 
654
 
655
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
656
+    const bool leveling_was_enabled = planner.leveling_active; // save leveling state
657
+    set_bed_leveling_enabled(false);  // turn off leveling
658
+  #endif
659
+
643
   // Unretract
660
   // Unretract
644
   unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
661
   unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
645
 
662
 
663
+  TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
664
+
646
   // Intelligent resuming
665
   // Intelligent resuming
647
   #if ENABLED(FWRETRACT)
666
   #if ENABLED(FWRETRACT)
648
     // If retracted before goto pause
667
     // If retracted before goto pause

Завантаження…
Відмінити
Зберегти