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
   #include "../feature/power.h"
91
   #include "../feature/power.h"
92
 #endif
92
 #endif
93
 
93
 
94
-#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
95
-  #include "../feature/closedloop.h"
96
-#endif
97
-
98
 #if ENABLED(BACKLASH_COMPENSATION)
94
 #if ENABLED(BACKLASH_COMPENSATION)
99
   #include "../feature/backlash.h"
95
   #include "../feature/backlash.h"
100
 #endif
96
 #endif
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
  * Planner::_buffer_steps
1767
  * Planner::_buffer_steps

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

75
   #define IS_PAGE(B) false
75
   #define IS_PAGE(B) false
76
 #endif
76
 #endif
77
 
77
 
78
+#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
79
+  #include "../feature/closedloop.h"
80
+#endif
81
+
78
 // Feedrate for manual moves
82
 // Feedrate for manual moves
79
 #ifdef MANUAL_FEEDRATE
83
 #ifdef MANUAL_FEEDRATE
80
   constexpr xyze_feedrate_t _mf = MANUAL_FEEDRATE,
84
   constexpr xyze_feedrate_t _mf = MANUAL_FEEDRATE,
865
     // Triggered position of an axis in mm (not core-savvy)
869
     // Triggered position of an axis in mm (not core-savvy)
866
     static float triggered_position_mm(const AxisEnum axis);
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
     // Block until all buffered steps are executed / cleaned
879
     // Block until all buffered steps are executed / cleaned
869
     static void synchronize();
880
     static void synchronize();
870
 
881
 

Loading…
Cancel
Save