Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add busy() to planner #23145

Merged
merged 2 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
#include "../feature/power.h"
#endif

#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
#include "../feature/closedloop.h"
#endif

#if ENABLED(BACKLASH_COMPENSATION)
#include "../feature/backlash.h"
#endif
Expand Down Expand Up @@ -1717,13 +1713,9 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {
}

/**
* Block until all buffered steps are executed / cleaned
* Block until the planner is finished processing
*/
void Planner::synchronize() {
while (has_blocks_queued() || cleaning_buffer_counter
|| TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
) idle();
}
void Planner::synchronize() { while (busy()) idle(); }

/**
* Planner::_buffer_steps
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/module/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
#define IS_PAGE(B) false
#endif

#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
#include "../feature/closedloop.h"
#endif

// Feedrate for manual moves
#ifdef MANUAL_FEEDRATE
constexpr xyze_feedrate_t _mf = MANUAL_FEEDRATE,
Expand Down Expand Up @@ -879,6 +883,13 @@ class Planner {
// Triggered position of an axis in mm (not core-savvy)
static float triggered_position_mm(const AxisEnum axis);

// Blocks are queued, or we're running out moves, or the closed loop controller is waiting
static inline bool busy() {
return (has_blocks_queued() || cleaning_buffer_counter
|| TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
);
}

// Block until all buffered steps are executed / cleaned
static void synchronize();

Expand Down