|
@@ -105,11 +105,10 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
|
105
|
105
|
|
106
|
106
|
int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
|
107
|
107
|
|
108
|
|
-// Initialized by settings.load()
|
109
|
|
-float Planner::e_factor[EXTRUDERS], // The flow percentage and volumetric multiplier combine to scale E movement
|
110
|
|
- Planner::filament_size[EXTRUDERS], // As a baseline for the multiplier, filament diameter
|
|
108
|
+float Planner::e_factor[EXTRUDERS], // The flow percentage and volumetric multiplier combine to scale E movement
|
|
109
|
+ Planner::filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
|
111
|
110
|
Planner::volumetric_area_nominal = CIRCLE_AREA((DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5), // Nominal cross-sectional area
|
112
|
|
- Planner::volumetric_multiplier[EXTRUDERS]; // May be auto-adjusted by a filament width sensor
|
|
111
|
+ Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
113
|
112
|
|
114
|
113
|
uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
|
115
|
114
|
Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
|
|
@@ -129,12 +128,11 @@ float Planner::min_feedrate_mm_s,
|
129
|
128
|
#if ABL_PLANAR
|
130
|
129
|
matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
|
131
|
130
|
#endif
|
132
|
|
-#endif
|
133
|
|
-
|
134
|
|
-#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
135
|
|
- float Planner::z_fade_height, // Initialized by settings.load()
|
136
|
|
- Planner::inverse_z_fade_height,
|
137
|
|
- Planner::last_fade_z;
|
|
131
|
+ #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
132
|
+ float Planner::z_fade_height, // Initialized by settings.load()
|
|
133
|
+ Planner::inverse_z_fade_height,
|
|
134
|
+ Planner::last_fade_z;
|
|
135
|
+ #endif
|
138
|
136
|
#endif
|
139
|
137
|
|
140
|
138
|
#if ENABLED(AUTOTEMP)
|
|
@@ -146,7 +144,7 @@ float Planner::min_feedrate_mm_s,
|
146
|
144
|
|
147
|
145
|
// private:
|
148
|
146
|
|
149
|
|
-long Planner::position[NUM_AXIS] = { 0 };
|
|
147
|
+int32_t Planner::position[NUM_AXIS] = { 0 };
|
150
|
148
|
|
151
|
149
|
uint32_t Planner::cutoff_long;
|
152
|
150
|
|
|
@@ -166,8 +164,7 @@ float Planner::previous_speed[NUM_AXIS],
|
166
|
164
|
|
167
|
165
|
#if ENABLED(LIN_ADVANCE)
|
168
|
166
|
float Planner::extruder_advance_k, // Initialized by settings.load()
|
169
|
|
- Planner::advance_ed_ratio, // Initialized by settings.load()
|
170
|
|
- Planner::position_float[NUM_AXIS] = { 0 };
|
|
167
|
+ Planner::advance_ed_ratio; // Initialized by settings.load()
|
171
|
168
|
#endif
|
172
|
169
|
|
173
|
170
|
#if ENABLED(ULTRA_LCD)
|
|
@@ -183,9 +180,6 @@ Planner::Planner() { init(); }
|
183
|
180
|
void Planner::init() {
|
184
|
181
|
block_buffer_head = block_buffer_tail = 0;
|
185
|
182
|
ZERO(position);
|
186
|
|
- #if ENABLED(LIN_ADVANCE)
|
187
|
|
- ZERO(position_float);
|
188
|
|
- #endif
|
189
|
183
|
ZERO(previous_speed);
|
190
|
184
|
previous_nominal_speed = 0.0;
|
191
|
185
|
#if ABL_PLANAR
|
|
@@ -571,30 +565,9 @@ void Planner::calculate_volumetric_multipliers() {
|
571
|
565
|
*/
|
572
|
566
|
void Planner::apply_leveling(float &rx, float &ry, float &rz) {
|
573
|
567
|
|
574
|
|
- if (!planner.leveling_active) return;
|
575
|
|
-
|
576
|
|
- #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
577
|
|
- const float fade_scaling_factor = fade_scaling_factor_for_z(rz);
|
578
|
|
- if (!fade_scaling_factor) return;
|
579
|
|
- #else
|
580
|
|
- constexpr float fade_scaling_factor = 1.0;
|
581
|
|
- #endif
|
|
568
|
+ if (!leveling_active) return;
|
582
|
569
|
|
583
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
584
|
|
-
|
585
|
|
- rz += ubl.get_z_correction(rx, ry) * fade_scaling_factor;
|
586
|
|
-
|
587
|
|
- #elif ENABLED(MESH_BED_LEVELING)
|
588
|
|
-
|
589
|
|
- rz += mbl.get_z(rx, ry
|
590
|
|
- #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
591
|
|
- , fade_scaling_factor
|
592
|
|
- #endif
|
593
|
|
- );
|
594
|
|
-
|
595
|
|
- #elif ABL_PLANAR
|
596
|
|
-
|
597
|
|
- UNUSED(fade_scaling_factor);
|
|
570
|
+ #if ABL_PLANAR
|
598
|
571
|
|
599
|
572
|
float dx = rx - (X_TILT_FULCRUM),
|
600
|
573
|
dy = ry - (Y_TILT_FULCRUM);
|
|
@@ -604,80 +577,79 @@ void Planner::calculate_volumetric_multipliers() {
|
604
|
577
|
rx = dx + X_TILT_FULCRUM;
|
605
|
578
|
ry = dy + Y_TILT_FULCRUM;
|
606
|
579
|
|
607
|
|
- #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
608
|
|
-
|
609
|
|
- float tmp[XYZ] = { rx, ry, 0 };
|
610
|
|
- rz += bilinear_z_offset(tmp) * fade_scaling_factor;
|
611
|
|
-
|
612
|
|
- #endif
|
613
|
|
- }
|
614
|
|
-
|
615
|
|
- void Planner::unapply_leveling(float raw[XYZ]) {
|
616
|
|
-
|
617
|
|
- if (!planner.leveling_active) return;
|
618
|
|
-
|
619
|
|
- #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
620
|
|
- if (z_fade_height && raw[Z_AXIS] >= z_fade_height) return;
|
621
|
|
- #endif
|
622
|
|
-
|
623
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
624
|
|
-
|
625
|
|
- const float z_correct = ubl.get_z_correction(raw[X_AXIS], raw[Y_AXIS]);
|
626
|
|
- float z_raw = raw[Z_AXIS] - z_correct;
|
|
580
|
+ #else
|
627
|
581
|
|
628
|
582
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
583
|
+ const float fade_scaling_factor = fade_scaling_factor_for_z(rz);
|
|
584
|
+ if (!fade_scaling_factor) return;
|
|
585
|
+ #elif HAS_MESH
|
|
586
|
+ constexpr float fade_scaling_factor = 1.0;
|
|
587
|
+ #endif
|
629
|
588
|
|
630
|
|
- // for P=physical_z, L=raw_z, M=mesh_z, H=fade_height,
|
631
|
|
- // Given P=L+M(1-L/H) (faded mesh correction formula for L<H)
|
632
|
|
- // then L=P-M(1-L/H)
|
633
|
|
- // so L=P-M+ML/H
|
634
|
|
- // so L-ML/H=P-M
|
635
|
|
- // so L(1-M/H)=P-M
|
636
|
|
- // so L=(P-M)/(1-M/H) for L<H
|
637
|
|
-
|
638
|
|
- if (planner.z_fade_height) {
|
639
|
|
- if (z_raw >= planner.z_fade_height)
|
640
|
|
- z_raw = raw[Z_AXIS];
|
641
|
|
- else
|
642
|
|
- z_raw /= 1.0 - z_correct * planner.inverse_z_fade_height;
|
643
|
|
- }
|
|
589
|
+ #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
590
|
+ const float raw[XYZ] = { rx, ry, 0 };
|
|
591
|
+ #endif
|
644
|
592
|
|
645
|
|
- #endif // ENABLE_LEVELING_FADE_HEIGHT
|
|
593
|
+ rz += (
|
|
594
|
+ #if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
595
|
+ ubl.get_z_correction(rx, ry) * fade_scaling_factor
|
|
596
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
597
|
+ mbl.get_z(rx, ry
|
|
598
|
+ #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
599
|
+ , fade_scaling_factor
|
|
600
|
+ #endif
|
|
601
|
+ )
|
|
602
|
+ #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
603
|
+ bilinear_z_offset(raw) * fade_scaling_factor
|
|
604
|
+ #else
|
|
605
|
+ 0
|
|
606
|
+ #endif
|
|
607
|
+ );
|
646
|
608
|
|
647
|
|
- raw[Z_AXIS] = z_raw;
|
|
609
|
+ #endif
|
|
610
|
+ }
|
648
|
611
|
|
649
|
|
- #elif ENABLED(MESH_BED_LEVELING)
|
|
612
|
+ void Planner::unapply_leveling(float raw[XYZ]) {
|
650
|
613
|
|
651
|
|
- #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
652
|
|
- const float c = mbl.get_z(raw[X_AXIS], raw[Y_AXIS], 1.0);
|
653
|
|
- raw[Z_AXIS] = (z_fade_height * (raw[Z_AXIS] - c)) / (z_fade_height - c);
|
654
|
|
- #else
|
655
|
|
- raw[Z_AXIS] -= mbl.get_z(raw[X_AXIS], raw[Y_AXIS]);
|
656
|
|
- #endif
|
|
614
|
+ if (!leveling_active) return;
|
657
|
615
|
|
658
|
|
- #elif ABL_PLANAR
|
|
616
|
+ #if ABL_PLANAR
|
659
|
617
|
|
660
|
618
|
matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
|
661
|
619
|
|
662
|
620
|
float dx = raw[X_AXIS] - (X_TILT_FULCRUM),
|
663
|
|
- dy = raw[Y_AXIS] - (Y_TILT_FULCRUM),
|
664
|
|
- dz = raw[Z_AXIS];
|
|
621
|
+ dy = raw[Y_AXIS] - (Y_TILT_FULCRUM);
|
665
|
622
|
|
666
|
|
- apply_rotation_xyz(inverse, dx, dy, dz);
|
|
623
|
+ apply_rotation_xyz(inverse, dx, dy, raw[Z_AXIS]);
|
667
|
624
|
|
668
|
625
|
raw[X_AXIS] = dx + X_TILT_FULCRUM;
|
669
|
626
|
raw[Y_AXIS] = dy + Y_TILT_FULCRUM;
|
670
|
|
- raw[Z_AXIS] = dz;
|
671
|
627
|
|
672
|
|
- #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
628
|
+ #else
|
673
|
629
|
|
674
|
630
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
675
|
|
- const float c = bilinear_z_offset(raw);
|
676
|
|
- raw[Z_AXIS] = (z_fade_height * (raw[Z_AXIS]) - c) / (z_fade_height - c);
|
677
|
|
- #else
|
678
|
|
- raw[Z_AXIS] -= bilinear_z_offset(raw);
|
|
631
|
+ const float fade_scaling_factor = fade_scaling_factor_for_z(raw[Z_AXIS]);
|
|
632
|
+ if (!fade_scaling_factor) return;
|
|
633
|
+ #elif HAS_MESH
|
|
634
|
+ constexpr float fade_scaling_factor = 1.0;
|
679
|
635
|
#endif
|
680
|
636
|
|
|
637
|
+ raw[Z_AXIS] -= (
|
|
638
|
+ #if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
639
|
+ ubl.get_z_correction(raw[X_AXIS], raw[Y_AXIS]) * fade_scaling_factor
|
|
640
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
641
|
+ mbl.get_z(raw[X_AXIS], raw[Y_AXIS]
|
|
642
|
+ #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
643
|
+ , fade_scaling_factor
|
|
644
|
+ #endif
|
|
645
|
+ )
|
|
646
|
+ #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
647
|
+ bilinear_z_offset(raw) * fade_scaling_factor
|
|
648
|
+ #else
|
|
649
|
+ 0
|
|
650
|
+ #endif
|
|
651
|
+ );
|
|
652
|
+
|
681
|
653
|
#endif
|
682
|
654
|
}
|
683
|
655
|
|
|
@@ -714,13 +686,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
714
|
686
|
}
|
715
|
687
|
#endif
|
716
|
688
|
|
717
|
|
- #if ENABLED(LIN_ADVANCE)
|
718
|
|
- const float mm_D_float = SQRT(sq(a - position_float[X_AXIS]) + sq(b - position_float[Y_AXIS]));
|
719
|
|
- #endif
|
720
|
|
-
|
721
|
|
- const long da = target[X_AXIS] - position[X_AXIS],
|
722
|
|
- db = target[Y_AXIS] - position[Y_AXIS],
|
723
|
|
- dc = target[Z_AXIS] - position[Z_AXIS];
|
|
689
|
+ const int32_t da = target[X_AXIS] - position[X_AXIS],
|
|
690
|
+ db = target[Y_AXIS] - position[Y_AXIS],
|
|
691
|
+ dc = target[Z_AXIS] - position[Z_AXIS];
|
724
|
692
|
|
725
|
693
|
/*
|
726
|
694
|
SERIAL_ECHOPAIR(" Planner FR:", fr_mm_s);
|
|
@@ -745,19 +713,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
745
|
713
|
SERIAL_EOL();
|
746
|
714
|
//*/
|
747
|
715
|
|
748
|
|
- // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
|
749
|
|
- if (DEBUGGING(DRYRUN)) {
|
750
|
|
- position[E_AXIS] = target[E_AXIS];
|
751
|
|
- #if ENABLED(LIN_ADVANCE)
|
752
|
|
- position_float[E_AXIS] = e;
|
753
|
|
- #endif
|
754
|
|
- }
|
755
|
|
-
|
756
|
|
- long de = target[E_AXIS] - position[E_AXIS];
|
757
|
|
-
|
758
|
|
- #if ENABLED(LIN_ADVANCE)
|
759
|
|
- float de_float = e - position_float[E_AXIS]; // Should this include e_factor?
|
760
|
|
- #endif
|
|
716
|
+ int32_t de = target[E_AXIS] - position[E_AXIS];
|
761
|
717
|
|
762
|
718
|
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
763
|
719
|
if (de) {
|
|
@@ -765,10 +721,6 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
765
|
721
|
if (thermalManager.tooColdToExtrude(extruder)) {
|
766
|
722
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
767
|
723
|
de = 0; // no difference
|
768
|
|
- #if ENABLED(LIN_ADVANCE)
|
769
|
|
- position_float[E_AXIS] = e;
|
770
|
|
- de_float = 0;
|
771
|
|
- #endif
|
772
|
724
|
SERIAL_ECHO_START();
|
773
|
725
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
774
|
726
|
}
|
|
@@ -777,10 +729,6 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
777
|
729
|
if (labs(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
|
778
|
730
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
779
|
731
|
de = 0; // no difference
|
780
|
|
- #if ENABLED(LIN_ADVANCE)
|
781
|
|
- position_float[E_AXIS] = e;
|
782
|
|
- de_float = 0;
|
783
|
|
- #endif
|
784
|
732
|
SERIAL_ECHO_START();
|
785
|
733
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
786
|
734
|
}
|
|
@@ -1060,7 +1008,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1060
|
1008
|
#endif
|
1061
|
1009
|
);
|
1062
|
1010
|
}
|
1063
|
|
- const float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
|
1011
|
+ float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
1064
|
1012
|
|
1065
|
1013
|
// Calculate moves/second for this move. No divide by zero due to previous checks.
|
1066
|
1014
|
float inverse_mm_s = fr_mm_s * inverse_millimeters;
|
|
@@ -1384,31 +1332,28 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1384
|
1332
|
previous_safe_speed = safe_speed;
|
1385
|
1333
|
|
1386
|
1334
|
#if ENABLED(LIN_ADVANCE)
|
1387
|
|
-
|
1388
|
|
- //
|
1389
|
|
- // Use LIN_ADVANCE for blocks if all these are true:
|
1390
|
|
- //
|
1391
|
|
- // esteps : We have E steps todo (a printing move)
|
1392
|
|
- //
|
1393
|
|
- // block->steps[X_AXIS] || block->steps[Y_AXIS] : We have a movement in XY direction (i.e., not retract / prime).
|
1394
|
|
- //
|
1395
|
|
- // extruder_advance_k : There is an advance factor set.
|
1396
|
|
- //
|
1397
|
|
- // block->steps[E_AXIS] != block->step_event_count : A problem occurs if the move before a retract is too small.
|
1398
|
|
- // In that case, the retract and move will be executed together.
|
1399
|
|
- // This leads to too many advance steps due to a huge e_acceleration.
|
1400
|
|
- // The math is good, but we must avoid retract moves with advance!
|
1401
|
|
- // de_float > 0.0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
|
1402
|
|
- //
|
1403
|
|
- block->use_advance_lead = esteps
|
1404
|
|
- && (block->steps[X_AXIS] || block->steps[Y_AXIS])
|
|
1335
|
+ /**
|
|
1336
|
+ *
|
|
1337
|
+ * Use LIN_ADVANCE for blocks if all these are true:
|
|
1338
|
+ *
|
|
1339
|
+ * esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS]) : This is a print move
|
|
1340
|
+ *
|
|
1341
|
+ * extruder_advance_k : There is an advance factor set.
|
|
1342
|
+ *
|
|
1343
|
+ * esteps != block->step_event_count : A problem occurs if the move before a retract is too small.
|
|
1344
|
+ * In that case, the retract and move will be executed together.
|
|
1345
|
+ * This leads to too many advance steps due to a huge e_acceleration.
|
|
1346
|
+ * The math is good, but we must avoid retract moves with advance!
|
|
1347
|
+ * de > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
|
|
1348
|
+ */
|
|
1349
|
+ block->use_advance_lead = esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS])
|
1405
|
1350
|
&& extruder_advance_k
|
1406
|
1351
|
&& (uint32_t)esteps != block->step_event_count
|
1407
|
|
- && de_float > 0.0;
|
|
1352
|
+ && de > 0;
|
1408
|
1353
|
if (block->use_advance_lead)
|
1409
|
1354
|
block->abs_adv_steps_multiplier8 = LROUND(
|
1410
|
1355
|
extruder_advance_k
|
1411
|
|
- * (UNEAR_ZERO(advance_ed_ratio) ? de_float / mm_D_float : advance_ed_ratio) // Use the fixed ratio, if set
|
|
1356
|
+ * (UNEAR_ZERO(advance_ed_ratio) ? de * steps_to_mm[E_AXIS_N] / HYPOT(da * steps_to_mm[X_AXIS], db * steps_to_mm[Y_AXIS]) : advance_ed_ratio) // Use the fixed ratio, if set
|
1412
|
1357
|
* (block->nominal_speed / (float)block->nominal_rate)
|
1413
|
1358
|
* axis_steps_per_mm[E_AXIS_N] * 256.0
|
1414
|
1359
|
);
|
|
@@ -1422,12 +1367,6 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1422
|
1367
|
|
1423
|
1368
|
// Update the position (only when a move was queued)
|
1424
|
1369
|
COPY(position, target);
|
1425
|
|
- #if ENABLED(LIN_ADVANCE)
|
1426
|
|
- position_float[X_AXIS] = a;
|
1427
|
|
- position_float[Y_AXIS] = b;
|
1428
|
|
- position_float[Z_AXIS] = c;
|
1429
|
|
- position_float[E_AXIS] = e;
|
1430
|
|
- #endif
|
1431
|
1370
|
|
1432
|
1371
|
recalculate();
|
1433
|
1372
|
|
|
@@ -1449,16 +1388,10 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
|
1449
|
1388
|
#else
|
1450
|
1389
|
#define _EINDEX E_AXIS
|
1451
|
1390
|
#endif
|
1452
|
|
- const long na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
|
1453
|
|
- nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
|
1454
|
|
- nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
|
1455
|
|
- ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
|
1456
|
|
- #if ENABLED(LIN_ADVANCE)
|
1457
|
|
- position_float[X_AXIS] = a;
|
1458
|
|
- position_float[Y_AXIS] = b;
|
1459
|
|
- position_float[Z_AXIS] = c;
|
1460
|
|
- position_float[E_AXIS] = e;
|
1461
|
|
- #endif
|
|
1391
|
+ const int32_t na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
|
|
1392
|
+ nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
|
|
1393
|
+ nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
|
|
1394
|
+ ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
|
1462
|
1395
|
stepper.set_position(na, nb, nc, ne);
|
1463
|
1396
|
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
|
1464
|
1397
|
ZERO(previous_speed);
|
|
@@ -1483,16 +1416,8 @@ void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
|
1483
|
1416
|
* Sync from the stepper positions. (e.g., after an interrupted move)
|
1484
|
1417
|
*/
|
1485
|
1418
|
void Planner::sync_from_steppers() {
|
1486
|
|
- LOOP_XYZE(i) {
|
|
1419
|
+ LOOP_XYZE(i)
|
1487
|
1420
|
position[i] = stepper.position((AxisEnum)i);
|
1488
|
|
- #if ENABLED(LIN_ADVANCE)
|
1489
|
|
- position_float[i] = position[i] * steps_to_mm[i
|
1490
|
|
- #if ENABLED(DISTINCT_E_FACTORS)
|
1491
|
|
- + (i == E_AXIS ? active_extruder : 0)
|
1492
|
|
- #endif
|
1493
|
|
- ];
|
1494
|
|
- #endif
|
1495
|
|
- }
|
1496
|
1421
|
}
|
1497
|
1422
|
|
1498
|
1423
|
/**
|
|
@@ -1506,9 +1431,6 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
|
1506
|
1431
|
const uint8_t axis_index = axis;
|
1507
|
1432
|
#endif
|
1508
|
1433
|
position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
|
1509
|
|
- #if ENABLED(LIN_ADVANCE)
|
1510
|
|
- position_float[axis] = v;
|
1511
|
|
- #endif
|
1512
|
1434
|
stepper.set_position(axis, v);
|
1513
|
1435
|
previous_speed[axis] = 0.0;
|
1514
|
1436
|
}
|