Skip to content

Commit

Permalink
🎨 Planner indent
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 22, 2023
1 parent dbdb2ec commit 2c5468c
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,15 @@ void Planner::init() {
position.reset();
TERN_(HAS_POSITION_FLOAT, position_float.reset());
TERN_(IS_KINEMATIC, position_cart.reset());

previous_speed.reset();
previous_nominal_speed = 0;

TERN_(ABL_PLANAR, bed_level_matrix.set_to_identity());

clear_block_buffer();
delay_before_delivering = 0;

#if ENABLED(DIRECT_STEPPING)
last_page_step_rate = 0;
last_page_dir.reset();
Expand Down Expand Up @@ -1970,23 +1974,21 @@ bool Planner::_populate_block(
dm.hy = (dist.b > 0); // ...and Y
TERN_(HAS_Z_AXIS, dm.z = (dist.c > 0));
#endif
#if IS_CORE
#if CORE_IS_XY
dm.a = (dist.a + dist.b > 0); // Motor A direction
dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction
#elif CORE_IS_XZ
dm.hx = (dist.a > 0); // Save the toolhead's true direction in X
dm.y = (dist.b > 0);
dm.hz = (dist.c > 0); // ...and Z
dm.a = (dist.a + dist.c > 0); // Motor A direction
dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction
#elif CORE_IS_YZ
dm.x = (dist.a > 0);
dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y
dm.hz = (dist.c > 0); // ...and Z
dm.b = (dist.b + dist.c > 0); // Motor B direction
dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction
#endif
#if CORE_IS_XY
dm.a = (dist.a + dist.b > 0); // Motor A direction
dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction
#elif CORE_IS_XZ
dm.hx = (dist.a > 0); // Save the toolhead's true direction in X
dm.y = (dist.b > 0);
dm.hz = (dist.c > 0); // ...and Z
dm.a = (dist.a + dist.c > 0); // Motor A direction
dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction
#elif CORE_IS_YZ
dm.x = (dist.a > 0);
dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y
dm.hz = (dist.c > 0); // ...and Z
dm.b = (dist.b + dist.c > 0); // Motor B direction
dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction
#elif ENABLED(MARKFORGED_XY)
dm.a = (dist.a TERN(MARKFORGED_INVERSE, -, +) dist.b > 0); // Motor A direction
dm.b = (dist.b > 0); // Motor B direction
Expand Down Expand Up @@ -2090,23 +2092,21 @@ bool Planner::_populate_block(
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
TERN_(HAS_Z_AXIS, dist_mm.z = dist.c * mm_per_step[Z_AXIS]);
#endif
#if IS_CORE
#if CORE_IS_XY
dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS];
dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS];
#elif CORE_IS_XZ
dist_mm.head.x = dist.a * mm_per_step[A_AXIS];
dist_mm.y = dist.b * mm_per_step[Y_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS];
dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS];
#elif CORE_IS_YZ
dist_mm.x = dist.a * mm_per_step[X_AXIS];
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS];
dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS];
#endif
#if CORE_IS_XY
dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS];
dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS];
#elif CORE_IS_XZ
dist_mm.head.x = dist.a * mm_per_step[A_AXIS];
dist_mm.y = dist.b * mm_per_step[Y_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS];
dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS];
#elif CORE_IS_YZ
dist_mm.x = dist.a * mm_per_step[X_AXIS];
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS];
dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS];
#elif ENABLED(MARKFORGED_XY)
dist_mm.a = (dist.a TERN(MARKFORGED_INVERSE, +, -) dist.b) * mm_per_step[A_AXIS];
dist_mm.b = dist.b * mm_per_step[B_AXIS];
Expand Down Expand Up @@ -2540,6 +2540,7 @@ bool Planner::_populate_block(
#if DISABLED(S_CURVE_ACCELERATION)
block->acceleration_rate = (uint32_t)(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE)));
#endif

#if ENABLED(LIN_ADVANCE)
block->la_advance_rate = 0;
block->la_scaling = 0;
Expand Down

0 comments on commit 2c5468c

Please sign in to comment.