|
105 | 105 | * case - crossing only one X or Y line - after details are worked out to reduce computation. |
106 | 106 | */ |
107 | 107 |
|
108 | | - const xy_float_t dist = xy_float_t(end) - xy_float_t(start); |
| 108 | + const xy_float_t dist = end - start; |
109 | 109 | const xy_bool_t neg { dist.x < 0, dist.y < 0 }; |
110 | 110 | const xy_uint8_t ineg { uint8_t(neg.x), uint8_t(neg.y) }; |
111 | 111 | const xy_float_t sign { neg.x ? -1.0f : 1.0f, neg.y ? -1.0f : 1.0f }; |
|
362 | 362 | planner.buffer_line(destination, scaled_fr_mm_s); |
363 | 363 | return false; // caller will update current_position |
364 | 364 | } |
365 | | - if (!parser.process_motion_gcode) |
366 | | - parser.cartesian_mm = get_move_distance(total OPTARG(HAS_ROTATIONAL_AXES, parser.cartes_move)); |
| 365 | + bool cartes_move = true; |
| 366 | + float cartesian_mm = get_move_distance(total OPTARG(HAS_ROTATIONAL_AXES, cartes_move)); |
367 | 367 |
|
368 | 368 | // If the move is very short, check the E move distance |
369 | | - TERN_(HAS_EXTRUDERS, if (UNEAR_ZERO(parser.cartesian_mm)) parser.cartesian_mm = ABS(total.e)); |
| 369 | + TERN_(HAS_EXTRUDERS, if (UNEAR_ZERO(cartesian_mm)) cartesian_mm = ABS(total.e)); |
370 | 370 |
|
371 | 371 | // No E move either? Game over. |
372 | | - if (UNEAR_ZERO(parser.cartesian_mm)) return true; |
| 372 | + if (UNEAR_ZERO(cartesian_mm)) return true; |
373 | 373 |
|
374 | 374 | #if IS_KINEMATIC |
375 | 375 | // Minimum number of seconds to move the given distance |
376 | | - const float seconds = parser.cartesian_mm / scaled_fr_mm_s; |
| 376 | + const float seconds = cartesian_mm / scaled_fr_mm_s; |
377 | 377 |
|
378 | 378 | uint16_t segments = LROUND(segments_per_second * seconds), // Preferred number of segments for distance @ feedrate |
379 | | - seglimit = LROUND(parser.cartesian_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length |
| 379 | + seglimit = LROUND(cartesian_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length |
380 | 380 |
|
381 | 381 | NOMORE(segments, seglimit); // Limit to minimum segment length (fewer segments) |
382 | 382 | #else |
383 | | - uint16_t segments = LROUND(parser.cartesian_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Cartesian fixed segment length |
| 383 | + uint16_t segments = LROUND(cartesian_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Cartesian fixed segment length |
384 | 384 | #endif |
385 | 385 |
|
386 | 386 | NOLESS(segments, 1U); // Must have at least one segment |
387 | 387 | const float inv_segments = 1.0f / segments; // Reciprocal to save calculation |
388 | 388 |
|
389 | 389 | // Add hints to help optimize the move |
390 | | - PlannerHints hints(parser.cartesian_mm * inv_segments); // Length of each segment |
| 390 | + PlannerHints hints(cartesian_mm * inv_segments); // Length of each segment |
391 | 391 | #if ENABLED(FEEDRATE_SCALING) |
392 | 392 | hints.inv_duration = scaled_fr_mm_s / hints.millimeters; |
393 | 393 | #endif |
|
0 commit comments