Просмотр исходного кода

Merge pull request #3837 from gudnimg/PFW-1457

PFW-1457 Do not unload at start of First Layer Cal
Guðni Már Gilbert 2 лет назад
Родитель
Сommit
b66d6d354f
3 измененных файлов с 12 добавлено и 5 удалено
  1. 1 1
      Firmware/Marlin.h
  2. 8 0
      Firmware/Marlin_main.cpp
  3. 3 4
      Firmware/mmu2.cpp

+ 1 - 1
Firmware/Marlin.h

@@ -363,7 +363,7 @@ extern bool printer_active();
 //! Instead, the fsensor uses another state variable :( , which is set to true, when the M600 command is enqued
 //! and is reset to false when the fsensor returns into its filament runout finished handler
 //! I'd normally change this macro, but who knows what would happen in the MMU :)
-#define CHECK_FSENSOR ((IS_SD_PRINTING || usb_timer.running()) && (mcode_in_progress != 600) && !saved_printing && e_active())
+bool check_fsensor();
 
 extern void calculate_extruder_multipliers();
 

+ 8 - 0
Firmware/Marlin_main.cpp

@@ -563,6 +563,14 @@ bool __attribute__((noinline)) printer_active() {
         || mesh_bed_leveling_flag;
 }
 
+// Currently only used in one place, allowed to be inlined
+bool check_fsensor() {
+    return (IS_SD_PRINTING || usb_timer.running())
+        && mcode_in_progress != 600
+        && !saved_printing
+        && e_active();
+}
+
 bool fans_check_enabled = true;
 
 #ifdef TMC2130

+ 3 - 4
Firmware/mmu2.cpp

@@ -14,7 +14,6 @@
 #include "strlen_cx.h"
 #include "temperature.h"
 #include "ultralcd.h"
-#include "cardreader.h" // for IS_SD_PRINTING
 #include "SpoolJoin.h"
 
 // As of FW 3.12 we only support building the FW with only one extruder, all the multi-extruder infrastructure will be removed.
@@ -246,7 +245,7 @@ void __attribute__((noinline)) MMU2::mmu_loop_inner(bool reportErrors) {
 
 void MMU2::CheckFINDARunout() {
     // Check for FINDA filament runout
-    if (!FindaDetectsFilament() && CHECK_FSENSOR) {
+    if (!FindaDetectsFilament() && check_fsensor()) {
         SERIAL_ECHOLNPGM("FINDA filament runout!");
         stop_and_save_print_to_ram(0, 0);
         restore_print_from_ram_and_continue(0);
@@ -384,9 +383,9 @@ bool MMU2::tool_change(uint8_t slot) {
         return false;
 
     if (slot != extruder) {
-        if (!IS_SD_PRINTING && !usb_timer.running()) {
+        if (FindaDetectsFilament()) {
             // If Tcodes are used manually through the serial
-            // we need to unload manually as well
+            // we need to unload manually as well -- but only if FINDA detects filament
             unload();
         }