|
@@ -82,6 +82,7 @@ volatile uint8_t Planner::block_buffer_tail = 0;
|
82
|
82
|
|
83
|
83
|
float Planner::max_feedrate_mm_s[NUM_AXIS]; // Max speeds in mm per second
|
84
|
84
|
float Planner::axis_steps_per_mm[NUM_AXIS];
|
|
85
|
+float Planner::steps_to_mm[NUM_AXIS];
|
85
|
86
|
unsigned long Planner::max_acceleration_steps_per_s2[NUM_AXIS];
|
86
|
87
|
unsigned long Planner::max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software
|
87
|
88
|
|
|
@@ -783,23 +784,23 @@ void Planner::check_axes_activity() {
|
783
|
784
|
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
784
|
785
|
float delta_mm[6];
|
785
|
786
|
#if ENABLED(COREXY)
|
786
|
|
- delta_mm[X_HEAD] = dx / axis_steps_per_mm[A_AXIS];
|
787
|
|
- delta_mm[Y_HEAD] = dy / axis_steps_per_mm[B_AXIS];
|
788
|
|
- delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
|
789
|
|
- delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_mm[A_AXIS];
|
790
|
|
- delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_mm[B_AXIS];
|
|
787
|
+ delta_mm[X_HEAD] = dx * steps_to_mm[A_AXIS];
|
|
788
|
+ delta_mm[Y_HEAD] = dy * steps_to_mm[B_AXIS];
|
|
789
|
+ delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS];
|
|
790
|
+ delta_mm[A_AXIS] = (dx + dy) * steps_to_mm[A_AXIS];
|
|
791
|
+ delta_mm[B_AXIS] = (dx - dy) * steps_to_mm[B_AXIS];
|
791
|
792
|
#elif ENABLED(COREXZ)
|
792
|
|
- delta_mm[X_HEAD] = dx / axis_steps_per_mm[A_AXIS];
|
793
|
|
- delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
|
794
|
|
- delta_mm[Z_HEAD] = dz / axis_steps_per_mm[C_AXIS];
|
795
|
|
- delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_mm[A_AXIS];
|
796
|
|
- delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_mm[C_AXIS];
|
|
793
|
+ delta_mm[X_HEAD] = dx * steps_to_mm[A_AXIS];
|
|
794
|
+ delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS];
|
|
795
|
+ delta_mm[Z_HEAD] = dz * steps_to_mm[C_AXIS];
|
|
796
|
+ delta_mm[A_AXIS] = (dx + dz) * steps_to_mm[A_AXIS];
|
|
797
|
+ delta_mm[C_AXIS] = (dx - dz) * steps_to_mm[C_AXIS];
|
797
|
798
|
#elif ENABLED(COREYZ)
|
798
|
|
- delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
|
799
|
|
- delta_mm[Y_HEAD] = dy / axis_steps_per_mm[B_AXIS];
|
800
|
|
- delta_mm[Z_HEAD] = dz / axis_steps_per_mm[C_AXIS];
|
801
|
|
- delta_mm[B_AXIS] = (dy + dz) / axis_steps_per_mm[B_AXIS];
|
802
|
|
- delta_mm[C_AXIS] = (dy - dz) / axis_steps_per_mm[C_AXIS];
|
|
799
|
+ delta_mm[X_AXIS] = dx * steps_to_mm[X_AXIS];
|
|
800
|
+ delta_mm[Y_HEAD] = dy * steps_to_mm[B_AXIS];
|
|
801
|
+ delta_mm[Z_HEAD] = dz * steps_to_mm[C_AXIS];
|
|
802
|
+ delta_mm[B_AXIS] = (dy + dz) * steps_to_mm[B_AXIS];
|
|
803
|
+ delta_mm[C_AXIS] = (dy - dz) * steps_to_mm[C_AXIS];
|
803
|
804
|
#endif
|
804
|
805
|
#else
|
805
|
806
|
float delta_mm[4];
|
|
@@ -808,12 +809,12 @@ void Planner::check_axes_activity() {
|
808
|
809
|
// so calculate distance in steps first, then do one division
|
809
|
810
|
// at the end to get millimeters
|
810
|
811
|
#else
|
811
|
|
- delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
|
812
|
|
- delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
|
813
|
|
- delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
|
|
812
|
+ delta_mm[X_AXIS] = dx * steps_to_mm[X_AXIS];
|
|
813
|
+ delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS];
|
|
814
|
+ delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS];
|
814
|
815
|
#endif
|
815
|
816
|
#endif
|
816
|
|
- delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
|
|
817
|
+ delta_mm[E_AXIS] = (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
|
817
|
818
|
|
818
|
819
|
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
|
819
|
820
|
block->millimeters = fabs(delta_mm[E_AXIS]);
|
|
@@ -833,7 +834,7 @@ void Planner::check_axes_activity() {
|
833
|
834
|
#endif
|
834
|
835
|
)
|
835
|
836
|
#if ENABLED(DELTA)
|
836
|
|
- / axis_steps_per_mm[X_AXIS]
|
|
837
|
+ * steps_to_mm[X_AXIS]
|
837
|
838
|
#endif
|
838
|
839
|
;
|
839
|
840
|
}
|
|
@@ -1176,6 +1177,7 @@ void Planner::check_axes_activity() {
|
1176
|
1177
|
void Planner::set_e_position_mm(const float& e) {
|
1177
|
1178
|
position[E_AXIS] = lround(e * axis_steps_per_mm[E_AXIS]);
|
1178
|
1179
|
stepper.set_e_position(position[E_AXIS]);
|
|
1180
|
+ previous_speed[E_AXIS] = 0.0;
|
1179
|
1181
|
}
|
1180
|
1182
|
|
1181
|
1183
|
// Recalculate the steps/s^2 acceleration rates, based on the mm/s^2
|
|
@@ -1184,6 +1186,13 @@ void Planner::reset_acceleration_rates() {
|
1184
|
1186
|
max_acceleration_steps_per_s2[i] = max_acceleration_mm_per_s2[i] * axis_steps_per_mm[i];
|
1185
|
1187
|
}
|
1186
|
1188
|
|
|
1189
|
+// Recalculate position, steps_to_mm if axis_steps_per_mm changes!
|
|
1190
|
+void Planner::refresh_positioning() {
|
|
1191
|
+ LOOP_XYZE(i) planner.steps_to_mm[i] = 1.0 / planner.axis_steps_per_mm[i];
|
|
1192
|
+ set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1193
|
+ reset_acceleration_rates();
|
|
1194
|
+}
|
|
1195
|
+
|
1187
|
1196
|
#if ENABLED(AUTOTEMP)
|
1188
|
1197
|
|
1189
|
1198
|
void Planner::autotemp_M109() {
|