Browse Source

PFW-1457 make CHECK_FSENSOR into a function

Guðni Már Gilbert 2 years ago
parent
commit
4c32e8b403
3 changed files with 10 additions and 3 deletions
  1. 1 2
      Firmware/Marlin.h
  2. 8 0
      Firmware/Marlin_main.cpp
  3. 1 1
      Firmware/mmu2.cpp

+ 1 - 2
Firmware/Marlin.h

@@ -22,7 +22,6 @@
 #include "pins.h"
 #include "pins.h"
 #include "Timer.h"
 #include "Timer.h"
 #include "mmu2.h"
 #include "mmu2.h"
-#include "cardreader.h" // for IS_SD_PRINTING
 extern uint8_t mbl_z_probe_nr;
 extern uint8_t mbl_z_probe_nr;
 
 
 #ifndef AT90USB
 #ifndef AT90USB
@@ -364,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
 //! 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
 //! 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 :)
 //! 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();
 extern void calculate_extruder_multipliers();
 
 

+ 8 - 0
Firmware/Marlin_main.cpp

@@ -563,6 +563,14 @@ bool __attribute__((noinline)) printer_active() {
         || mesh_bed_leveling_flag;
         || 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;
 bool fans_check_enabled = true;
 
 
 #ifdef TMC2130
 #ifdef TMC2130

+ 1 - 1
Firmware/mmu2.cpp

@@ -245,7 +245,7 @@ void __attribute__((noinline)) MMU2::mmu_loop_inner(bool reportErrors) {
 
 
 void MMU2::CheckFINDARunout() {
 void MMU2::CheckFINDARunout() {
     // Check for FINDA filament runout
     // Check for FINDA filament runout
-    if (!FindaDetectsFilament() && CHECK_FSENSOR) {
+    if (!FindaDetectsFilament() && check_fsensor()) {
         SERIAL_ECHOLNPGM("FINDA filament runout!");
         SERIAL_ECHOLNPGM("FINDA filament runout!");
         stop_and_save_print_to_ram(0, 0);
         stop_and_save_print_to_ram(0, 0);
         restore_print_from_ram_and_continue(0);
         restore_print_from_ram_and_continue(0);