🐛 Don't skip G2/G3 E-only moves

This commit is contained in:
Scott Lahteine 2023-02-08 19:36:22 -06:00
parent 88dea487c2
commit 842489a5dc
3 changed files with 138 additions and 147 deletions

View file

@ -476,6 +476,9 @@ public:
private:
friend class MarlinSettings;
#if ENABLED(ARC_SUPPORT)
friend void plan_arc(const xyze_pos_t&, const ab_float_t&, const bool, const uint8_t);
#endif
#if ENABLED(MARLIN_DEV_MODE)
static void D(const int16_t dcode);

View file

@ -45,23 +45,8 @@ extern xyze_pos_t destination;
* G0, G1: Coordinated movement of X Y Z E axes
*/
void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
if (!MOTION_CONDITIONS) return;
if (IsRunning()
#if ENABLED(NO_MOTION_BEFORE_HOMING)
&& !homing_needed_error(
NUM_AXIS_GANG(
(parser.seen_test('X') ? _BV(X_AXIS) : 0),
| (parser.seen_test('Y') ? _BV(Y_AXIS) : 0),
| (parser.seen_test('Z') ? _BV(Z_AXIS) : 0),
| (parser.seen_test(AXIS4_NAME) ? _BV(I_AXIS) : 0),
| (parser.seen_test(AXIS5_NAME) ? _BV(J_AXIS) : 0),
| (parser.seen_test(AXIS6_NAME) ? _BV(K_AXIS) : 0),
| (parser.seen_test(AXIS7_NAME) ? _BV(U_AXIS) : 0),
| (parser.seen_test(AXIS8_NAME) ? _BV(V_AXIS) : 0),
| (parser.seen_test(AXIS9_NAME) ? _BV(W_AXIS) : 0))
)
#endif
) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
#ifdef G0_FEEDRATE
@ -132,4 +117,3 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
#endif
}
}

View file

@ -142,8 +142,8 @@ void plan_arc(
part_per_circle = RADIANS(360) / total_angular; // Each circle's part of the total
ARC_LIJKUVWE_CODE(
const float per_circle_L = travel_L * part_per_circle, // L movement per circle
const float per_circle_I = travel_I * part_per_circle,
const float per_circle_L = travel_L * part_per_circle, // X, Y, or Z movement per circle
const float per_circle_I = travel_I * part_per_circle, // The rest are also non-arc
const float per_circle_J = travel_J * part_per_circle,
const float per_circle_K = travel_K * part_per_circle,
const float per_circle_U = travel_U * part_per_circle,
@ -155,8 +155,8 @@ void plan_arc(
xyze_pos_t temp_position = current_position;
for (uint16_t n = circles; n--;) {
ARC_LIJKUVWE_CODE( // Destination Linear Axes
temp_position[axis_l] += per_circle_L,
temp_position.i += per_circle_I,
temp_position[axis_l] += per_circle_L, // Linear X, Y, or Z
temp_position.i += per_circle_I, // The rest are also non-circular
temp_position.j += per_circle_J,
temp_position.k += per_circle_K,
temp_position.u += per_circle_U,
@ -167,8 +167,8 @@ void plan_arc(
plan_arc(temp_position, offset, clockwise, 0); // Plan a single whole circle
}
ARC_LIJKUVWE_CODE(
travel_L = cart[axis_l] - current_position[axis_l],
travel_I = cart.i - current_position.i,
travel_L = cart[axis_l] - current_position[axis_l], // Linear X, Y, or Z
travel_I = cart.i - current_position.i, // The rest are also non-arc
travel_J = cart.j - current_position.j,
travel_K = cart.k - current_position.k,
travel_U = cart.u - current_position.u,
@ -183,16 +183,21 @@ void plan_arc(
// Return if the move is near zero
if (flat_mm < 0.0001f
GANG_N(SUB2(NUM_AXES),
&& travel_L < 0.0001f,
&& travel_I < 0.0001f,
&& travel_J < 0.0001f,
&& travel_K < 0.0001f,
&& travel_U < 0.0001f,
&& travel_V < 0.0001f,
&& travel_W < 0.0001f
GANG_N(SUB2(NUM_AXES), // Two axes for the arc
&& NEAR_ZERO(travel_L), // Linear X, Y, or Z
&& NEAR_ZERO(travel_I),
&& NEAR_ZERO(travel_J),
&& NEAR_ZERO(travel_K),
&& NEAR_ZERO(travel_U),
&& NEAR_ZERO(travel_V),
&& NEAR_ZERO(travel_W)
)
) return;
) {
#if HAS_EXTRUDERS
if (!NEAR_ZERO(travel_E)) gcode.G0_G1(); // Handle retract/recover as G1
return;
#endif
}
// Feedrate for the move, scaled by the feedrate multiplier
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
@ -426,7 +431,7 @@ void plan_arc(
* G3 X20 Y12 R14 ; CCW circle with r=14 ending at X20 Y12
*/
void GcodeSuite::G2_G3(const bool clockwise) {
if (MOTION_CONDITIONS) {
if (!MOTION_CONDITIONS) return;
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
@ -491,6 +496,5 @@ void GcodeSuite::G2_G3(const bool clockwise) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
}
}
#endif // ARC_SUPPORT