|
@@ -673,10 +673,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
673
|
673
|
|
674
|
674
|
#if ENABLED(LIN_ADVANCE)
|
675
|
675
|
const float target_float[XYZE] = { a, b, c, e },
|
676
|
|
- de_float = target_float[E_AXIS] - position_float[E_AXIS],
|
677
|
676
|
mm_D_float = sqrt(sq(target_float[X_AXIS] - position_float[X_AXIS]) + sq(target_float[Y_AXIS] - position_float[Y_AXIS]));
|
678
|
|
-
|
679
|
|
- memcpy(position_float, target_float, sizeof(position_float));
|
680
|
677
|
#endif
|
681
|
678
|
|
682
|
679
|
const long da = target[X_AXIS] - position[X_AXIS],
|
|
@@ -707,15 +704,27 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
707
|
704
|
//*/
|
708
|
705
|
|
709
|
706
|
// DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
|
710
|
|
- if (DEBUGGING(DRYRUN)) position[E_AXIS] = target[E_AXIS];
|
|
707
|
+ if (DEBUGGING(DRYRUN)) {
|
|
708
|
+ position[E_AXIS] = target[E_AXIS];
|
|
709
|
+ #if ENABLED(LIN_ADVANCE)
|
|
710
|
+ position_float[E_AXIS] = target_float[E_AXIS];
|
|
711
|
+ #endif
|
|
712
|
+ }
|
711
|
713
|
|
712
|
714
|
long de = target[E_AXIS] - position[E_AXIS];
|
|
715
|
+ #if ENABLED(LIN_ADVANCE)
|
|
716
|
+ float de_float = target_float[E_AXIS] - position_float[E_AXIS];
|
|
717
|
+ #endif
|
713
|
718
|
|
714
|
719
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
715
|
720
|
if (de) {
|
716
|
721
|
if (thermalManager.tooColdToExtrude(extruder)) {
|
717
|
722
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
718
|
723
|
de = 0; // no difference
|
|
724
|
+ #if ENABLED(LIN_ADVANCE)
|
|
725
|
+ position_float[E_AXIS] = target_float[E_AXIS];
|
|
726
|
+ de_float = 0;
|
|
727
|
+ #endif
|
719
|
728
|
SERIAL_ECHO_START;
|
720
|
729
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
721
|
730
|
}
|
|
@@ -723,6 +732,10 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
723
|
732
|
if (labs(de) > (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
|
724
|
733
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
725
|
734
|
de = 0; // no difference
|
|
735
|
+ #if ENABLED(LIN_ADVANCE)
|
|
736
|
+ position_float[E_AXIS] = target_float[E_AXIS];
|
|
737
|
+ de_float = 0;
|
|
738
|
+ #endif
|
726
|
739
|
SERIAL_ECHO_START;
|
727
|
740
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
728
|
741
|
}
|
|
@@ -1342,6 +1355,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1342
|
1355
|
|
1343
|
1356
|
// Update the position (only when a move was queued)
|
1344
|
1357
|
memcpy(position, target, sizeof(position));
|
|
1358
|
+ #if ENABLED(LIN_ADVANCE)
|
|
1359
|
+ memcpy(position_float, target_float, sizeof(position_float));
|
|
1360
|
+ #endif
|
1345
|
1361
|
|
1346
|
1362
|
recalculate();
|
1347
|
1363
|
|
|
@@ -1367,6 +1383,12 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
|
1367
|
1383
|
nb = position[Y_AXIS] = lround(b * axis_steps_per_mm[Y_AXIS]),
|
1368
|
1384
|
nc = position[Z_AXIS] = lround(c * axis_steps_per_mm[Z_AXIS]),
|
1369
|
1385
|
ne = position[E_AXIS] = lround(e * axis_steps_per_mm[_EINDEX]);
|
|
1386
|
+ #if ENABLED(LIN_ADVANCE)
|
|
1387
|
+ position_float[X_AXIS] = a;
|
|
1388
|
+ position_float[Y_AXIS] = b;
|
|
1389
|
+ position_float[Z_AXIS] = c;
|
|
1390
|
+ position_float[E_AXIS] = e;
|
|
1391
|
+ #endif
|
1370
|
1392
|
stepper.set_position(na, nb, nc, ne);
|
1371
|
1393
|
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
|
1372
|
1394
|
ZERO(previous_speed);
|
|
@@ -1392,6 +1414,9 @@ void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
|
1392
|
1414
|
*/
|
1393
|
1415
|
void Planner::sync_from_steppers() {
|
1394
|
1416
|
LOOP_XYZE(i) position[i] = stepper.position((AxisEnum)i);
|
|
1417
|
+ #if ENABLED(LIN_ADVANCE)
|
|
1418
|
+ LOOP_XYZE(i) position_float[i] = stepper.position((AxisEnum)i) * steps_to_mm[i];
|
|
1419
|
+ #endif
|
1395
|
1420
|
}
|
1396
|
1421
|
|
1397
|
1422
|
/**
|
|
@@ -1405,6 +1430,9 @@ void Planner::set_position_mm(const AxisEnum axis, const float& v) {
|
1405
|
1430
|
const uint8_t axis_index = axis;
|
1406
|
1431
|
#endif
|
1407
|
1432
|
position[axis] = lround(v * axis_steps_per_mm[axis_index]);
|
|
1433
|
+ #if ENABLED(LIN_ADVANCE)
|
|
1434
|
+ position_float[axis] = v;
|
|
1435
|
+ #endif
|
1408
|
1436
|
stepper.set_position(axis, v);
|
1409
|
1437
|
previous_speed[axis] = 0.0;
|
1410
|
1438
|
}
|