Skip to content

Commit

Permalink
🎨 Minimize block->steps.set
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and tomek2k1 committed Jan 13, 2023
1 parent f8b4835 commit 586ec7c
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1976,22 +1976,24 @@ bool Planner::_populate_block(

// Number of steps for each axis
// See https://www.corexy.com/theory.html
#if CORE_IS_XY
block->steps.set(LINEAR_AXIS_LIST(ABS(da + db), ABS(da - db), ABS(dc), ABS(di), ABS(dj), ABS(dk)));
#elif CORE_IS_XZ
block->steps.set(LINEAR_AXIS_LIST(ABS(da + dc), ABS(db), ABS(da - dc), ABS(di), ABS(dj), ABS(dk)));
#elif CORE_IS_YZ
block->steps.set(LINEAR_AXIS_LIST(ABS(da), ABS(db + dc), ABS(db - dc), ABS(di), ABS(dj), ABS(dk)));
#elif ENABLED(MARKFORGED_XY)
block->steps.set(LINEAR_AXIS_LIST(ABS(da + db), ABS(db), ABS(dc), ABS(di), ABS(dj), ABS(dk)));
#elif ENABLED(MARKFORGED_YX)
block->steps.set(LINEAR_AXIS_LIST(ABS(da), ABS(db + da), ABS(dc), ABS(di), ABS(dj), ABS(dk)));
#elif IS_SCARA
block->steps.set(LINEAR_AXIS_LIST(ABS(da), ABS(db), ABS(dc), ABS(di), ABS(dj), ABS(dk)));
#else
// default non-h-bot planning
block->steps.set(LINEAR_AXIS_LIST(ABS(da), ABS(db), ABS(dc), ABS(di), ABS(dj), ABS(dk)));
#endif
block->steps.set(LINEAR_AXIS_LIST(
#if CORE_IS_XY
ABS(da + db), ABS(da - db), ABS(dc)
#elif CORE_IS_XZ
ABS(da + dc), ABS(db), ABS(da - dc)
#elif CORE_IS_YZ
ABS(da), ABS(db + dc), ABS(db - dc)
#elif ENABLED(MARKFORGED_XY)
ABS(da + db), ABS(db), ABS(dc)
#elif ENABLED(MARKFORGED_YX)
ABS(da), ABS(db + da), ABS(dc)
#elif IS_SCARA
ABS(da), ABS(db), ABS(dc)
#else // default non-h-bot planning
ABS(da), ABS(db), ABS(dc)
#endif
, ABS(di), ABS(dj), ABS(dk)
));

/**
* This part of the code calculates the total length of the movement.
Expand Down

0 comments on commit 586ec7c

Please sign in to comment.