|
@@ -149,7 +149,7 @@
|
149
|
149
|
* M84 - Disable steppers until next move,
|
150
|
150
|
* or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
151
|
151
|
* M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
152
|
|
- * M92 - Set axis_steps_per_unit - same syntax as G92
|
|
152
|
+ * M92 - Set planner.axis_steps_per_unit - same syntax as G92
|
153
|
153
|
* M104 - Set extruder target temp
|
154
|
154
|
* M105 - Read current temp
|
155
|
155
|
* M106 - Fan on
|
|
@@ -540,7 +540,7 @@ static void report_current_position();
|
540
|
540
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
|
541
|
541
|
#endif
|
542
|
542
|
calculate_delta(current_position);
|
543
|
|
- plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
|
543
|
+ planner.set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
544
|
544
|
}
|
545
|
545
|
#endif
|
546
|
546
|
|
|
@@ -817,7 +817,6 @@ void setup() {
|
817
|
817
|
lcd_init();
|
818
|
818
|
|
819
|
819
|
tp_init(); // Initialize temperature loop
|
820
|
|
- plan_init(); // Initialize planner;
|
821
|
820
|
|
822
|
821
|
#if ENABLED(DELTA) || ENABLED(SCARA)
|
823
|
822
|
// Vital to init kinematic equivalent for X0 Y0 Z0
|
|
@@ -1405,17 +1404,17 @@ inline void set_homing_bump_feedrate(AxisEnum axis) {
|
1405
|
1404
|
// (or from wherever it has been told it is located).
|
1406
|
1405
|
//
|
1407
|
1406
|
inline void line_to_current_position() {
|
1408
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
1407
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate / 60, active_extruder);
|
1409
|
1408
|
}
|
1410
|
1409
|
inline void line_to_z(float zPosition) {
|
1411
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
1410
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate / 60, active_extruder);
|
1412
|
1411
|
}
|
1413
|
1412
|
//
|
1414
|
1413
|
// line_to_destination
|
1415
|
1414
|
// Move the planner, not necessarily synced with current_position
|
1416
|
1415
|
//
|
1417
|
1416
|
inline void line_to_destination(float mm_m) {
|
1418
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m / 60, active_extruder);
|
|
1417
|
+ planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m / 60, active_extruder);
|
1419
|
1418
|
}
|
1420
|
1419
|
inline void line_to_destination() {
|
1421
|
1420
|
line_to_destination(feedrate);
|
|
@@ -1430,9 +1429,9 @@ inline void sync_plan_position() {
|
1430
|
1429
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1431
|
1430
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position);
|
1432
|
1431
|
#endif
|
1433
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1432
|
+ planner.set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1434
|
1433
|
}
|
1435
|
|
-inline void sync_plan_position_e() { plan_set_e_position(current_position[E_AXIS]); }
|
|
1434
|
+inline void sync_plan_position_e() { planner.set_e_position(current_position[E_AXIS]); }
|
1436
|
1435
|
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
1437
|
1436
|
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
1438
|
1437
|
|
|
@@ -1459,7 +1458,7 @@ static void setup_for_endstop_move() {
|
1459
|
1458
|
#endif
|
1460
|
1459
|
refresh_cmd_timeout();
|
1461
|
1460
|
calculate_delta(destination);
|
1462
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
1461
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
1463
|
1462
|
set_current_to_destination();
|
1464
|
1463
|
}
|
1465
|
1464
|
#endif
|
|
@@ -1470,21 +1469,21 @@ static void setup_for_endstop_move() {
|
1470
|
1469
|
|
1471
|
1470
|
static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
1472
|
1471
|
|
1473
|
|
- //plan_bed_level_matrix.debug("bed level before");
|
|
1472
|
+ //planner.bed_level_matrix.debug("bed level before");
|
1474
|
1473
|
|
1475
|
1474
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1476
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
1475
|
+ planner.bed_level_matrix.set_to_identity();
|
1477
|
1476
|
if (DEBUGGING(LEVELING)) {
|
1478
|
|
- vector_3 uncorrected_position = plan_get_position();
|
|
1477
|
+ vector_3 uncorrected_position = planner.adjusted_position();
|
1479
|
1478
|
DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
1480
|
1479
|
DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
1481
|
1480
|
}
|
1482
|
1481
|
#endif
|
1483
|
1482
|
|
1484
|
1483
|
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
1485
|
|
- plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
1484
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
1486
|
1485
|
|
1487
|
|
- vector_3 corrected_position = plan_get_position();
|
|
1486
|
+ vector_3 corrected_position = planner.adjusted_position();
|
1488
|
1487
|
current_position[X_AXIS] = corrected_position.x;
|
1489
|
1488
|
current_position[Y_AXIS] = corrected_position.y;
|
1490
|
1489
|
current_position[Z_AXIS] = corrected_position.z;
|
|
@@ -1502,7 +1501,7 @@ static void setup_for_endstop_move() {
|
1502
|
1501
|
|
1503
|
1502
|
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
1504
|
1503
|
|
1505
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
1504
|
+ planner.bed_level_matrix.set_to_identity();
|
1506
|
1505
|
|
1507
|
1506
|
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
1508
|
1507
|
vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
|
@@ -1515,9 +1514,9 @@ static void setup_for_endstop_move() {
|
1515
|
1514
|
planeNormal.z = -planeNormal.z;
|
1516
|
1515
|
}
|
1517
|
1516
|
|
1518
|
|
- plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
1517
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
1519
|
1518
|
|
1520
|
|
- vector_3 corrected_position = plan_get_position();
|
|
1519
|
+ vector_3 corrected_position = planner.adjusted_position();
|
1521
|
1520
|
|
1522
|
1521
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1523
|
1522
|
if (DEBUGGING(LEVELING)) {
|
|
@@ -1568,7 +1567,7 @@ static void setup_for_endstop_move() {
|
1568
|
1567
|
* is not where we said to go.
|
1569
|
1568
|
*/
|
1570
|
1569
|
long stop_steps = stepper.position(Z_AXIS);
|
1571
|
|
- float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS];
|
|
1570
|
+ float mm = start_z - float(start_steps - stop_steps) / planner.axis_steps_per_unit[Z_AXIS];
|
1572
|
1571
|
current_position[Z_AXIS] = mm;
|
1573
|
1572
|
|
1574
|
1573
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -1579,7 +1578,7 @@ static void setup_for_endstop_move() {
|
1579
|
1578
|
|
1580
|
1579
|
#else // !DELTA
|
1581
|
1580
|
|
1582
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
1581
|
+ planner.bed_level_matrix.set_to_identity();
|
1583
|
1582
|
feedrate = homing_feedrate[Z_AXIS];
|
1584
|
1583
|
|
1585
|
1584
|
// Move down until the Z probe (or endstop?) is triggered
|
|
@@ -1589,7 +1588,7 @@ static void setup_for_endstop_move() {
|
1589
|
1588
|
|
1590
|
1589
|
// Tell the planner where we ended up - Get this from the stepper handler
|
1591
|
1590
|
zPosition = stepper.get_axis_position_mm(Z_AXIS);
|
1592
|
|
- plan_set_position(
|
|
1591
|
+ planner.set_position(
|
1593
|
1592
|
current_position[X_AXIS], current_position[Y_AXIS], zPosition,
|
1594
|
1593
|
current_position[E_AXIS]
|
1595
|
1594
|
);
|
|
@@ -2552,7 +2551,7 @@ inline void gcode_G28() {
|
2552
|
2551
|
|
2553
|
2552
|
// For auto bed leveling, clear the level matrix
|
2554
|
2553
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2555
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
2554
|
+ planner.bed_level_matrix.set_to_identity();
|
2556
|
2555
|
#if ENABLED(DELTA)
|
2557
|
2556
|
reset_bed_level();
|
2558
|
2557
|
#endif
|
|
@@ -2630,7 +2629,7 @@ inline void gcode_G28() {
|
2630
|
2629
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
2631
|
2630
|
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
2632
|
2631
|
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
2633
|
|
- feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
|
2632
|
+ feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
2634
|
2633
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2635
|
2634
|
if (DEBUGGING(LEVELING)) {
|
2636
|
2635
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
|
|
@@ -3201,22 +3200,22 @@ inline void gcode_G28() {
|
3201
|
3200
|
|
3202
|
3201
|
#if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(DELTA)
|
3203
|
3202
|
if (DEBUGGING(LEVELING)) {
|
3204
|
|
- vector_3 corrected_position = plan_get_position();
|
|
3203
|
+ vector_3 corrected_position = planner.adjusted_position();
|
3205
|
3204
|
DEBUG_POS("BEFORE matrix.set_to_identity", corrected_position);
|
3206
|
3205
|
DEBUG_POS("BEFORE matrix.set_to_identity", current_position);
|
3207
|
3206
|
}
|
3208
|
3207
|
#endif
|
3209
|
3208
|
|
3210
|
3209
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
|
3211
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
3210
|
+ planner.bed_level_matrix.set_to_identity();
|
3212
|
3211
|
|
3213
|
3212
|
#if ENABLED(DELTA)
|
3214
|
3213
|
reset_bed_level();
|
3215
|
3214
|
#else //!DELTA
|
3216
|
3215
|
|
3217
|
|
- //vector_3 corrected_position = plan_get_position();
|
|
3216
|
+ //vector_3 corrected_position = planner.adjusted_position();
|
3218
|
3217
|
//corrected_position.debug("position before G29");
|
3219
|
|
- vector_3 uncorrected_position = plan_get_position();
|
|
3218
|
+ vector_3 uncorrected_position = planner.adjusted_position();
|
3220
|
3219
|
//uncorrected_position.debug("position during G29");
|
3221
|
3220
|
current_position[X_AXIS] = uncorrected_position.x;
|
3222
|
3221
|
current_position[Y_AXIS] = uncorrected_position.y;
|
|
@@ -3415,7 +3414,7 @@ inline void gcode_G28() {
|
3415
|
3414
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
3416
|
3415
|
z_tmp = 0;
|
3417
|
3416
|
|
3418
|
|
- apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
3417
|
+ apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
3419
|
3418
|
|
3420
|
3419
|
NOMORE(min_diff, eqnBVector[ind] - z_tmp);
|
3421
|
3420
|
|
|
@@ -3438,7 +3437,7 @@ inline void gcode_G28() {
|
3438
|
3437
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
3439
|
3438
|
z_tmp = 0;
|
3440
|
3439
|
|
3441
|
|
- apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
3440
|
+ apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
3442
|
3441
|
|
3443
|
3442
|
float diff = eqnBVector[ind] - z_tmp - min_diff;
|
3444
|
3443
|
if (diff >= 0.0)
|
|
@@ -3497,7 +3496,7 @@ inline void gcode_G28() {
|
3497
|
3496
|
#endif
|
3498
|
3497
|
#else // !DELTA
|
3499
|
3498
|
if (verbose_level > 0)
|
3500
|
|
- plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
|
3499
|
+ planner.bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
3501
|
3500
|
|
3502
|
3501
|
if (!dryrun) {
|
3503
|
3502
|
/**
|
|
@@ -3508,7 +3507,7 @@ inline void gcode_G28() {
|
3508
|
3507
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
3509
|
3508
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
3510
|
3509
|
z_tmp = current_position[Z_AXIS],
|
3511
|
|
- real_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
|
|
3510
|
+ real_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
3512
|
3511
|
|
3513
|
3512
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3514
|
3513
|
if (DEBUGGING(LEVELING)) {
|
|
@@ -3520,13 +3519,13 @@ inline void gcode_G28() {
|
3520
|
3519
|
#endif
|
3521
|
3520
|
|
3522
|
3521
|
// Apply the correction sending the Z probe offset
|
3523
|
|
- apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
3522
|
+ apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
3524
|
3523
|
|
3525
|
3524
|
/*
|
3526
|
3525
|
* Get the current Z position and send it to the planner.
|
3527
|
3526
|
*
|
3528
|
3527
|
* >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
3529
|
|
- * (most recent plan_set_position/sync_plan_position)
|
|
3528
|
+ * (most recent planner.set_position/sync_plan_position)
|
3530
|
3529
|
*
|
3531
|
3530
|
* >> zprobe_zoffset : Z distance from nozzle to Z probe
|
3532
|
3531
|
* (set by default, M851, EEPROM, or Menu)
|
|
@@ -4065,7 +4064,7 @@ inline void gcode_M42() {
|
4065
|
4064
|
reset_bed_level();
|
4066
|
4065
|
#else
|
4067
|
4066
|
// we don't do bed level correction in M48 because we want the raw data when we probe
|
4068
|
|
- plan_bed_level_matrix.set_to_identity();
|
|
4067
|
+ planner.bed_level_matrix.set_to_identity();
|
4069
|
4068
|
#endif
|
4070
|
4069
|
|
4071
|
4070
|
if (Z_start_location < Z_RAISE_BEFORE_PROBING * 2.0)
|
|
@@ -4454,10 +4453,7 @@ inline void gcode_M109() {
|
4454
|
4453
|
}
|
4455
|
4454
|
|
4456
|
4455
|
#if ENABLED(AUTOTEMP)
|
4457
|
|
- autotemp_enabled = code_seen('F');
|
4458
|
|
- if (autotemp_enabled) autotemp_factor = code_value();
|
4459
|
|
- if (code_seen('S')) autotemp_min = code_value();
|
4460
|
|
- if (code_seen('B')) autotemp_max = code_value();
|
|
4456
|
+ planner.autotemp_M109();
|
4461
|
4457
|
#endif
|
4462
|
4458
|
|
4463
|
4459
|
#if TEMP_RESIDENCY_TIME > 0
|
|
@@ -4897,15 +4893,15 @@ inline void gcode_M92() {
|
4897
|
4893
|
if (i == E_AXIS) {
|
4898
|
4894
|
float value = code_value();
|
4899
|
4895
|
if (value < 20.0) {
|
4900
|
|
- float factor = axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
|
4901
|
|
- max_e_jerk *= factor;
|
4902
|
|
- max_feedrate[i] *= factor;
|
4903
|
|
- axis_steps_per_sqr_second[i] *= factor;
|
|
4896
|
+ float factor = planner.axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
|
|
4897
|
+ planner.max_e_jerk *= factor;
|
|
4898
|
+ planner.max_feedrate[i] *= factor;
|
|
4899
|
+ planner.axis_steps_per_sqr_second[i] *= factor;
|
4904
|
4900
|
}
|
4905
|
|
- axis_steps_per_unit[i] = value;
|
|
4901
|
+ planner.axis_steps_per_unit[i] = value;
|
4906
|
4902
|
}
|
4907
|
4903
|
else {
|
4908
|
|
- axis_steps_per_unit[i] = code_value();
|
|
4904
|
+ planner.axis_steps_per_unit[i] = code_value();
|
4909
|
4905
|
}
|
4910
|
4906
|
}
|
4911
|
4907
|
}
|
|
@@ -4940,9 +4936,9 @@ static void report_current_position() {
|
4940
|
4936
|
SERIAL_EOL;
|
4941
|
4937
|
|
4942
|
4938
|
SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
|
4943
|
|
- SERIAL_PROTOCOL(delta[X_AXIS] / 90 * axis_steps_per_unit[X_AXIS]);
|
|
4939
|
+ SERIAL_PROTOCOL(delta[X_AXIS] / 90 * planner.axis_steps_per_unit[X_AXIS]);
|
4944
|
4940
|
SERIAL_PROTOCOLPGM(" Psi+Theta:");
|
4945
|
|
- SERIAL_PROTOCOL((delta[Y_AXIS] - delta[X_AXIS]) / 90 * axis_steps_per_unit[Y_AXIS]);
|
|
4941
|
+ SERIAL_PROTOCOL((delta[Y_AXIS] - delta[X_AXIS]) / 90 * planner.axis_steps_per_unit[Y_AXIS]);
|
4946
|
4942
|
SERIAL_EOL; SERIAL_EOL;
|
4947
|
4943
|
#endif
|
4948
|
4944
|
}
|
|
@@ -5083,17 +5079,17 @@ inline void gcode_M200() {
|
5083
|
5079
|
inline void gcode_M201() {
|
5084
|
5080
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
5085
|
5081
|
if (code_seen(axis_codes[i])) {
|
5086
|
|
- max_acceleration_units_per_sq_second[i] = code_value();
|
|
5082
|
+ planner.max_acceleration_units_per_sq_second[i] = code_value();
|
5087
|
5083
|
}
|
5088
|
5084
|
}
|
5089
|
5085
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
5090
|
|
- reset_acceleration_rates();
|
|
5086
|
+ planner.reset_acceleration_rates();
|
5091
|
5087
|
}
|
5092
|
5088
|
|
5093
|
5089
|
#if 0 // Not used for Sprinter/grbl gen6
|
5094
|
5090
|
inline void gcode_M202() {
|
5095
|
5091
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
5096
|
|
- if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
|
|
5092
|
+ if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * planner.axis_steps_per_unit[i];
|
5097
|
5093
|
}
|
5098
|
5094
|
}
|
5099
|
5095
|
#endif
|
|
@@ -5105,7 +5101,7 @@ inline void gcode_M201() {
|
5105
|
5101
|
inline void gcode_M203() {
|
5106
|
5102
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
5107
|
5103
|
if (code_seen(axis_codes[i])) {
|
5108
|
|
- max_feedrate[i] = code_value();
|
|
5104
|
+ planner.max_feedrate[i] = code_value();
|
5109
|
5105
|
}
|
5110
|
5106
|
}
|
5111
|
5107
|
}
|
|
@@ -5121,23 +5117,23 @@ inline void gcode_M203() {
|
5121
|
5117
|
*/
|
5122
|
5118
|
inline void gcode_M204() {
|
5123
|
5119
|
if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
5124
|
|
- travel_acceleration = acceleration = code_value();
|
5125
|
|
- SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", acceleration);
|
|
5120
|
+ planner.travel_acceleration = planner.acceleration = code_value();
|
|
5121
|
+ SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
|
5126
|
5122
|
SERIAL_EOL;
|
5127
|
5123
|
}
|
5128
|
5124
|
if (code_seen('P')) {
|
5129
|
|
- acceleration = code_value();
|
5130
|
|
- SERIAL_ECHOPAIR("Setting Print Acceleration: ", acceleration);
|
|
5125
|
+ planner.acceleration = code_value();
|
|
5126
|
+ SERIAL_ECHOPAIR("Setting Print Acceleration: ", planner.acceleration);
|
5131
|
5127
|
SERIAL_EOL;
|
5132
|
5128
|
}
|
5133
|
5129
|
if (code_seen('R')) {
|
5134
|
|
- retract_acceleration = code_value();
|
5135
|
|
- SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration);
|
|
5130
|
+ planner.retract_acceleration = code_value();
|
|
5131
|
+ SERIAL_ECHOPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
|
5136
|
5132
|
SERIAL_EOL;
|
5137
|
5133
|
}
|
5138
|
5134
|
if (code_seen('T')) {
|
5139
|
|
- travel_acceleration = code_value();
|
5140
|
|
- SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration);
|
|
5135
|
+ planner.travel_acceleration = code_value();
|
|
5136
|
+ SERIAL_ECHOPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
|
5141
|
5137
|
SERIAL_EOL;
|
5142
|
5138
|
}
|
5143
|
5139
|
}
|
|
@@ -5153,12 +5149,12 @@ inline void gcode_M204() {
|
5153
|
5149
|
* E = Max E Jerk (mm/s/s)
|
5154
|
5150
|
*/
|
5155
|
5151
|
inline void gcode_M205() {
|
5156
|
|
- if (code_seen('S')) minimumfeedrate = code_value();
|
5157
|
|
- if (code_seen('T')) mintravelfeedrate = code_value();
|
5158
|
|
- if (code_seen('B')) minsegmenttime = code_value();
|
5159
|
|
- if (code_seen('X')) max_xy_jerk = code_value();
|
5160
|
|
- if (code_seen('Z')) max_z_jerk = code_value();
|
5161
|
|
- if (code_seen('E')) max_e_jerk = code_value();
|
|
5152
|
+ if (code_seen('S')) planner.min_feedrate = code_value();
|
|
5153
|
+ if (code_seen('T')) planner.min_travel_feedrate = code_value();
|
|
5154
|
+ if (code_seen('B')) planner.min_segment_time = code_value();
|
|
5155
|
+ if (code_seen('X')) planner.max_xy_jerk = code_value();
|
|
5156
|
+ if (code_seen('Z')) planner.max_z_jerk = code_value();
|
|
5157
|
+ if (code_seen('E')) planner.max_e_jerk = code_value();
|
5162
|
5158
|
}
|
5163
|
5159
|
|
5164
|
5160
|
/**
|
|
@@ -6004,7 +6000,7 @@ inline void gcode_M503() {
|
6004
|
6000
|
|
6005
|
6001
|
#if ENABLED(DELTA)
|
6006
|
6002
|
#define RUNPLAN calculate_delta(destination); \
|
6007
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
6003
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
6008
|
6004
|
#else
|
6009
|
6005
|
#define RUNPLAN line_to_destination();
|
6010
|
6006
|
#endif
|
|
@@ -6097,8 +6093,8 @@ inline void gcode_M503() {
|
6097
|
6093
|
#if ENABLED(DELTA)
|
6098
|
6094
|
// Move XYZ to starting position, then E
|
6099
|
6095
|
calculate_delta(lastpos);
|
6100
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
6101
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
|
|
6096
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
6097
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
|
6102
|
6098
|
#else
|
6103
|
6099
|
// Move XY to starting position, then Z, then E
|
6104
|
6100
|
destination[X_AXIS] = lastpos[X_AXIS];
|
|
@@ -6292,7 +6288,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6292
|
6288
|
#ifdef XY_TRAVEL_SPEED
|
6293
|
6289
|
feedrate = XY_TRAVEL_SPEED;
|
6294
|
6290
|
#else
|
6295
|
|
- feedrate = min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]);
|
|
6291
|
+ feedrate = min(planner.max_feedrate[X_AXIS], planner.max_feedrate[Y_AXIS]);
|
6296
|
6292
|
#endif
|
6297
|
6293
|
}
|
6298
|
6294
|
|
|
@@ -6304,12 +6300,12 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6304
|
6300
|
if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() &&
|
6305
|
6301
|
(delayed_move_time || current_position[X_AXIS] != x_home_pos(active_extruder))) {
|
6306
|
6302
|
// Park old head: 1) raise 2) move to park position 3) lower
|
6307
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
6308
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
6309
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
6310
|
|
- current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
|
6311
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
6312
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
6303
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
6304
|
+ current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
6305
|
+ planner.buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
6306
|
+ current_position[E_AXIS], planner.max_feedrate[X_AXIS], active_extruder);
|
|
6307
|
+ planner.buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
|
6308
|
+ current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
6313
|
6309
|
stepper.synchronize();
|
6314
|
6310
|
}
|
6315
|
6311
|
|
|
@@ -7186,9 +7182,9 @@ void clamp_to_software_endstops(float target[3]) {
|
7186
|
7182
|
#if ENABLED(MESH_BED_LEVELING)
|
7187
|
7183
|
|
7188
|
7184
|
// This function is used to split lines on mesh borders so each segment is only part of one mesh area
|
7189
|
|
-void mesh_plan_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) {
|
|
7185
|
+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) {
|
7190
|
7186
|
if (!mbl.active) {
|
7191
|
|
- plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7187
|
+ planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
7192
|
7188
|
set_current_to_destination();
|
7193
|
7189
|
return;
|
7194
|
7190
|
}
|
|
@@ -7202,7 +7198,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7202
|
7198
|
iy = min(iy, MESH_NUM_Y_POINTS - 2);
|
7203
|
7199
|
if (pix == ix && piy == iy) {
|
7204
|
7200
|
// Start and end on same mesh square
|
7205
|
|
- plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7201
|
+ planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
7206
|
7202
|
set_current_to_destination();
|
7207
|
7203
|
return;
|
7208
|
7204
|
}
|
|
@@ -7241,7 +7237,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7241
|
7237
|
}
|
7242
|
7238
|
else {
|
7243
|
7239
|
// Already split on a border
|
7244
|
|
- plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
7240
|
+ planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
7245
|
7241
|
set_current_to_destination();
|
7246
|
7242
|
return;
|
7247
|
7243
|
}
|
|
@@ -7250,12 +7246,12 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7250
|
7246
|
destination[Y_AXIS] = ny;
|
7251
|
7247
|
destination[Z_AXIS] = nz;
|
7252
|
7248
|
destination[E_AXIS] = ne;
|
7253
|
|
- mesh_plan_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
|
|
7249
|
+ mesh_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
|
7254
|
7250
|
destination[X_AXIS] = x;
|
7255
|
7251
|
destination[Y_AXIS] = y;
|
7256
|
7252
|
destination[Z_AXIS] = z;
|
7257
|
7253
|
destination[E_AXIS] = e;
|
7258
|
|
- mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
|
7254
|
+ mesh_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
7259
|
7255
|
}
|
7260
|
7256
|
#endif // MESH_BED_LEVELING
|
7261
|
7257
|
|
|
@@ -7314,7 +7310,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7314
|
7310
|
//DEBUG_POS("prepare_move_delta", target);
|
7315
|
7311
|
//DEBUG_POS("prepare_move_delta", delta);
|
7316
|
7312
|
|
7317
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate / 60 * feedrate_multiplier / 100.0, active_extruder);
|
|
7313
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate / 60 * feedrate_multiplier / 100.0, active_extruder);
|
7318
|
7314
|
}
|
7319
|
7315
|
return true;
|
7320
|
7316
|
}
|
|
@@ -7331,9 +7327,9 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7331
|
7327
|
if (active_extruder_parked) {
|
7332
|
7328
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
7333
|
7329
|
// move duplicate extruder into correct duplication position.
|
7334
|
|
- plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
7335
|
|
- plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
7336
|
|
- current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
|
7330
|
+ planner.set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
7331
|
+ planner.buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
|
7332
|
+ current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[X_AXIS], 1);
|
7337
|
7333
|
sync_plan_position();
|
7338
|
7334
|
stepper.synchronize();
|
7339
|
7335
|
extruder_duplication_enabled = true;
|
|
@@ -7353,9 +7349,9 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7353
|
7349
|
}
|
7354
|
7350
|
delayed_move_time = 0;
|
7355
|
7351
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
7356
|
|
- plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
7357
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]), active_extruder);
|
7358
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
7352
|
+ 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);
|
|
7353
|
+ planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(planner.max_feedrate[X_AXIS], planner.max_feedrate[Y_AXIS]), active_extruder);
|
|
7354
|
+ 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);
|
7359
|
7355
|
active_extruder_parked = false;
|
7360
|
7356
|
}
|
7361
|
7357
|
}
|
|
@@ -7373,7 +7369,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7373
|
7369
|
}
|
7374
|
7370
|
else {
|
7375
|
7371
|
#if ENABLED(MESH_BED_LEVELING)
|
7376
|
|
- mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
7372
|
+ mesh_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
7377
|
7373
|
return false;
|
7378
|
7374
|
#else
|
7379
|
7375
|
line_to_destination(feedrate * feedrate_multiplier / 100.0);
|
|
@@ -7387,7 +7383,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
7387
|
7383
|
/**
|
7388
|
7384
|
* Prepare a single move and get ready for the next one
|
7389
|
7385
|
*
|
7390
|
|
- * (This may call plan_buffer_line several times to put
|
|
7386
|
+ * (This may call planner.buffer_line several times to put
|
7391
|
7387
|
* smaller moves into the planner for DELTA or SCARA.)
|
7392
|
7388
|
*/
|
7393
|
7389
|
void prepare_move() {
|
|
@@ -7531,9 +7527,9 @@ void plan_arc(
|
7531
|
7527
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
7532
|
7528
|
adjust_delta(arc_target);
|
7533
|
7529
|
#endif
|
7534
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
7530
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
7535
|
7531
|
#else
|
7536
|
|
- plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
7532
|
+ planner.buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
7537
|
7533
|
#endif
|
7538
|
7534
|
}
|
7539
|
7535
|
|
|
@@ -7543,9 +7539,9 @@ void plan_arc(
|
7543
|
7539
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
7544
|
7540
|
adjust_delta(target);
|
7545
|
7541
|
#endif
|
7546
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
7542
|
+ planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
7547
|
7543
|
#else
|
7548
|
|
- plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
7544
|
+ planner.buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
7549
|
7545
|
#endif
|
7550
|
7546
|
|
7551
|
7547
|
// As far as the parser is concerned, the position is now == target. In reality the
|
|
@@ -7762,7 +7758,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
7762
|
7758
|
if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) kill(PSTR(MSG_KILLED));
|
7763
|
7759
|
|
7764
|
7760
|
if (stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
|
7765
|
|
- && !ignore_stepper_queue && !blocks_queued()) {
|
|
7761
|
+ && !ignore_stepper_queue && !planner.blocks_queued()) {
|
7766
|
7762
|
#if ENABLED(DISABLE_INACTIVE_X)
|
7767
|
7763
|
disable_x();
|
7768
|
7764
|
#endif
|
|
@@ -7855,12 +7851,12 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
7855
|
7851
|
#endif
|
7856
|
7852
|
}
|
7857
|
7853
|
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS];
|
7858
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
|
7859
|
|
- destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS],
|
7860
|
|
- (EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], active_extruder);
|
|
7854
|
+ planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
|
|
7855
|
+ destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_unit[E_AXIS],
|
|
7856
|
+ (EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_unit[E_AXIS], active_extruder);
|
7861
|
7857
|
current_position[E_AXIS] = oldepos;
|
7862
|
7858
|
destination[E_AXIS] = oldedes;
|
7863
|
|
- plan_set_e_position(oldepos);
|
|
7859
|
+ planner.set_e_position(oldepos);
|
7864
|
7860
|
previous_cmd_ms = ms; // refresh_cmd_timeout()
|
7865
|
7861
|
stepper.synchronize();
|
7866
|
7862
|
switch (active_extruder) {
|
|
@@ -7900,7 +7896,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
7900
|
7896
|
handle_status_leds();
|
7901
|
7897
|
#endif
|
7902
|
7898
|
|
7903
|
|
- check_axes_activity();
|
|
7899
|
+ planner.check_axes_activity();
|
7904
|
7900
|
}
|
7905
|
7901
|
|
7906
|
7902
|
void kill(const char* lcd_msg) {
|