|
@@ -552,7 +552,7 @@ static void report_current_position();
|
552
|
552
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
|
553
|
553
|
#endif
|
554
|
554
|
calculate_delta(current_position);
|
555
|
|
- planner.set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
|
555
|
+ planner.set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
556
|
556
|
}
|
557
|
557
|
#endif
|
558
|
558
|
|
|
@@ -613,6 +613,11 @@ void enqueue_and_echo_commands_P(const char* pgcode) {
|
613
|
613
|
drain_queued_commands_P(); // first command executed asap (when possible)
|
614
|
614
|
}
|
615
|
615
|
|
|
616
|
+void clear_command_queue() {
|
|
617
|
+ cmd_queue_index_r = cmd_queue_index_w;
|
|
618
|
+ commands_in_queue = 0;
|
|
619
|
+}
|
|
620
|
+
|
616
|
621
|
/**
|
617
|
622
|
* Once a new command is in the ring buffer, call this to commit it
|
618
|
623
|
*/
|
|
@@ -1448,9 +1453,9 @@ inline void sync_plan_position() {
|
1448
|
1453
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1449
|
1454
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position);
|
1450
|
1455
|
#endif
|
1451
|
|
- planner.set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1456
|
+ planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1452
|
1457
|
}
|
1453
|
|
-inline void sync_plan_position_e() { planner.set_e_position(current_position[E_AXIS]); }
|
|
1458
|
+inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
|
1454
|
1459
|
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
1455
|
1460
|
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
1456
|
1461
|
|
|
@@ -1607,7 +1612,7 @@ static void setup_for_endstop_move() {
|
1607
|
1612
|
|
1608
|
1613
|
// Tell the planner where we ended up - Get this from the stepper handler
|
1609
|
1614
|
zPosition = stepper.get_axis_position_mm(Z_AXIS);
|
1610
|
|
- planner.set_position(
|
|
1615
|
+ planner.set_position_mm(
|
1611
|
1616
|
current_position[X_AXIS], current_position[Y_AXIS], zPosition,
|
1612
|
1617
|
current_position[E_AXIS]
|
1613
|
1618
|
);
|
|
@@ -3593,7 +3598,7 @@ inline void gcode_G28() {
|
3593
|
3598
|
* Get the current Z position and send it to the planner.
|
3594
|
3599
|
*
|
3595
|
3600
|
* >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
3596
|
|
- * (most recent planner.set_position/sync_plan_position)
|
|
3601
|
+ * (most recent planner.set_position_mm/sync_plan_position)
|
3597
|
3602
|
*
|
3598
|
3603
|
* >> zprobe_zoffset : Z distance from nozzle to Z probe
|
3599
|
3604
|
* (set by default, M851, EEPROM, or Menu)
|
|
@@ -5889,13 +5894,35 @@ inline void gcode_M400() { stepper.synchronize(); }
|
5889
|
5894
|
|
5890
|
5895
|
#endif // FILAMENT_WIDTH_SENSOR
|
5891
|
5896
|
|
|
5897
|
+#if DISABLED(DELTA) && DISABLED(SCARA)
|
|
5898
|
+ void set_current_position_from_planner() {
|
|
5899
|
+ stepper.synchronize();
|
|
5900
|
+ #if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
5901
|
+ vector_3 pos = planner.adjusted_position(); // values directly from steppers...
|
|
5902
|
+ current_position[X_AXIS] = pos.x;
|
|
5903
|
+ current_position[Y_AXIS] = pos.y;
|
|
5904
|
+ current_position[Z_AXIS] = pos.z;
|
|
5905
|
+ #else
|
|
5906
|
+ current_position[X_AXIS] = stepper.get_axis_position_mm(X_AXIS);
|
|
5907
|
+ current_position[Y_AXIS] = stepper.get_axis_position_mm(Y_AXIS);
|
|
5908
|
+ current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
5909
|
+ #endif
|
|
5910
|
+ sync_plan_position(); // ...re-apply to planner position
|
|
5911
|
+ }
|
|
5912
|
+#endif
|
|
5913
|
+
|
5892
|
5914
|
/**
|
5893
|
5915
|
* M410: Quickstop - Abort all planned moves
|
5894
|
5916
|
*
|
5895
|
5917
|
* This will stop the carriages mid-move, so most likely they
|
5896
|
5918
|
* will be out of sync with the stepper position after this.
|
5897
|
5919
|
*/
|
5898
|
|
-inline void gcode_M410() { stepper.quick_stop(); }
|
|
5920
|
+inline void gcode_M410() {
|
|
5921
|
+ stepper.quick_stop();
|
|
5922
|
+ #if DISABLED(DELTA) && DISABLED(SCARA)
|
|
5923
|
+ set_current_position_from_planner();
|
|
5924
|
+ #endif
|
|
5925
|
+}
|
5899
|
5926
|
|
5900
|
5927
|
|
5901
|
5928
|
#if ENABLED(MESH_BED_LEVELING)
|
|
@@ -7436,7 +7463,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
|
7436
|
7463
|
if (active_extruder_parked) {
|
7437
|
7464
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
7438
|
7465
|
// move duplicate extruder into correct duplication position.
|
7439
|
|
- planner.set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
7466
|
+ planner.set_position_mm(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
7440
|
7467
|
planner.buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
7441
|
7468
|
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[X_AXIS], 1);
|
7442
|
7469
|
sync_plan_position();
|
|
@@ -7989,7 +8016,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
7989
|
8016
|
(EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_unit[E_AXIS], active_extruder);
|
7990
|
8017
|
current_position[E_AXIS] = oldepos;
|
7991
|
8018
|
destination[E_AXIS] = oldedes;
|
7992
|
|
- planner.set_e_position(oldepos);
|
|
8019
|
+ planner.set_e_position_mm(oldepos);
|
7993
|
8020
|
previous_cmd_ms = ms; // refresh_cmd_timeout()
|
7994
|
8021
|
stepper.synchronize();
|
7995
|
8022
|
switch (active_extruder) {
|