|
@@ -280,7 +280,6 @@ bool Running = true;
|
280
|
280
|
|
281
|
281
|
uint8_t marlin_debug_flags = DEBUG_NONE;
|
282
|
282
|
|
283
|
|
-static float feedrate = 1500.0, saved_feedrate;
|
284
|
283
|
float current_position[NUM_AXIS] = { 0.0 };
|
285
|
284
|
static float destination[NUM_AXIS] = { 0.0 };
|
286
|
285
|
bool axis_known_position[3] = { false };
|
|
@@ -302,11 +301,15 @@ static uint8_t cmd_queue_index_r = 0,
|
302
|
301
|
TempUnit input_temp_units = TEMPUNIT_C;
|
303
|
302
|
#endif
|
304
|
303
|
|
305
|
|
-const float homing_feedrate[] = HOMING_FEEDRATE;
|
|
304
|
+/**
|
|
305
|
+ * Feed rates are often configured with mm/m
|
|
306
|
+ * but the planner and stepper like mm/s units.
|
|
307
|
+ */
|
|
308
|
+const float homing_feedrate_mm_m[] = HOMING_FEEDRATE;
|
|
309
|
+static float feedrate_mm_m = 1500.0, saved_feedrate_mm_m;
|
|
310
|
+int feedrate_percentage = 100, saved_feedrate_percentage;
|
306
|
311
|
|
307
|
312
|
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
308
|
|
-int feedrate_multiplier = 100; //100->1 200->2
|
309
|
|
-int saved_feedrate_multiplier;
|
310
|
313
|
int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
|
311
|
314
|
bool volumetric_enabled = false;
|
312
|
315
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA);
|
|
@@ -382,16 +385,16 @@ static uint8_t target_extruder;
|
382
|
385
|
float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
383
|
386
|
#endif
|
384
|
387
|
|
385
|
|
-#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate[X_AXIS], planner.max_feedrate[Y_AXIS]))
|
|
388
|
+#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
|
386
|
389
|
|
387
|
390
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
388
|
|
- int xy_probe_speed = XY_PROBE_SPEED;
|
|
391
|
+ int xy_probe_feedrate_mm_m = XY_PROBE_SPEED;
|
389
|
392
|
bool bed_leveling_in_progress = false;
|
390
|
|
- #define XY_PROBE_FEEDRATE xy_probe_speed
|
|
393
|
+ #define XY_PROBE_FEEDRATE_MM_M xy_probe_feedrate_mm_m
|
391
|
394
|
#elif defined(XY_PROBE_SPEED)
|
392
|
|
- #define XY_PROBE_FEEDRATE XY_PROBE_SPEED
|
|
395
|
+ #define XY_PROBE_FEEDRATE_MM_M XY_PROBE_SPEED
|
393
|
396
|
#else
|
394
|
|
- #define XY_PROBE_FEEDRATE (PLANNER_XY_FEEDRATE() * 60)
|
|
397
|
+ #define XY_PROBE_FEEDRATE_MM_M MMS_TO_MMM(PLANNER_XY_FEEDRATE())
|
395
|
398
|
#endif
|
396
|
399
|
|
397
|
400
|
#if ENABLED(Z_DUAL_ENDSTOPS) && DISABLED(DELTA)
|
|
@@ -430,7 +433,7 @@ static uint8_t target_extruder;
|
430
|
433
|
float retract_zlift = RETRACT_ZLIFT;
|
431
|
434
|
float retract_recover_length = RETRACT_RECOVER_LENGTH;
|
432
|
435
|
float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
|
433
|
|
- float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
|
|
436
|
+ float retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
|
434
|
437
|
|
435
|
438
|
#endif // FWRETRACT
|
436
|
439
|
|
|
@@ -1599,7 +1602,7 @@ inline void set_homing_bump_feedrate(AxisEnum axis) {
|
1599
|
1602
|
SERIAL_ECHO_START;
|
1600
|
1603
|
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
|
1601
|
1604
|
}
|
1602
|
|
- feedrate = homing_feedrate[axis] / hbd;
|
|
1605
|
+ feedrate_mm_m = homing_feedrate_mm_m[axis] / hbd;
|
1603
|
1606
|
}
|
1604
|
1607
|
//
|
1605
|
1608
|
// line_to_current_position
|
|
@@ -1607,19 +1610,19 @@ inline void set_homing_bump_feedrate(AxisEnum axis) {
|
1607
|
1610
|
// (or from wherever it has been told it is located).
|
1608
|
1611
|
//
|
1609
|
1612
|
inline void line_to_current_position() {
|
1610
|
|
- planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
1613
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMM_TO_MMS(feedrate_mm_m), active_extruder);
|
1611
|
1614
|
}
|
1612
|
1615
|
inline void line_to_z(float zPosition) {
|
1613
|
|
- planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
1616
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], MMM_TO_MMS(feedrate_mm_m), active_extruder);
|
1614
|
1617
|
}
|
1615
|
1618
|
//
|
1616
|
1619
|
// line_to_destination
|
1617
|
1620
|
// Move the planner, not necessarily synced with current_position
|
1618
|
1621
|
//
|
1619
|
|
-inline void line_to_destination(float mm_m) {
|
1620
|
|
- planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m / 60, active_extruder);
|
|
1622
|
+inline void line_to_destination(float fr_mm_m) {
|
|
1623
|
+ planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], MMM_TO_MMS(fr_mm_m), active_extruder);
|
1621
|
1624
|
}
|
1622
|
|
-inline void line_to_destination() { line_to_destination(feedrate); }
|
|
1625
|
+inline void line_to_destination() { line_to_destination(feedrate_mm_m); }
|
1623
|
1626
|
|
1624
|
1627
|
/**
|
1625
|
1628
|
* sync_plan_position
|
|
@@ -1647,7 +1650,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
|
1647
|
1650
|
#endif
|
1648
|
1651
|
refresh_cmd_timeout();
|
1649
|
1652
|
calculate_delta(destination);
|
1650
|
|
- planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
1653
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], MMM_TO_MMS_SCALED(feedrate_mm_m), active_extruder);
|
1651
|
1654
|
set_current_to_destination();
|
1652
|
1655
|
}
|
1653
|
1656
|
#endif
|
|
@@ -1656,8 +1659,8 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
|
1656
|
1659
|
* Plan a move to (X, Y, Z) and set the current_position
|
1657
|
1660
|
* The final current_position may not be the one that was requested
|
1658
|
1661
|
*/
|
1659
|
|
-static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0) {
|
1660
|
|
- float old_feedrate = feedrate;
|
|
1662
|
+static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0) {
|
|
1663
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
1661
|
1664
|
|
1662
|
1665
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1663
|
1666
|
if (DEBUGGING(LEVELING)) print_xyz(PSTR("do_blocking_move_to"), NULL, x, y, z);
|
|
@@ -1665,7 +1668,7 @@ static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0
|
1665
|
1668
|
|
1666
|
1669
|
#if ENABLED(DELTA)
|
1667
|
1670
|
|
1668
|
|
- feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
|
|
1671
|
+ feedrate_mm_m = (fr_mm_m != 0.0) ? fr_mm_m : XY_PROBE_FEEDRATE_MM_M;
|
1669
|
1672
|
|
1670
|
1673
|
destination[X_AXIS] = x;
|
1671
|
1674
|
destination[Y_AXIS] = y;
|
|
@@ -1680,19 +1683,19 @@ static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0
|
1680
|
1683
|
|
1681
|
1684
|
// If Z needs to raise, do it before moving XY
|
1682
|
1685
|
if (current_position[Z_AXIS] < z) {
|
1683
|
|
- feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
|
|
1686
|
+ feedrate_mm_m = (fr_mm_m != 0.0) ? fr_mm_m : homing_feedrate_mm_m[Z_AXIS];
|
1684
|
1687
|
current_position[Z_AXIS] = z;
|
1685
|
1688
|
line_to_current_position();
|
1686
|
1689
|
}
|
1687
|
1690
|
|
1688
|
|
- feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
|
|
1691
|
+ feedrate_mm_m = (fr_mm_m != 0.0) ? fr_mm_m : XY_PROBE_FEEDRATE_MM_M;
|
1689
|
1692
|
current_position[X_AXIS] = x;
|
1690
|
1693
|
current_position[Y_AXIS] = y;
|
1691
|
1694
|
line_to_current_position();
|
1692
|
1695
|
|
1693
|
1696
|
// If Z needs to lower, do it after moving XY
|
1694
|
1697
|
if (current_position[Z_AXIS] > z) {
|
1695
|
|
- feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
|
|
1698
|
+ feedrate_mm_m = (fr_mm_m != 0.0) ? fr_mm_m : homing_feedrate_mm_m[Z_AXIS];
|
1696
|
1699
|
current_position[Z_AXIS] = z;
|
1697
|
1700
|
line_to_current_position();
|
1698
|
1701
|
}
|
|
@@ -1701,23 +1704,23 @@ static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0
|
1701
|
1704
|
|
1702
|
1705
|
stepper.synchronize();
|
1703
|
1706
|
|
1704
|
|
- feedrate = old_feedrate;
|
|
1707
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
1705
|
1708
|
}
|
1706
|
1709
|
|
1707
|
|
-inline void do_blocking_move_to_x(float x, float feed_rate = 0.0) {
|
1708
|
|
- do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate);
|
|
1710
|
+inline void do_blocking_move_to_x(float x, float fr_mm_m = 0.0) {
|
|
1711
|
+ do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
|
1709
|
1712
|
}
|
1710
|
1713
|
|
1711
|
1714
|
inline void do_blocking_move_to_y(float y) {
|
1712
|
1715
|
do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
|
1713
|
1716
|
}
|
1714
|
1717
|
|
1715
|
|
-inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
|
1716
|
|
- do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
|
|
1718
|
+inline void do_blocking_move_to_xy(float x, float y, float fr_mm_m = 0.0) {
|
|
1719
|
+ do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_m);
|
1717
|
1720
|
}
|
1718
|
1721
|
|
1719
|
|
-inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
|
1720
|
|
- do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
|
|
1722
|
+inline void do_blocking_move_to_z(float z, float fr_mm_m = 0.0) {
|
|
1723
|
+ do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, fr_mm_m);
|
1721
|
1724
|
}
|
1722
|
1725
|
|
1723
|
1726
|
//
|
|
@@ -1733,9 +1736,9 @@ static void setup_for_endstop_or_probe_move() {
|
1733
|
1736
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1734
|
1737
|
if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
|
1735
|
1738
|
#endif
|
1736
|
|
- saved_feedrate = feedrate;
|
1737
|
|
- saved_feedrate_multiplier = feedrate_multiplier;
|
1738
|
|
- feedrate_multiplier = 100;
|
|
1739
|
+ saved_feedrate_mm_m = feedrate_mm_m;
|
|
1740
|
+ saved_feedrate_percentage = feedrate_percentage;
|
|
1741
|
+ feedrate_percentage = 100;
|
1739
|
1742
|
refresh_cmd_timeout();
|
1740
|
1743
|
}
|
1741
|
1744
|
|
|
@@ -1743,8 +1746,8 @@ static void clean_up_after_endstop_or_probe_move() {
|
1743
|
1746
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1744
|
1747
|
if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
|
1745
|
1748
|
#endif
|
1746
|
|
- feedrate = saved_feedrate;
|
1747
|
|
- feedrate_multiplier = saved_feedrate_multiplier;
|
|
1749
|
+ feedrate_mm_m = saved_feedrate_mm_m;
|
|
1750
|
+ feedrate_percentage = saved_feedrate_percentage;
|
1748
|
1751
|
refresh_cmd_timeout();
|
1749
|
1752
|
}
|
1750
|
1753
|
|
|
@@ -2003,6 +2006,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2003
|
2006
|
if (DEBUGGING(LEVELING)) {
|
2004
|
2007
|
DEBUG_POS("set_probe_deployed", current_position);
|
2005
|
2008
|
SERIAL_ECHOPAIR("deploy: ", deploy);
|
|
2009
|
+ SERIAL_EOL;
|
2006
|
2010
|
}
|
2007
|
2011
|
#endif
|
2008
|
2012
|
|
|
@@ -2062,7 +2066,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2062
|
2066
|
// at the height where the probe triggered.
|
2063
|
2067
|
static float run_z_probe() {
|
2064
|
2068
|
|
2065
|
|
- float old_feedrate = feedrate;
|
|
2069
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
2066
|
2070
|
|
2067
|
2071
|
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
|
2068
|
2072
|
refresh_cmd_timeout();
|
|
@@ -2077,7 +2081,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2077
|
2081
|
#endif
|
2078
|
2082
|
|
2079
|
2083
|
// move down slowly until you find the bed
|
2080
|
|
- feedrate = homing_feedrate[Z_AXIS] / 4;
|
|
2084
|
+ feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS] / 4;
|
2081
|
2085
|
destination[Z_AXIS] = -10;
|
2082
|
2086
|
prepare_move_to_destination_raw(); // this will also set_current_to_destination
|
2083
|
2087
|
stepper.synchronize();
|
|
@@ -2101,7 +2105,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2101
|
2105
|
planner.bed_level_matrix.set_to_identity();
|
2102
|
2106
|
#endif
|
2103
|
2107
|
|
2104
|
|
- feedrate = homing_feedrate[Z_AXIS];
|
|
2108
|
+ feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
|
2105
|
2109
|
|
2106
|
2110
|
// Move down until the Z probe (or endstop?) is triggered
|
2107
|
2111
|
float zPosition = -(Z_MAX_LENGTH + 10);
|
|
@@ -2140,7 +2144,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2140
|
2144
|
|
2141
|
2145
|
SYNC_PLAN_POSITION_KINEMATIC();
|
2142
|
2146
|
|
2143
|
|
- feedrate = old_feedrate;
|
|
2147
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
2144
|
2148
|
|
2145
|
2149
|
return current_position[Z_AXIS];
|
2146
|
2150
|
}
|
|
@@ -2165,7 +2169,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2165
|
2169
|
}
|
2166
|
2170
|
#endif
|
2167
|
2171
|
|
2168
|
|
- float old_feedrate = feedrate;
|
|
2172
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
2169
|
2173
|
|
2170
|
2174
|
// Ensure a minimum height before moving the probe
|
2171
|
2175
|
do_probe_raise(Z_RAISE_BETWEEN_PROBINGS);
|
|
@@ -2178,7 +2182,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2178
|
2182
|
SERIAL_ECHOLNPGM(")");
|
2179
|
2183
|
}
|
2180
|
2184
|
#endif
|
2181
|
|
- feedrate = XY_PROBE_FEEDRATE;
|
|
2185
|
+ feedrate_mm_m = XY_PROBE_FEEDRATE_MM_M;
|
2182
|
2186
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
2183
|
2187
|
|
2184
|
2188
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -2215,7 +2219,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2215
|
2219
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt");
|
2216
|
2220
|
#endif
|
2217
|
2221
|
|
2218
|
|
- feedrate = old_feedrate;
|
|
2222
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
2219
|
2223
|
|
2220
|
2224
|
return measured_z;
|
2221
|
2225
|
}
|
|
@@ -2416,7 +2420,7 @@ static void homeaxis(AxisEnum axis) {
|
2416
|
2420
|
|
2417
|
2421
|
// Move towards the endstop until an endstop is triggered
|
2418
|
2422
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
2419
|
|
- feedrate = homing_feedrate[axis];
|
|
2423
|
+ feedrate_mm_m = homing_feedrate_mm_m[axis];
|
2420
|
2424
|
line_to_destination();
|
2421
|
2425
|
stepper.synchronize();
|
2422
|
2426
|
|
|
@@ -2456,7 +2460,7 @@ static void homeaxis(AxisEnum axis) {
|
2456
|
2460
|
sync_plan_position();
|
2457
|
2461
|
|
2458
|
2462
|
// Move to the adjusted endstop height
|
2459
|
|
- feedrate = homing_feedrate[axis];
|
|
2463
|
+ feedrate_mm_m = homing_feedrate_mm_m[axis];
|
2460
|
2464
|
destination[Z_AXIS] = adj;
|
2461
|
2465
|
line_to_destination();
|
2462
|
2466
|
stepper.synchronize();
|
|
@@ -2520,13 +2524,13 @@ static void homeaxis(AxisEnum axis) {
|
2520
|
2524
|
|
2521
|
2525
|
if (retracting == retracted[active_extruder]) return;
|
2522
|
2526
|
|
2523
|
|
- float old_feedrate = feedrate;
|
|
2527
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
2524
|
2528
|
|
2525
|
2529
|
set_destination_to_current();
|
2526
|
2530
|
|
2527
|
2531
|
if (retracting) {
|
2528
|
2532
|
|
2529
|
|
- feedrate = retract_feedrate_mm_s * 60;
|
|
2533
|
+ feedrate_mm_m = MMS_TO_MMM(retract_feedrate_mm_s);
|
2530
|
2534
|
current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
|
2531
|
2535
|
sync_plan_position_e();
|
2532
|
2536
|
prepare_move_to_destination();
|
|
@@ -2544,14 +2548,14 @@ static void homeaxis(AxisEnum axis) {
|
2544
|
2548
|
SYNC_PLAN_POSITION_KINEMATIC();
|
2545
|
2549
|
}
|
2546
|
2550
|
|
2547
|
|
- feedrate = retract_recover_feedrate * 60;
|
|
2551
|
+ feedrate_mm_m = MMM_TO_MMS(retract_recover_feedrate_mm_s);
|
2548
|
2552
|
float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
|
2549
|
2553
|
current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
|
2550
|
2554
|
sync_plan_position_e();
|
2551
|
2555
|
prepare_move_to_destination();
|
2552
|
2556
|
}
|
2553
|
2557
|
|
2554
|
|
- feedrate = old_feedrate;
|
|
2558
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
2555
|
2559
|
retracted[active_extruder] = retracting;
|
2556
|
2560
|
|
2557
|
2561
|
} // retract()
|
|
@@ -2613,10 +2617,10 @@ void gcode_get_destination() {
|
2613
|
2617
|
}
|
2614
|
2618
|
|
2615
|
2619
|
if (code_seen('F') && code_value_linear_units() > 0.0)
|
2616
|
|
- feedrate = code_value_linear_units();
|
|
2620
|
+ feedrate_mm_m = code_value_linear_units();
|
2617
|
2621
|
|
2618
|
2622
|
#if ENABLED(PRINTCOUNTER)
|
2619
|
|
- if(!DEBUGGING(DRYRUN))
|
|
2623
|
+ if (!DEBUGGING(DRYRUN))
|
2620
|
2624
|
print_job_timer.incFilamentUsed(destination[E_AXIS] - current_position[E_AXIS]);
|
2621
|
2625
|
#endif
|
2622
|
2626
|
|
|
@@ -2846,7 +2850,7 @@ inline void gcode_G4() {
|
2846
|
2850
|
|
2847
|
2851
|
destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
|
2848
|
2852
|
destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
|
2849
|
|
- feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
|
|
2853
|
+ feedrate_mm_m = min(homing_feedrate_mm_m[X_AXIS], homing_feedrate_mm_m[Y_AXIS]) * sqrt(sq(mlratio) + 1);
|
2850
|
2854
|
line_to_destination();
|
2851
|
2855
|
stepper.synchronize();
|
2852
|
2856
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
@@ -2943,7 +2947,7 @@ inline void gcode_G28() {
|
2943
|
2947
|
|
2944
|
2948
|
// Move all carriages up together until the first endstop is hit.
|
2945
|
2949
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH);
|
2946
|
|
- feedrate = 1.732 * homing_feedrate[X_AXIS];
|
|
2950
|
+ feedrate_mm_m = 1.732 * homing_feedrate_mm_m[X_AXIS];
|
2947
|
2951
|
line_to_destination();
|
2948
|
2952
|
stepper.synchronize();
|
2949
|
2953
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
@@ -3164,7 +3168,7 @@ inline void gcode_G28() {
|
3164
|
3168
|
#if ENABLED(MESH_G28_REST_ORIGIN)
|
3165
|
3169
|
current_position[Z_AXIS] = 0.0;
|
3166
|
3170
|
set_destination_to_current();
|
3167
|
|
- feedrate = homing_feedrate[Z_AXIS];
|
|
3171
|
+ feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
|
3168
|
3172
|
line_to_destination();
|
3169
|
3173
|
stepper.synchronize();
|
3170
|
3174
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -3224,8 +3228,8 @@ inline void gcode_G28() {
|
3224
|
3228
|
enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet, MeshSetZOffset, MeshReset };
|
3225
|
3229
|
|
3226
|
3230
|
inline void _mbl_goto_xy(float x, float y) {
|
3227
|
|
- float old_feedrate = feedrate;
|
3228
|
|
- feedrate = homing_feedrate[X_AXIS];
|
|
3231
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
|
3232
|
+ feedrate_mm_m = homing_feedrate_mm_m[X_AXIS];
|
3229
|
3233
|
|
3230
|
3234
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
|
3231
|
3235
|
#if Z_RAISE_BETWEEN_PROBINGS > MIN_Z_HEIGHT_FOR_HOMING
|
|
@@ -3245,7 +3249,7 @@ inline void gcode_G28() {
|
3245
|
3249
|
line_to_current_position();
|
3246
|
3250
|
#endif
|
3247
|
3251
|
|
3248
|
|
- feedrate = old_feedrate;
|
|
3252
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
3249
|
3253
|
stepper.synchronize();
|
3250
|
3254
|
}
|
3251
|
3255
|
|
|
@@ -3492,7 +3496,7 @@ inline void gcode_G28() {
|
3492
|
3496
|
}
|
3493
|
3497
|
#endif
|
3494
|
3498
|
|
3495
|
|
- xy_probe_speed = code_seen('S') ? (int)code_value_linear_units() : XY_PROBE_SPEED;
|
|
3499
|
+ xy_probe_feedrate_mm_m = code_seen('S') ? (int)code_value_linear_units() : XY_PROBE_SPEED;
|
3496
|
3500
|
|
3497
|
3501
|
int left_probe_bed_position = code_seen('L') ? (int)code_value_axis_units(X_AXIS) : LEFT_PROBE_BED_POSITION,
|
3498
|
3502
|
right_probe_bed_position = code_seen('R') ? (int)code_value_axis_units(X_AXIS) : RIGHT_PROBE_BED_POSITION,
|
|
@@ -3594,7 +3598,7 @@ inline void gcode_G28() {
|
3594
|
3598
|
* so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
|
3595
|
3599
|
*/
|
3596
|
3600
|
|
3597
|
|
- int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points;
|
|
3601
|
+ int abl2 = sq(auto_bed_leveling_grid_points);
|
3598
|
3602
|
|
3599
|
3603
|
double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
|
3600
|
3604
|
eqnBVector[abl2], // "B" vector of Z points
|
|
@@ -3627,7 +3631,7 @@ inline void gcode_G28() {
|
3627
|
3631
|
|
3628
|
3632
|
#if ENABLED(DELTA)
|
3629
|
3633
|
// Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
3630
|
|
- float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe);
|
|
3634
|
+ float distance_from_center = HYPOT(xProbe, yProbe);
|
3631
|
3635
|
if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue;
|
3632
|
3636
|
#endif //DELTA
|
3633
|
3637
|
|
|
@@ -4250,7 +4254,7 @@ inline void gcode_M42() {
|
4250
|
4254
|
return;
|
4251
|
4255
|
}
|
4252
|
4256
|
#else
|
4253
|
|
- if (sqrt(X_probe_location * X_probe_location + Y_probe_location * Y_probe_location) > DELTA_PROBEABLE_RADIUS) {
|
|
4257
|
+ if (HYPOT(X_probe_location, Y_probe_location) > DELTA_PROBEABLE_RADIUS) {
|
4254
|
4258
|
SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius.");
|
4255
|
4259
|
return;
|
4256
|
4260
|
}
|
|
@@ -4340,7 +4344,7 @@ inline void gcode_M42() {
|
4340
|
4344
|
#else
|
4341
|
4345
|
// If we have gone out too far, we can do a simple fix and scale the numbers
|
4342
|
4346
|
// back in closer to the origin.
|
4343
|
|
- while (sqrt(X_current * X_current + Y_current * Y_current) > DELTA_PROBEABLE_RADIUS) {
|
|
4347
|
+ while (HYPOT(X_current, Y_current) > DELTA_PROBEABLE_RADIUS) {
|
4344
|
4348
|
X_current /= 1.25;
|
4345
|
4349
|
Y_current /= 1.25;
|
4346
|
4350
|
if (verbose_level > 3) {
|
|
@@ -4376,10 +4380,9 @@ inline void gcode_M42() {
|
4376
|
4380
|
* data points we have so far
|
4377
|
4381
|
*/
|
4378
|
4382
|
sum = 0.0;
|
4379
|
|
- for (uint8_t j = 0; j <= n; j++) {
|
4380
|
|
- float ss = sample_set[j] - mean;
|
4381
|
|
- sum += ss * ss;
|
4382
|
|
- }
|
|
4383
|
+ for (uint8_t j = 0; j <= n; j++)
|
|
4384
|
+ sum += sq(sample_set[j] - mean);
|
|
4385
|
+
|
4383
|
4386
|
sigma = sqrt(sum / (n + 1));
|
4384
|
4387
|
if (verbose_level > 0) {
|
4385
|
4388
|
if (verbose_level > 1) {
|
|
@@ -5163,7 +5166,7 @@ inline void gcode_M92() {
|
5163
|
5166
|
if (value < 20.0) {
|
5164
|
5167
|
float factor = planner.axis_steps_per_mm[i] / value; // increase e constants if M92 E14 is given for netfab.
|
5165
|
5168
|
planner.max_e_jerk *= factor;
|
5166
|
|
- planner.max_feedrate[i] *= factor;
|
|
5169
|
+ planner.max_feedrate_mm_s[i] *= factor;
|
5167
|
5170
|
planner.max_acceleration_steps_per_s2[i] *= factor;
|
5168
|
5171
|
}
|
5169
|
5172
|
planner.axis_steps_per_mm[i] = value;
|
|
@@ -5372,7 +5375,7 @@ inline void gcode_M201() {
|
5372
|
5375
|
inline void gcode_M203() {
|
5373
|
5376
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
5374
|
5377
|
if (code_seen(axis_codes[i]))
|
5375
|
|
- planner.max_feedrate[i] = code_value_axis_units(i);
|
|
5378
|
+ planner.max_feedrate_mm_s[i] = code_value_axis_units(i);
|
5376
|
5379
|
}
|
5377
|
5380
|
|
5378
|
5381
|
/**
|
|
@@ -5418,8 +5421,8 @@ inline void gcode_M204() {
|
5418
|
5421
|
* E = Max E Jerk (units/sec^2)
|
5419
|
5422
|
*/
|
5420
|
5423
|
inline void gcode_M205() {
|
5421
|
|
- if (code_seen('S')) planner.min_feedrate = code_value_linear_units();
|
5422
|
|
- if (code_seen('T')) planner.min_travel_feedrate = code_value_linear_units();
|
|
5424
|
+ if (code_seen('S')) planner.min_feedrate_mm_s = code_value_linear_units();
|
|
5425
|
+ if (code_seen('T')) planner.min_travel_feedrate_mm_s = code_value_linear_units();
|
5423
|
5426
|
if (code_seen('B')) planner.min_segment_time = code_value_millis();
|
5424
|
5427
|
if (code_seen('X')) planner.max_xy_jerk = code_value_linear_units();
|
5425
|
5428
|
if (code_seen('Z')) planner.max_z_jerk = code_value_axis_units(Z_AXIS);
|
|
@@ -5517,7 +5520,7 @@ inline void gcode_M206() {
|
5517
|
5520
|
*/
|
5518
|
5521
|
inline void gcode_M207() {
|
5519
|
5522
|
if (code_seen('S')) retract_length = code_value_axis_units(E_AXIS);
|
5520
|
|
- if (code_seen('F')) retract_feedrate_mm_s = code_value_axis_units(E_AXIS) / 60;
|
|
5523
|
+ if (code_seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(code_value_axis_units(E_AXIS));
|
5521
|
5524
|
if (code_seen('Z')) retract_zlift = code_value_axis_units(Z_AXIS);
|
5522
|
5525
|
#if EXTRUDERS > 1
|
5523
|
5526
|
if (code_seen('W')) retract_length_swap = code_value_axis_units(E_AXIS);
|
|
@@ -5529,11 +5532,11 @@ inline void gcode_M206() {
|
5529
|
5532
|
*
|
5530
|
5533
|
* S[+units] retract_recover_length (in addition to M207 S*)
|
5531
|
5534
|
* W[+units] retract_recover_length_swap (multi-extruder)
|
5532
|
|
- * F[units/min] retract_recover_feedrate
|
|
5535
|
+ * F[units/min] retract_recover_feedrate_mm_s
|
5533
|
5536
|
*/
|
5534
|
5537
|
inline void gcode_M208() {
|
5535
|
5538
|
if (code_seen('S')) retract_recover_length = code_value_axis_units(E_AXIS);
|
5536
|
|
- if (code_seen('F')) retract_recover_feedrate = code_value_axis_units(E_AXIS) / 60;
|
|
5539
|
+ if (code_seen('F')) retract_recover_feedrate_mm_s = MMM_TO_MMS(code_value_axis_units(E_AXIS));
|
5537
|
5540
|
#if EXTRUDERS > 1
|
5538
|
5541
|
if (code_seen('W')) retract_recover_length_swap = code_value_axis_units(E_AXIS);
|
5539
|
5542
|
#endif
|
|
@@ -5604,7 +5607,7 @@ inline void gcode_M206() {
|
5604
|
5607
|
* M220: Set speed percentage factor, aka "Feed Rate" (M220 S95)
|
5605
|
5608
|
*/
|
5606
|
5609
|
inline void gcode_M220() {
|
5607
|
|
- if (code_seen('S')) feedrate_multiplier = code_value_int();
|
|
5610
|
+ if (code_seen('S')) feedrate_percentage = code_value_int();
|
5608
|
5611
|
}
|
5609
|
5612
|
|
5610
|
5613
|
/**
|
|
@@ -6308,10 +6311,10 @@ inline void gcode_M503() {
|
6308
|
6311
|
|
6309
|
6312
|
// Define runplan for move axes
|
6310
|
6313
|
#if ENABLED(DELTA)
|
6311
|
|
- #define RUNPLAN(RATE) calculate_delta(destination); \
|
6312
|
|
- planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE, active_extruder);
|
|
6314
|
+ #define RUNPLAN(RATE_MM_S) calculate_delta(destination); \
|
|
6315
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE_MM_S, active_extruder);
|
6313
|
6316
|
#else
|
6314
|
|
- #define RUNPLAN(RATE) line_to_destination(RATE * 60);
|
|
6317
|
+ #define RUNPLAN(RATE_MM_S) line_to_destination(MMS_TO_MMM(RATE_MM_S));
|
6315
|
6318
|
#endif
|
6316
|
6319
|
|
6317
|
6320
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
@@ -6726,14 +6729,14 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6726
|
6729
|
return;
|
6727
|
6730
|
}
|
6728
|
6731
|
|
6729
|
|
- float old_feedrate = feedrate;
|
|
6732
|
+ float old_feedrate_mm_m = feedrate_mm_m;
|
6730
|
6733
|
|
6731
|
6734
|
if (code_seen('F')) {
|
6732
|
|
- float next_feedrate = code_value_axis_units(X_AXIS);
|
6733
|
|
- if (next_feedrate > 0.0) old_feedrate = feedrate = next_feedrate;
|
|
6735
|
+ float next_feedrate_mm_m = code_value_axis_units(X_AXIS);
|
|
6736
|
+ if (next_feedrate_mm_m > 0.0) old_feedrate_mm_m = feedrate_mm_m = next_feedrate_mm_m;
|
6734
|
6737
|
}
|
6735
|
6738
|
else
|
6736
|
|
- feedrate = XY_PROBE_FEEDRATE;
|
|
6739
|
+ feedrate_mm_m = XY_PROBE_FEEDRATE_MM_M;
|
6737
|
6740
|
|
6738
|
6741
|
if (tmp_extruder != active_extruder) {
|
6739
|
6742
|
bool no_move = code_seen('S') && code_value_bool();
|
|
@@ -6776,7 +6779,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6776
|
6779
|
current_position[Y_AXIS],
|
6777
|
6780
|
current_position[Z_AXIS] + (i == 2 ? 0 : TOOLCHANGE_PARK_ZLIFT),
|
6778
|
6781
|
current_position[E_AXIS],
|
6779
|
|
- planner.max_feedrate[i == 1 ? X_AXIS : Z_AXIS],
|
|
6782
|
+ planner.max_feedrate_mm_s[i == 1 ? X_AXIS : Z_AXIS],
|
6780
|
6783
|
active_extruder
|
6781
|
6784
|
);
|
6782
|
6785
|
stepper.synchronize();
|
|
@@ -6839,7 +6842,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6839
|
6842
|
current_position[Y_AXIS],
|
6840
|
6843
|
current_position[Z_AXIS] + z_raise,
|
6841
|
6844
|
current_position[E_AXIS],
|
6842
|
|
- planner.max_feedrate[Z_AXIS],
|
|
6845
|
+ planner.max_feedrate_mm_s[Z_AXIS],
|
6843
|
6846
|
active_extruder
|
6844
|
6847
|
);
|
6845
|
6848
|
stepper.synchronize();
|
|
@@ -6854,7 +6857,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6854
|
6857
|
current_position[Y_AXIS],
|
6855
|
6858
|
current_position[Z_AXIS] + z_diff,
|
6856
|
6859
|
current_position[E_AXIS],
|
6857
|
|
- planner.max_feedrate[Z_AXIS],
|
|
6860
|
+ planner.max_feedrate_mm_s[Z_AXIS],
|
6858
|
6861
|
active_extruder
|
6859
|
6862
|
);
|
6860
|
6863
|
stepper.synchronize();
|
|
@@ -6985,7 +6988,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6985
|
6988
|
enable_solenoid_on_active_extruder();
|
6986
|
6989
|
#endif // EXT_SOLENOID
|
6987
|
6990
|
|
6988
|
|
- feedrate = old_feedrate;
|
|
6991
|
+ feedrate_mm_m = old_feedrate_mm_m;
|
6989
|
6992
|
|
6990
|
6993
|
#else // HOTENDS <= 1
|
6991
|
6994
|
|
|
@@ -7838,9 +7841,9 @@ void clamp_to_software_endstops(float target[3]) {
|
7838
|
7841
|
#if ENABLED(MESH_BED_LEVELING)
|
7839
|
7842
|
|
7840
|
7843
|
// This function is used to split lines on mesh borders so each segment is only part of one mesh area
|
7841
|
|
-void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t& extruder, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
|
7844
|
+void mesh_buffer_line(float x, float y, float z, const float e, float fr_mm_s, const uint8_t& extruder, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
7842
|
7845
|
if (!mbl.active()) {
|
7843
|
|
- planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7846
|
+ planner.buffer_line(x, y, z, e, fr_mm_s, extruder);
|
7844
|
7847
|
set_current_to_destination();
|
7845
|
7848
|
return;
|
7846
|
7849
|
}
|
|
@@ -7854,7 +7857,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7854
|
7857
|
NOMORE(cy, MESH_NUM_Y_POINTS - 2);
|
7855
|
7858
|
if (pcx == cx && pcy == cy) {
|
7856
|
7859
|
// Start and end on same mesh square
|
7857
|
|
- planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7860
|
+ planner.buffer_line(x, y, z, e, fr_mm_s, extruder);
|
7858
|
7861
|
set_current_to_destination();
|
7859
|
7862
|
return;
|
7860
|
7863
|
}
|
|
@@ -7893,7 +7896,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7893
|
7896
|
}
|
7894
|
7897
|
else {
|
7895
|
7898
|
// Already split on a border
|
7896
|
|
- planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7899
|
+ planner.buffer_line(x, y, z, e, fr_mm_s, extruder);
|
7897
|
7900
|
set_current_to_destination();
|
7898
|
7901
|
return;
|
7899
|
7902
|
}
|
|
@@ -7902,12 +7905,12 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7902
|
7905
|
destination[Y_AXIS] = ny;
|
7903
|
7906
|
destination[Z_AXIS] = nz;
|
7904
|
7907
|
destination[E_AXIS] = ne;
|
7905
|
|
- mesh_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
|
|
7908
|
+ mesh_buffer_line(nx, ny, nz, ne, fr_mm_s, extruder, x_splits, y_splits);
|
7906
|
7909
|
destination[X_AXIS] = x;
|
7907
|
7910
|
destination[Y_AXIS] = y;
|
7908
|
7911
|
destination[Z_AXIS] = z;
|
7909
|
7912
|
destination[E_AXIS] = e;
|
7910
|
|
- mesh_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
|
7913
|
+ mesh_buffer_line(x, y, z, e, fr_mm_s, extruder, x_splits, y_splits);
|
7911
|
7914
|
}
|
7912
|
7915
|
#endif // MESH_BED_LEVELING
|
7913
|
7916
|
|
|
@@ -7920,8 +7923,8 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7920
|
7923
|
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
|
7921
|
7924
|
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
|
7922
|
7925
|
if (cartesian_mm < 0.000001) return false;
|
7923
|
|
- float _feedrate = feedrate * feedrate_multiplier / 6000.0;
|
7924
|
|
- float seconds = cartesian_mm / _feedrate;
|
|
7926
|
+ float _feedrate_mm_s = MMM_TO_MMS_SCALED(feedrate_mm_m);
|
|
7927
|
+ float seconds = cartesian_mm / _feedrate_mm_s;
|
7925
|
7928
|
int steps = max(1, int(delta_segments_per_second * seconds));
|
7926
|
7929
|
float inv_steps = 1.0/steps;
|
7927
|
7930
|
|
|
@@ -7945,7 +7948,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7945
|
7948
|
//DEBUG_POS("prepare_delta_move_to", target);
|
7946
|
7949
|
//DEBUG_POS("prepare_delta_move_to", delta);
|
7947
|
7950
|
|
7948
|
|
- planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate, active_extruder);
|
|
7951
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate_mm_s, active_extruder);
|
7949
|
7952
|
}
|
7950
|
7953
|
return true;
|
7951
|
7954
|
}
|
|
@@ -7964,7 +7967,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7964
|
7967
|
// move duplicate extruder into correct duplication position.
|
7965
|
7968
|
planner.set_position_mm(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
7966
|
7969
|
planner.buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
7967
|
|
- current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[X_AXIS], 1);
|
|
7970
|
+ current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate_mm_s[X_AXIS], 1);
|
7968
|
7971
|
SYNC_PLAN_POSITION_KINEMATIC();
|
7969
|
7972
|
stepper.synchronize();
|
7970
|
7973
|
extruder_duplication_enabled = true;
|
|
@@ -7984,9 +7987,9 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7984
|
7987
|
}
|
7985
|
7988
|
delayed_move_time = 0;
|
7986
|
7989
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
7987
|
|
- planner.buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
7990
|
+ planner.buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
7988
|
7991
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], PLANNER_XY_FEEDRATE(), active_extruder);
|
7989
|
|
- planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
7992
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
7990
|
7993
|
active_extruder_parked = false;
|
7991
|
7994
|
}
|
7992
|
7995
|
}
|
|
@@ -7998,16 +8001,16 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7998
|
8001
|
#if DISABLED(DELTA) && DISABLED(SCARA)
|
7999
|
8002
|
|
8000
|
8003
|
inline bool prepare_move_to_destination_cartesian() {
|
8001
|
|
- // Do not use feedrate_multiplier for E or Z only moves
|
|
8004
|
+ // Do not use feedrate_percentage for E or Z only moves
|
8002
|
8005
|
if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
|
8003
|
8006
|
line_to_destination();
|
8004
|
8007
|
}
|
8005
|
8008
|
else {
|
8006
|
8009
|
#if ENABLED(MESH_BED_LEVELING)
|
8007
|
|
- mesh_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
8010
|
+ mesh_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], MMM_TO_MMS_SCALED(feedrate_mm_m), active_extruder);
|
8008
|
8011
|
return false;
|
8009
|
8012
|
#else
|
8010
|
|
- line_to_destination(feedrate * feedrate_multiplier / 100.0);
|
|
8013
|
+ line_to_destination(MMM_SCALED(feedrate_mm_m));
|
8011
|
8014
|
#endif
|
8012
|
8015
|
}
|
8013
|
8016
|
return true;
|
|
@@ -8082,7 +8085,7 @@ void prepare_move_to_destination() {
|
8082
|
8085
|
uint8_t clockwise // Clockwise?
|
8083
|
8086
|
) {
|
8084
|
8087
|
|
8085
|
|
- float radius = hypot(offset[X_AXIS], offset[Y_AXIS]),
|
|
8088
|
+ float radius = HYPOT(offset[X_AXIS], offset[Y_AXIS]),
|
8086
|
8089
|
center_X = current_position[X_AXIS] + offset[X_AXIS],
|
8087
|
8090
|
center_Y = current_position[Y_AXIS] + offset[Y_AXIS],
|
8088
|
8091
|
linear_travel = target[Z_AXIS] - current_position[Z_AXIS],
|
|
@@ -8101,7 +8104,7 @@ void prepare_move_to_destination() {
|
8101
|
8104
|
if (angular_travel == 0 && current_position[X_AXIS] == target[X_AXIS] && current_position[Y_AXIS] == target[Y_AXIS])
|
8102
|
8105
|
angular_travel += RADIANS(360);
|
8103
|
8106
|
|
8104
|
|
- float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel));
|
|
8107
|
+ float mm_of_travel = HYPOT(angular_travel * radius, fabs(linear_travel));
|
8105
|
8108
|
if (mm_of_travel < 0.001) return;
|
8106
|
8109
|
uint16_t segments = floor(mm_of_travel / (MM_PER_ARC_SEGMENT));
|
8107
|
8110
|
if (segments == 0) segments = 1;
|
|
@@ -8137,7 +8140,7 @@ void prepare_move_to_destination() {
|
8137
|
8140
|
* This is important when there are successive arc motions.
|
8138
|
8141
|
*/
|
8139
|
8142
|
// Vector rotation matrix values
|
8140
|
|
- float cos_T = 1 - 0.5 * theta_per_segment * theta_per_segment; // Small angle approximation
|
|
8143
|
+ float cos_T = 1 - 0.5 * sq(theta_per_segment); // Small angle approximation
|
8141
|
8144
|
float sin_T = theta_per_segment;
|
8142
|
8145
|
|
8143
|
8146
|
float arc_target[NUM_AXIS];
|
|
@@ -8151,7 +8154,7 @@ void prepare_move_to_destination() {
|
8151
|
8154
|
// Initialize the extruder axis
|
8152
|
8155
|
arc_target[E_AXIS] = current_position[E_AXIS];
|
8153
|
8156
|
|
8154
|
|
- float feed_rate = feedrate * feedrate_multiplier / 60 / 100.0;
|
|
8157
|
+ float fr_mm_s = MMM_TO_MMS_SCALED(feedrate_mm_m);
|
8155
|
8158
|
|
8156
|
8159
|
millis_t next_idle_ms = millis() + 200UL;
|
8157
|
8160
|
|
|
@@ -8195,9 +8198,9 @@ void prepare_move_to_destination() {
|
8195
|
8198
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
8196
|
8199
|
adjust_delta(arc_target);
|
8197
|
8200
|
#endif
|
8198
|
|
- planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
8201
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder);
|
8199
|
8202
|
#else
|
8200
|
|
- planner.buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
8203
|
+ planner.buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder);
|
8201
|
8204
|
#endif
|
8202
|
8205
|
}
|
8203
|
8206
|
|
|
@@ -8207,9 +8210,9 @@ void prepare_move_to_destination() {
|
8207
|
8210
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
8208
|
8211
|
adjust_delta(target);
|
8209
|
8212
|
#endif
|
8210
|
|
- planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
8213
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder);
|
8211
|
8214
|
#else
|
8212
|
|
- planner.buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
8215
|
+ planner.buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder);
|
8213
|
8216
|
#endif
|
8214
|
8217
|
|
8215
|
8218
|
// As far as the parser is concerned, the position is now == target. In reality the
|
|
@@ -8222,7 +8225,7 @@ void prepare_move_to_destination() {
|
8222
|
8225
|
#if ENABLED(BEZIER_CURVE_SUPPORT)
|
8223
|
8226
|
|
8224
|
8227
|
void plan_cubic_move(const float offset[4]) {
|
8225
|
|
- cubic_b_spline(current_position, destination, offset, feedrate * feedrate_multiplier / 60 / 100.0, active_extruder);
|
|
8228
|
+ cubic_b_spline(current_position, destination, offset, MMM_TO_MMS_SCALED(feedrate_mm_m), active_extruder);
|
8226
|
8229
|
|
8227
|
8230
|
// As far as the parser is concerned, the position is now == target. In reality the
|
8228
|
8231
|
// motion control system might still be processing the action and the real tool position
|
|
@@ -8548,7 +8551,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
8548
|
8551
|
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS];
|
8549
|
8552
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
|
8550
|
8553
|
destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_mm[E_AXIS],
|
8551
|
|
- (EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_mm[E_AXIS], active_extruder);
|
|
8554
|
+ MMM_TO_MMS(EXTRUDER_RUNOUT_SPEED) * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_mm[E_AXIS], active_extruder);
|
8552
|
8555
|
current_position[E_AXIS] = oldepos;
|
8553
|
8556
|
destination[E_AXIS] = oldedes;
|
8554
|
8557
|
planner.set_e_position_mm(oldepos);
|