Browse Source

🏗️ Planner::busy() (#23145)

espr14 3 years ago
parent
commit
44d8c2f5bf
No account linked to committer's email address
2 changed files with 13 additions and 10 deletions
  1. 2
    10
      Marlin/src/module/planner.cpp
  2. 11
    0
      Marlin/src/module/planner.h

+ 2
- 10
Marlin/src/module/planner.cpp View File

@@ -91,10 +91,6 @@
91 91
   #include "../feature/power.h"
92 92
 #endif
93 93
 
94
-#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
95
-  #include "../feature/closedloop.h"
96
-#endif
97
-
98 94
 #if ENABLED(BACKLASH_COMPENSATION)
99 95
   #include "../feature/backlash.h"
100 96
 #endif
@@ -1763,13 +1759,9 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {
1763 1759
 }
1764 1760
 
1765 1761
 /**
1766
- * Block until all buffered steps are executed / cleaned
1762
+ * Block until the planner is finished processing
1767 1763
  */
1768
-void Planner::synchronize() {
1769
-  while (has_blocks_queued() || cleaning_buffer_counter
1770
-      || TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
1771
-  ) idle();
1772
-}
1764
+void Planner::synchronize() { while (busy()) idle(); }
1773 1765
 
1774 1766
 /**
1775 1767
  * Planner::_buffer_steps

+ 11
- 0
Marlin/src/module/planner.h View File

@@ -75,6 +75,10 @@
75 75
   #define IS_PAGE(B) false
76 76
 #endif
77 77
 
78
+#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
79
+  #include "../feature/closedloop.h"
80
+#endif
81
+
78 82
 // Feedrate for manual moves
79 83
 #ifdef MANUAL_FEEDRATE
80 84
   constexpr xyze_feedrate_t _mf = MANUAL_FEEDRATE,
@@ -865,6 +869,13 @@ class Planner {
865 869
     // Triggered position of an axis in mm (not core-savvy)
866 870
     static float triggered_position_mm(const AxisEnum axis);
867 871
 
872
+    // Blocks are queued, or we're running out moves, or the closed loop controller is waiting
873
+    static inline bool busy() {
874
+      return (has_blocks_queued() || cleaning_buffer_counter
875
+          || TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
876
+      );
877
+    }
878
+    
868 879
     // Block until all buffered steps are executed / cleaned
869 880
     static void synchronize();
870 881
 

Loading…
Cancel
Save