From 2c5468ce333cd4a8c6ddfde8d4ad66d8417f32bd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Dec 2023 22:34:19 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Planner=20indent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 64c47301f5..f7ab42ad81 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -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(); @@ -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 @@ -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]; @@ -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;