|
@ -380,12 +380,13 @@ bool target_direction; |
|
|
void get_arc_coordinates(); |
|
|
void get_arc_coordinates(); |
|
|
bool setTargetedHotend(int code); |
|
|
bool setTargetedHotend(int code); |
|
|
|
|
|
|
|
|
void serial_echopair_P(const char *s_P, float v) |
|
|
void serial_echopair_P(const char *s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
{ serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
void serial_echopair_P(const char *s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
void serial_echopair_P(const char *s_P, double v) |
|
|
void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
{ serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
|
|
|
void serial_echopair_P(const char *s_P, unsigned long v) |
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
{ serialprintPGM(s_P); SERIAL_ECHO(v); } |
|
|
float extrude_min_temp = EXTRUDE_MINTEMP; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef SDSUPPORT |
|
|
#ifdef SDSUPPORT |
|
|
#include "SdFatUtil.h" |
|
|
#include "SdFatUtil.h" |
|
@ -1009,8 +1010,11 @@ inline void line_to_current_position() { |
|
|
inline void line_to_z(float zPosition) { |
|
|
inline void line_to_z(float zPosition) { |
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); |
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); |
|
|
} |
|
|
} |
|
|
|
|
|
inline void line_to_destination(float mm_m) { |
|
|
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m/60, active_extruder); |
|
|
|
|
|
} |
|
|
inline void line_to_destination() { |
|
|
inline void line_to_destination() { |
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); |
|
|
line_to_destination(feedrate); |
|
|
} |
|
|
} |
|
|
inline void sync_plan_position() { |
|
|
inline void sync_plan_position() { |
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); |
|
|
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() { |
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
|
|
|
|
|
|
|
|
|
void set_extrude_min_temp(float temp) { extrude_min_temp = temp; } |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* M302: Allow cold extrudes, or set the minimum extrude S<temperature>. |
|
|
* M302: Allow cold extrudes, or set the minimum extrude S<temperature>. |
|
|
*/ |
|
|
*/ |
|
@ -5445,14 +5451,30 @@ void prepare_move() { |
|
|
clamp_to_software_endstops(destination); |
|
|
clamp_to_software_endstops(destination); |
|
|
refresh_cmd_timeout(); |
|
|
refresh_cmd_timeout(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
|
|
|
float de = destination[E_AXIS] - current_position[E_AXIS]; |
|
|
|
|
|
if (de) { |
|
|
|
|
|
if (degHotend(active_extruder) < extrude_min_temp) { |
|
|
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); |
|
|
|
|
|
} |
|
|
|
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE |
|
|
|
|
|
if (labs(de) > EXTRUDE_MAXLENGTH) { |
|
|
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|
|
|
|
|
|
|
float difference[NUM_AXIS]; |
|
|
float difference[NUM_AXIS]; |
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; |
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; |
|
|
|
|
|
|
|
|
float cartesian_mm = sqrt( sq(difference[X_AXIS]) + |
|
|
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); |
|
|
sq(difference[Y_AXIS]) + |
|
|
|
|
|
sq(difference[Z_AXIS])); |
|
|
|
|
|
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } |
|
|
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } |
|
|
if (cartesian_mm < 0.000001) { return; } |
|
|
if (cartesian_mm < 0.000001) { return; } |
|
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; |
|
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; |
|
@ -5464,9 +5486,7 @@ void prepare_move() { |
|
|
|
|
|
|
|
|
for (int s = 1; s <= steps; s++) { |
|
|
for (int s = 1; s <= steps; s++) { |
|
|
float fraction = float(s) / float(steps); |
|
|
float fraction = float(s) / float(steps); |
|
|
for(int8_t i = 0; i < NUM_AXIS; i++) { |
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction; |
|
|
destination[i] = current_position[i] + difference[i] * fraction; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
calculate_delta(destination); |
|
|
calculate_delta(destination); |
|
|
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
|
|
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
|
@ -5476,9 +5496,7 @@ void prepare_move() { |
|
|
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
|
|
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
|
|
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
|
|
|
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
|
|
|
|
|
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], |
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); |
|
|
destination[E_AXIS], feedrate*feedmultiply/60/100.0, |
|
|
|
|
|
active_extruder); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // SCARA
|
|
|
#endif // SCARA
|
|
@ -5488,9 +5506,7 @@ void prepare_move() { |
|
|
float difference[NUM_AXIS]; |
|
|
float difference[NUM_AXIS]; |
|
|
for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; |
|
|
for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; |
|
|
|
|
|
|
|
|
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + |
|
|
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); |
|
|
sq(difference[Y_AXIS]) + |
|
|
|
|
|
sq(difference[Z_AXIS])); |
|
|
|
|
|
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]); |
|
|
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]); |
|
|
if (cartesian_mm < 0.000001) return; |
|
|
if (cartesian_mm < 0.000001) return; |
|
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; |
|
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; |
|
@ -5507,9 +5523,7 @@ void prepare_move() { |
|
|
#ifdef ENABLE_AUTO_BED_LEVELING |
|
|
#ifdef ENABLE_AUTO_BED_LEVELING |
|
|
adjust_delta(destination); |
|
|
adjust_delta(destination); |
|
|
#endif |
|
|
#endif |
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], |
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); |
|
|
destination[E_AXIS], feedrate*feedmultiply/60/100.0, |
|
|
|
|
|
active_extruder); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // DELTA
|
|
|
#endif // DELTA
|
|
@ -5519,8 +5533,8 @@ void prepare_move() { |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { |
|
|
// move duplicate extruder into correct duplication position.
|
|
|
// move duplicate extruder into correct duplication position.
|
|
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); |
|
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); |
|
|
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], |
|
|
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, |
|
|
current_position[E_AXIS], max_feedrate[X_AXIS], 1); |
|
|
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1); |
|
|
sync_plan_position(); |
|
|
sync_plan_position(); |
|
|
st_synchronize(); |
|
|
st_synchronize(); |
|
|
extruder_duplication_enabled = true; |
|
|
extruder_duplication_enabled = true; |
|
@ -5528,12 +5542,12 @@ void prepare_move() { |
|
|
} |
|
|
} |
|
|
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head
|
|
|
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head
|
|
|
if (current_position[E_AXIS] == destination[E_AXIS]) { |
|
|
if (current_position[E_AXIS] == destination[E_AXIS]) { |
|
|
// this is a travel move - skit it but keep track of current position (so that it can later
|
|
|
// This is a travel move (with no extrusion)
|
|
|
// be used as start of first non-travel move)
|
|
|
// Skip it, but keep track of the current position
|
|
|
|
|
|
// (so it can be used as the start of the next non-travel move)
|
|
|
if (delayed_move_time != 0xFFFFFFFFUL) { |
|
|
if (delayed_move_time != 0xFFFFFFFFUL) { |
|
|
set_current_to_destination(); |
|
|
set_current_to_destination(); |
|
|
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS]) |
|
|
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS]) raised_parked_position[Z_AXIS] = destination[Z_AXIS]; |
|
|
raised_parked_position[Z_AXIS] = destination[Z_AXIS]; |
|
|
|
|
|
delayed_move_time = millis(); |
|
|
delayed_move_time = millis(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -5541,10 +5555,8 @@ void prepare_move() { |
|
|
delayed_move_time = 0; |
|
|
delayed_move_time = 0; |
|
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
|
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
|
|
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); |
|
|
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); |
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], |
|
|
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); |
|
|
current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder); |
|
|
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); |
|
|
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); |
|
|
|
|
|
active_extruder_parked = false; |
|
|
active_extruder_parked = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -5552,7 +5564,7 @@ void prepare_move() { |
|
|
|
|
|
|
|
|
#if !defined(DELTA) && !defined(SCARA) |
|
|
#if !defined(DELTA) && !defined(SCARA) |
|
|
// Do not use feedmultiply for E or Z only moves
|
|
|
// Do not use feedmultiply for E or Z only moves
|
|
|
if ( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) { |
|
|
if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) { |
|
|
line_to_destination(); |
|
|
line_to_destination(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -5560,7 +5572,7 @@ void prepare_move() { |
|
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder); |
|
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder); |
|
|
return; |
|
|
return; |
|
|
#else |
|
|
#else |
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder); |
|
|
line_to_destination(feedrate * feedmultiply / 100.0); |
|
|
#endif // MESH_BED_LEVELING
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
} |
|
|
} |
|
|
#endif // !(DELTA || SCARA)
|
|
|
#endif // !(DELTA || SCARA)
|
|
|