Move some Stepper methods to Planner (#10719)
This commit is contained in:
parent
8c81e6341a
commit
ea353c3df6
12 changed files with 139 additions and 136 deletions
|
|
@ -1950,12 +1950,6 @@ void Stepper::init() {
|
|||
set_directions(); // Init directions to last_direction_bits = 0
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Block until all buffered steps are executed / cleaned
|
||||
*/
|
||||
void Stepper::synchronize() { while (planner.has_blocks_queued() || cleaning_buffer_counter) idle(); }
|
||||
|
||||
/**
|
||||
* Set the stepper positions directly in steps
|
||||
*
|
||||
|
|
@ -2001,34 +1995,8 @@ int32_t Stepper::position(const AxisEnum axis) {
|
|||
return count_pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an axis position according to stepper position(s)
|
||||
* For CORE machines apply translation from ABC to XYZ.
|
||||
*/
|
||||
float Stepper::get_axis_position_mm(const AxisEnum axis) {
|
||||
float axis_steps;
|
||||
#if IS_CORE
|
||||
// Requesting one of the "core" axes?
|
||||
if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
|
||||
CRITICAL_SECTION_START;
|
||||
// ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
|
||||
// ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
|
||||
axis_steps = 0.5f * (
|
||||
axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
|
||||
: count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
|
||||
);
|
||||
CRITICAL_SECTION_END;
|
||||
}
|
||||
else
|
||||
axis_steps = position(axis);
|
||||
#else
|
||||
axis_steps = position(axis);
|
||||
#endif
|
||||
return axis_steps * planner.steps_to_mm[axis];
|
||||
}
|
||||
|
||||
void Stepper::finish_and_disable() {
|
||||
synchronize();
|
||||
planner.synchronize();
|
||||
disable_all_steppers();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue