|
@@ -380,12 +380,13 @@ bool target_direction;
|
380
|
380
|
void get_arc_coordinates();
|
381
|
381
|
bool setTargetedHotend(int code);
|
382
|
382
|
|
383
|
|
-void serial_echopair_P(const char *s_P, float v)
|
384
|
|
- { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
385
|
|
-void serial_echopair_P(const char *s_P, double v)
|
386
|
|
- { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
387
|
|
-void serial_echopair_P(const char *s_P, unsigned long v)
|
388
|
|
- { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
|
383
|
+void serial_echopair_P(const char *s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
|
384
|
+void serial_echopair_P(const char *s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
|
385
|
+void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
|
386
|
+
|
|
387
|
+#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
388
|
+ float extrude_min_temp = EXTRUDE_MINTEMP;
|
|
389
|
+#endif
|
389
|
390
|
|
390
|
391
|
#ifdef SDSUPPORT
|
391
|
392
|
#include "SdFatUtil.h"
|
|
@@ -1009,8 +1010,11 @@ inline void line_to_current_position() {
|
1009
|
1010
|
inline void line_to_z(float zPosition) {
|
1010
|
1011
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
1011
|
1012
|
}
|
|
1013
|
+inline void line_to_destination(float mm_m) {
|
|
1014
|
+ plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m/60, active_extruder);
|
|
1015
|
+}
|
1012
|
1016
|
inline void line_to_destination() {
|
1013
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
1017
|
+ line_to_destination(feedrate);
|
1014
|
1018
|
}
|
1015
|
1019
|
inline void sync_plan_position() {
|
1016
|
1020
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
@@ -4099,6 +4103,8 @@ inline void gcode_M226() {
|
4099
|
4103
|
|
4100
|
4104
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
4101
|
4105
|
|
|
4106
|
+ void set_extrude_min_temp(float temp) { extrude_min_temp = temp; }
|
|
4107
|
+
|
4102
|
4108
|
/**
|
4103
|
4109
|
* M302: Allow cold extrudes, or set the minimum extrude S<temperature>.
|
4104
|
4110
|
*/
|
|
@@ -5444,15 +5450,31 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
5444
|
5450
|
void prepare_move() {
|
5445
|
5451
|
clamp_to_software_endstops(destination);
|
5446
|
5452
|
refresh_cmd_timeout();
|
5447
|
|
-
|
|
5453
|
+
|
|
5454
|
+ #ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
5455
|
+ float de = destination[E_AXIS] - current_position[E_AXIS];
|
|
5456
|
+ if (de) {
|
|
5457
|
+ if (degHotend(active_extruder) < extrude_min_temp) {
|
|
5458
|
+ current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
5459
|
+ SERIAL_ECHO_START;
|
|
5460
|
+ SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
|
5461
|
+ }
|
|
5462
|
+ #ifdef PREVENT_LENGTHY_EXTRUDE
|
|
5463
|
+ if (labs(de) > EXTRUDE_MAXLENGTH) {
|
|
5464
|
+ current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
5465
|
+ SERIAL_ECHO_START;
|
|
5466
|
+ SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
|
5467
|
+ }
|
|
5468
|
+ #endif
|
|
5469
|
+ }
|
|
5470
|
+ #endif
|
|
5471
|
+
|
5448
|
5472
|
#ifdef SCARA //for now same as delta-code
|
5449
|
5473
|
|
5450
|
5474
|
float difference[NUM_AXIS];
|
5451
|
5475
|
for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
5452
|
5476
|
|
5453
|
|
- float cartesian_mm = sqrt( sq(difference[X_AXIS]) +
|
5454
|
|
- sq(difference[Y_AXIS]) +
|
5455
|
|
- sq(difference[Z_AXIS]));
|
|
5477
|
+ float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
|
5456
|
5478
|
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
|
5457
|
5479
|
if (cartesian_mm < 0.000001) { return; }
|
5458
|
5480
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
|
@@ -5464,9 +5486,7 @@ void prepare_move() {
|
5464
|
5486
|
|
5465
|
5487
|
for (int s = 1; s <= steps; s++) {
|
5466
|
5488
|
float fraction = float(s) / float(steps);
|
5467
|
|
- for(int8_t i = 0; i < NUM_AXIS; i++) {
|
5468
|
|
- destination[i] = current_position[i] + difference[i] * fraction;
|
5469
|
|
- }
|
|
5489
|
+ for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction;
|
5470
|
5490
|
|
5471
|
5491
|
calculate_delta(destination);
|
5472
|
5492
|
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
|
@@ -5476,9 +5496,7 @@ void prepare_move() {
|
5476
|
5496
|
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
5477
|
5497
|
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
|
5478
|
5498
|
|
5479
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
5480
|
|
- destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
5481
|
|
- active_extruder);
|
|
5499
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
5482
|
5500
|
}
|
5483
|
5501
|
|
5484
|
5502
|
#endif // SCARA
|
|
@@ -5488,9 +5506,7 @@ void prepare_move() {
|
5488
|
5506
|
float difference[NUM_AXIS];
|
5489
|
5507
|
for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
5490
|
5508
|
|
5491
|
|
- float cartesian_mm = sqrt(sq(difference[X_AXIS]) +
|
5492
|
|
- sq(difference[Y_AXIS]) +
|
5493
|
|
- sq(difference[Z_AXIS]));
|
|
5509
|
+ float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
|
5494
|
5510
|
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
|
5495
|
5511
|
if (cartesian_mm < 0.000001) return;
|
5496
|
5512
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
|
@@ -5507,9 +5523,7 @@ void prepare_move() {
|
5507
|
5523
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
5508
|
5524
|
adjust_delta(destination);
|
5509
|
5525
|
#endif
|
5510
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
5511
|
|
- destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
5512
|
|
- active_extruder);
|
|
5526
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
5513
|
5527
|
}
|
5514
|
5528
|
|
5515
|
5529
|
#endif // DELTA
|
|
@@ -5519,8 +5533,8 @@ void prepare_move() {
|
5519
|
5533
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
5520
|
5534
|
// move duplicate extruder into correct duplication position.
|
5521
|
5535
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
5522
|
|
- plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
|
5523
|
|
- current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
|
5536
|
+ plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
|
5537
|
+ current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
5524
|
5538
|
sync_plan_position();
|
5525
|
5539
|
st_synchronize();
|
5526
|
5540
|
extruder_duplication_enabled = true;
|
|
@@ -5528,23 +5542,21 @@ void prepare_move() {
|
5528
|
5542
|
}
|
5529
|
5543
|
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head
|
5530
|
5544
|
if (current_position[E_AXIS] == destination[E_AXIS]) {
|
5531
|
|
- // this is a travel move - skit it but keep track of current position (so that it can later
|
5532
|
|
- // be used as start of first non-travel move)
|
|
5545
|
+ // This is a travel move (with no extrusion)
|
|
5546
|
+ // Skip it, but keep track of the current position
|
|
5547
|
+ // (so it can be used as the start of the next non-travel move)
|
5533
|
5548
|
if (delayed_move_time != 0xFFFFFFFFUL) {
|
5534
|
5549
|
set_current_to_destination();
|
5535
|
|
- if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
|
5536
|
|
- raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
|
5550
|
+ if (destination[Z_AXIS] > raised_parked_position[Z_AXIS]) raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
5537
|
5551
|
delayed_move_time = millis();
|
5538
|
5552
|
return;
|
5539
|
5553
|
}
|
5540
|
5554
|
}
|
5541
|
5555
|
delayed_move_time = 0;
|
5542
|
5556
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
5543
|
|
- 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);
|
5544
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
|
5545
|
|
- current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
|
5546
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
5547
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
5557
|
+ 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);
|
|
5558
|
+ 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);
|
|
5559
|
+ 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);
|
5548
|
5560
|
active_extruder_parked = false;
|
5549
|
5561
|
}
|
5550
|
5562
|
}
|
|
@@ -5552,7 +5564,7 @@ void prepare_move() {
|
5552
|
5564
|
|
5553
|
5565
|
#if !defined(DELTA) && !defined(SCARA)
|
5554
|
5566
|
// Do not use feedmultiply for E or Z only moves
|
5555
|
|
- if ( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
|
5567
|
+ if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
|
5556
|
5568
|
line_to_destination();
|
5557
|
5569
|
}
|
5558
|
5570
|
else {
|
|
@@ -5560,7 +5572,7 @@ void prepare_move() {
|
5560
|
5572
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
5561
|
5573
|
return;
|
5562
|
5574
|
#else
|
5563
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
|
5575
|
+ line_to_destination(feedrate * feedmultiply / 100.0);
|
5564
|
5576
|
#endif // MESH_BED_LEVELING
|
5565
|
5577
|
}
|
5566
|
5578
|
#endif // !(DELTA || SCARA)
|