From c3350c1945f46c249b37b0431f25b3e197698625 Mon Sep 17 00:00:00 2001 From: qwewer0 <57561110+qwewer0@users.noreply.github.com> Date: Sat, 2 Jan 2021 22:38:10 +0100 Subject: [PATCH] CJ-JD Cleanup --- Marlin/src/inc/Conditionals_LCD.h | 6 ++-- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 8 ----- Marlin/src/module/motion.cpp | 11 +------ Marlin/src/module/planner.cpp | 45 +++------------------------ Marlin/src/module/planner.h | 22 +------------ 6 files changed, 9 insertions(+), 85 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 388adb1809f6..85879600a265 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -945,11 +945,9 @@ #endif // This flag indicates some kind of jerk storage is needed -#if EITHER(CLASSIC_JERK, IS_KINEMATIC) +#if ENABLED(CLASSIC_JERK) #define HAS_CLASSIC_JERK 1 -#endif - -#if DISABLED(CLASSIC_JERK) +#else #define HAS_JUNCTION_DEVIATION 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 7ebb9168f6d1..0f76cc36b41b 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1244,7 +1244,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Junction deviation is incompatible with kinematic systems. */ -#if HAS_JUNCTION_DEVIATION && IS_KINEMATIC +#if BOTH(HAS_JUNCTION_DEVIATION, IS_KINEMATIC) #error "CLASSIC_JERK is required for DELTA and SCARA." #endif diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 3f2a6da11b50..3f9214e9e92f 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -442,14 +442,6 @@ void menu_backlash(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #if HAS_JUNCTION_DEVIATION - #if ENABLED(LIN_ADVANCE) - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f, planner.recalculate_max_e_jerk); - #else - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.5f); - #endif - #endif - constexpr xyze_float_t max_jerk_edit = #ifdef MAX_JERK_EDIT_VALUES MAX_JERK_EDIT_VALUES diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index f2fdd7934dd5..8fe0e1754a86 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1341,18 +1341,9 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t target[axis] = 0; // Set the single homing axis to 0 planner.set_machine_position_mm(target); // Update the machine position - #if HAS_DIST_MM_ARG - const xyze_float_t cart_dist_mm{0}; - #endif - // Set delta/cartesian axes directly target[axis] = distance; // The move will be towards the endstop - planner.buffer_segment(target - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif - , home_fr_mm_s, active_extruder - ); + planner.buffer_segment(target, home_fr_mm_s, active_extruder); #endif planner.synchronize(); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 5897d10cd581..26b9dc87b461 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1684,9 +1684,6 @@ bool Planner::_buffer_steps(const xyze_long_t &target #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters ) { @@ -1702,9 +1699,6 @@ bool Planner::_buffer_steps(const xyze_long_t &target #if HAS_POSITION_FLOAT , target_float #endif - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif , fr_mm_s, extruder, millimeters )) { // Movement was not queued, probably because it was too short. @@ -1748,9 +1742,6 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/ ) { @@ -2348,13 +2339,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Unit vector of previous path line segment static xyze_float_t prev_unit_vec; - xyze_float_t unit_vec = - #if HAS_DIST_MM_ARG - cart_dist_mm - #else - { steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e } - #endif - ; + xyze_float_t unit_vec = { steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e }; /** * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y]. @@ -2591,11 +2576,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, previous_safe_speed = safe_speed; - #if HAS_JUNCTION_DEVIATION - NOMORE(vmax_junction_sqr, sq(vmax_junction)); // Throttle down to max speed - #else - vmax_junction_sqr = sq(vmax_junction); // Go up or down to the new speed - #endif + vmax_junction_sqr = sq(vmax_junction); // Go up or down to the new speed #endif // Classic Jerk Limiting @@ -2679,9 +2660,6 @@ void Planner::buffer_sync_block() { * Return 'false' if no segment was queued due to cleaning, cold extrusion, full queue, etc. */ bool Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/ ) { @@ -2751,9 +2729,6 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con #if HAS_POSITION_FLOAT , target_float #endif - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif , fr_mm_s, extruder, millimeters) ) return false; @@ -2782,14 +2757,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con #if IS_KINEMATIC - #if HAS_JUNCTION_DEVIATION - const xyze_pos_t cart_dist_mm = { - rx - position_cart.x, ry - position_cart.y, - rz - position_cart.z, e - position_cart.e - }; - #else - const xyz_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z }; - #endif + const xyz_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z }; float mm = millimeters; if (mm == 0.0) @@ -2807,12 +2775,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con #else const feedRate_t feedrate = fr_mm_s; #endif - if (buffer_segment(delta.a, delta.b, delta.c, machine.e - #if HAS_JUNCTION_DEVIATION - , cart_dist_mm - #endif - , feedrate, extruder, mm - )) { + if (buffer_segment(delta.a, delta.b, delta.c, machine.e, feedrate, extruder, mm)) { position_cart.set(rx, ry, rz, e); return true; } diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 5050f060b0a6..07a5b557e9ec 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -79,10 +79,6 @@ manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f }; #endif -#if IS_KINEMATIC && HAS_JUNCTION_DEVIATION - #define HAS_DIST_MM_ARG 1 -#endif - enum BlockFlagBit : char { // Recalculate trapezoids on entry junction. For optimization. BLOCK_BIT_RECALCULATE, @@ -673,9 +669,6 @@ class Planner { #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); @@ -696,9 +689,6 @@ class Planner { #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); @@ -728,23 +718,13 @@ class Planner { * millimeters - the length of the movement, if known */ static bool buffer_segment(const float &a, const float &b, const float &c, const float &e - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); FORCE_INLINE static bool buffer_segment(abce_pos_t &abce - #if HAS_DIST_MM_ARG - , const xyze_float_t &cart_dist_mm - #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ) { - return buffer_segment(abce.a, abce.b, abce.c, abce.e - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif - , fr_mm_s, extruder, millimeters); + return buffer_segment(abce.a, abce.b, abce.c, abce.e, fr_mm_s, extruder, millimeters); } public: