diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 97f15076fd..23cb0a7058 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -847,52 +847,51 @@ void MarlinUI::init() { if (processing) return; // Prevent re-entry from idle() calls // Add a manual move to the queue? - if (axis != NO_AXIS_ENUM && ELAPSED(millis(), start_time) && !planner.is_full()) { + if (axis == NO_AXIS_ENUM || PENDING(millis(), start_time) || planner.is_full()) return; - const feedRate_t fr_mm_s = (axis < LOGICAL_AXES) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S; + const feedRate_t fr_mm_s = (axis < LOGICAL_AXES) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S; - #if IS_KINEMATIC + #if IS_KINEMATIC - #if HAS_MULTI_EXTRUDER - REMEMBER(ae, active_extruder); - #if MULTI_E_MANUAL - if (axis == E_AXIS) active_extruder = e_index; - #endif + #if HAS_MULTI_EXTRUDER + REMEMBER(ae, active_extruder); + #if MULTI_E_MANUAL + if (axis == E_AXIS) active_extruder = e_index; #endif - - // Apply a linear offset to a single axis - if (axis == ALL_AXES_ENUM) - destination = all_axes_destination; - else if (axis <= LOGICAL_AXES) { - destination = current_position; - destination[axis] += offset; - } - - // Reset for the next move - offset = 0; - axis = NO_AXIS_ENUM; - - // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to - // move_to_destination. This will cause idle() to be called, which can then call this function while the - // previous invocation is being blocked. Modifications to offset shouldn't be made while - // processing is true or the planner will get out of sync. - processing = true; - prepare_internal_move_to_destination(fr_mm_s); // will set current_position from destination - processing = false; - - #else - - // For Cartesian / Core motion simply move to the current_position - planner.buffer_line(current_position, fr_mm_s, - TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder - ); - - //SERIAL_ECHOLNPGM("Add planner.move with Axis ", C(AXIS_CHAR(axis)), " at FR ", fr_mm_s); - - axis = NO_AXIS_ENUM; - #endif - } + + // Apply a linear offset to a single axis + if (axis == ALL_AXES_ENUM) + destination = all_axes_destination; + else if (axis <= LOGICAL_AXES) { + destination = current_position; + destination[axis] += offset; + } + + // Reset for the next move + offset = 0; + axis = NO_AXIS_ENUM; + + // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to + // move_to_destination. This will cause idle() to be called, which can then call this function while the + // previous invocation is being blocked. Modifications to offset shouldn't be made while + // processing is true or the planner will get out of sync. + processing = true; + prepare_internal_move_to_destination(fr_mm_s); // will set current_position from destination + processing = false; + + #else + + // For Cartesian / Core motion simply move to the current_position + planner.buffer_line(current_position, fr_mm_s, + TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder + ); + + //SERIAL_ECHOLNPGM("Add planner.move with Axis ", C(AXIS_CHAR(axis)), " at FR ", fr_mm_s); + + axis = NO_AXIS_ENUM; + + #endif } // diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 5fe1b3b741..b76f11b984 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1318,8 +1318,9 @@ float get_move_distance(const xyze_pos_t &diff OPTARG(HAS_ROTATIONAL_AXES, bool float cartesian_mm = get_move_distance(diff OPTARG(HAS_ROTATIONAL_AXES, cartes_move)); // If the move is very short, check the E move distance - // No E move either? Game over. TERN_(HAS_EXTRUDERS, if (UNEAR_ZERO(cartesian_mm)) cartesian_mm = ABS(diff.e)); + + // No E move either? Game over. if (UNEAR_ZERO(cartesian_mm)) return; // The length divided by the segment size diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 8d55d37b96..0ae6ccb9a7 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2597,20 +2597,16 @@ hal_timer_t Stepper::block_phase_isr() { AxisBits didmove; NUM_AXIS_CODE( - if (X_MOVE_TEST) didmove.a = true, - if (Y_MOVE_TEST) didmove.b = true, - if (Z_MOVE_TEST) didmove.c = true, - if (current_block->steps.i) didmove.i = true, - if (current_block->steps.j) didmove.j = true, - if (current_block->steps.k) didmove.k = true, - if (current_block->steps.u) didmove.u = true, - if (current_block->steps.v) didmove.v = true, - if (current_block->steps.w) didmove.w = true + if (X_MOVE_TEST) didmove.a = true, + if (Y_MOVE_TEST) didmove.b = true, + if (Z_MOVE_TEST) didmove.c = true, + if (!!current_block->steps.i) didmove.i = true, + if (!!current_block->steps.j) didmove.j = true, + if (!!current_block->steps.k) didmove.k = true, + if (!!current_block->steps.u) didmove.u = true, + if (!!current_block->steps.v) didmove.v = true, + if (!!current_block->steps.w) didmove.w = true ); - //if (current_block->steps.e) didmove.e = true; - //if (current_block->steps.a) didmove.x = true; - //if (current_block->steps.b) didmove.y = true; - //if (current_block->steps.c) didmove.z = true; axis_did_move = didmove; // No acceleration / deceleration time elapsed so far