Skip to content

Commit

Permalink
Update planner.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 4, 2020
1 parent b80a4ae commit 8806d20
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Marlin/src/module/planner.cpp
Expand Up @@ -1614,6 +1614,7 @@ void Planner::finish_and_disable() {
float Planner::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) {

Expand All @@ -1631,28 +1632,30 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {
}
else
axis_steps = stepper.position(axis);

#elif IS_MARKFORGED
// Requesting one of the "core" axes?
if (axis == MARKFORGED_AXIS_X || axis == MARKFORGED_AXIS_Y)
{

// Requesting one of the joined axes?
if (axis == MARKFORGED_AXIS_X || axis == MARKFORGED_AXIS_Y) {
// Protect the access to the position.
const bool was_enabled = stepper.suspend();

const int32_t p1 = stepper.position(MARKFORGED_AXIS_X),
p2 = stepper.position(MARKFORGED_AXIS_Y);

if (was_enabled)
stepper.wake_up();
if (was_enabled) stepper.wake_up();

axis_steps = ((axis == MARKFORGED_AXIS_X) ? p1 - p2 : p2);
}
else
axis_steps = stepper.position(axis);

#else

axis_steps = stepper.position(axis);

#endif

return axis_steps * steps_to_mm[axis];
}

Expand Down Expand Up @@ -1771,7 +1774,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
" E:", target.e, " (", de, " steps)"
#endif
);
//*/
//*/

#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
if (de) {
Expand Down Expand Up @@ -1886,8 +1889,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/
struct DistanceMM : abce_float_t {
TERN_(IS_CORE, xyz_pos_t head);
TERN_(IS_MARKFORGED, xyz_pos_t head);
#if IS_CORE || IS_MARKFORGED
xyz_pos_t head;
#endif
} steps_dist_mm;
#if IS_CORE
#if CORE_IS_XY
Expand Down

0 comments on commit 8806d20

Please sign in to comment.