Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin into typofixes_upstream
This commit is contained in:
commit
b868d668fa
2 changed files with 70 additions and 78 deletions
|
@ -399,8 +399,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
|
||||||
// the moves are than replaced by the firmware controlled ones.
|
// the moves are than replaced by the firmware controlled ones.
|
||||||
|
|
||||||
// #define FWRETRACT //ONLY PARTIALLY TESTED
|
// #define FWRETRACT //ONLY PARTIALLY TESTED
|
||||||
#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
|
#ifdef FWRETRACT
|
||||||
|
#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
|
||||||
|
#define RETRACT_LENGTH 3 //default retract length (positive mm)
|
||||||
|
#define RETRACT_FEEDRATE 80*60 //default feedrate for retracting
|
||||||
|
#define RETRACT_ZLIFT 0 //default retract Z-lift
|
||||||
|
#define RETRACT_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering)
|
||||||
|
#define RETRACT_RECOVER_FEEDRATE 8*60 //default feedrate for recovering from retraction
|
||||||
|
#endif
|
||||||
|
|
||||||
//adds support for experimental filament exchange support M600; requires display
|
//adds support for experimental filament exchange support M600; requires display
|
||||||
#ifdef ULTIPANEL
|
#ifdef ULTIPANEL
|
||||||
|
|
|
@ -231,10 +231,13 @@ int EtoPPressure=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FWRETRACT
|
#ifdef FWRETRACT
|
||||||
bool autoretract_enabled=true;
|
bool autoretract_enabled=false;
|
||||||
bool retracted=false;
|
bool retracted=false;
|
||||||
float retract_length=3, retract_feedrate=17*60, retract_zlift=0.8;
|
float retract_length = RETRACT_LENGTH;
|
||||||
float retract_recover_length=0, retract_recover_feedrate=8*60;
|
float retract_feedrate = RETRACT_FEEDRATE;
|
||||||
|
float retract_zlift = RETRACT_ZLIFT;
|
||||||
|
float retract_recover_length = RETRACT_RECOVER_LENGTH;
|
||||||
|
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ULTIPANEL
|
#ifdef ULTIPANEL
|
||||||
|
@ -1080,11 +1083,47 @@ static void homeaxis(int axis) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
||||||
+void refresh_cmd_timeout(void)
|
void refresh_cmd_timeout(void)
|
||||||
{
|
{
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FWRETRACT
|
||||||
|
void retract(bool retracting) {
|
||||||
|
if(retracting && !retracted) {
|
||||||
|
destination[X_AXIS]=current_position[X_AXIS];
|
||||||
|
destination[Y_AXIS]=current_position[Y_AXIS];
|
||||||
|
destination[Z_AXIS]=current_position[Z_AXIS];
|
||||||
|
destination[E_AXIS]=current_position[E_AXIS];
|
||||||
|
current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
|
||||||
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
|
float oldFeedrate = feedrate;
|
||||||
|
feedrate=retract_feedrate;
|
||||||
|
retracted=true;
|
||||||
|
prepare_move();
|
||||||
|
current_position[Z_AXIS]-=retract_zlift;
|
||||||
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
|
prepare_move();
|
||||||
|
feedrate = oldFeedrate;
|
||||||
|
} else if(!retracting && retracted) {
|
||||||
|
destination[X_AXIS]=current_position[X_AXIS];
|
||||||
|
destination[Y_AXIS]=current_position[Y_AXIS];
|
||||||
|
destination[Z_AXIS]=current_position[Z_AXIS];
|
||||||
|
destination[E_AXIS]=current_position[E_AXIS];
|
||||||
|
current_position[Z_AXIS]+=retract_zlift;
|
||||||
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
|
//prepare_move();
|
||||||
|
current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder];
|
||||||
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
|
float oldFeedrate = feedrate;
|
||||||
|
feedrate=retract_recover_feedrate;
|
||||||
|
retracted=false;
|
||||||
|
prepare_move();
|
||||||
|
feedrate = oldFeedrate;
|
||||||
|
}
|
||||||
|
} //retract
|
||||||
|
#endif //FWRETRACT
|
||||||
|
|
||||||
void process_commands()
|
void process_commands()
|
||||||
{
|
{
|
||||||
unsigned long codenum; //throw away variable
|
unsigned long codenum; //throw away variable
|
||||||
|
@ -1100,6 +1139,18 @@ void process_commands()
|
||||||
case 1: // G1
|
case 1: // G1
|
||||||
if(Stopped == false) {
|
if(Stopped == false) {
|
||||||
get_coordinates(); // For X Y Z E F
|
get_coordinates(); // For X Y Z E F
|
||||||
|
#ifdef FWRETRACT
|
||||||
|
if(autoretract_enabled)
|
||||||
|
if( !(code_seen(X_AXIS) || code_seen(Y_AXIS) || code_seen(Z_AXIS)) && code_seen(E_AXIS)) {
|
||||||
|
float echange=destination[E_AXIS]-current_position[E_AXIS];
|
||||||
|
if((echange<-MIN_RETRACT && !retracted) || (echange>MIN_RETRACT && retracted)) { //move appears to be an attempt to attract or recover
|
||||||
|
current_position[E_AXIS] = destination[E_AXIS]; //hide the slicer-generated retract/recover from calculations
|
||||||
|
plan_set_e_position(current_position[E_AXIS]); //AND from the planner
|
||||||
|
retract(!retracted);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //FWRETRACT
|
||||||
prepare_move();
|
prepare_move();
|
||||||
//ClearToSend();
|
//ClearToSend();
|
||||||
return;
|
return;
|
||||||
|
@ -1134,39 +1185,10 @@ void process_commands()
|
||||||
break;
|
break;
|
||||||
#ifdef FWRETRACT
|
#ifdef FWRETRACT
|
||||||
case 10: // G10 retract
|
case 10: // G10 retract
|
||||||
if(!retracted)
|
retract(true);
|
||||||
{
|
|
||||||
destination[X_AXIS]=current_position[X_AXIS];
|
|
||||||
destination[Y_AXIS]=current_position[Y_AXIS];
|
|
||||||
destination[Z_AXIS]=current_position[Z_AXIS];
|
|
||||||
current_position[Z_AXIS]-=retract_zlift;
|
|
||||||
destination[E_AXIS]=current_position[E_AXIS];
|
|
||||||
current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
|
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
|
||||||
float oldFeedrate = feedrate;
|
|
||||||
feedrate=retract_feedrate;
|
|
||||||
retracted=true;
|
|
||||||
prepare_move();
|
|
||||||
feedrate = oldFeedrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 11: // G11 retract_recover
|
case 11: // G11 retract_recover
|
||||||
if(retracted)
|
retract(false);
|
||||||
{
|
|
||||||
destination[X_AXIS]=current_position[X_AXIS];
|
|
||||||
destination[Y_AXIS]=current_position[Y_AXIS];
|
|
||||||
destination[Z_AXIS]=current_position[Z_AXIS];
|
|
||||||
current_position[Z_AXIS]+=retract_zlift;
|
|
||||||
destination[E_AXIS]=current_position[E_AXIS];
|
|
||||||
current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder];
|
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
|
||||||
float oldFeedrate = feedrate;
|
|
||||||
feedrate=retract_recover_feedrate;
|
|
||||||
retracted=false;
|
|
||||||
prepare_move();
|
|
||||||
feedrate = oldFeedrate;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif //FWRETRACT
|
#endif //FWRETRACT
|
||||||
case 28: //G28 Home all Axis one at a time
|
case 28: //G28 Home all Axis one at a time
|
||||||
|
@ -2128,18 +2150,18 @@ void process_commands()
|
||||||
case 114: // M114
|
case 114: // M114
|
||||||
SERIAL_PROTOCOLPGM("X:");
|
SERIAL_PROTOCOLPGM("X:");
|
||||||
SERIAL_PROTOCOL(current_position[X_AXIS]);
|
SERIAL_PROTOCOL(current_position[X_AXIS]);
|
||||||
SERIAL_PROTOCOLPGM("Y:");
|
SERIAL_PROTOCOLPGM(" Y:");
|
||||||
SERIAL_PROTOCOL(current_position[Y_AXIS]);
|
SERIAL_PROTOCOL(current_position[Y_AXIS]);
|
||||||
SERIAL_PROTOCOLPGM("Z:");
|
SERIAL_PROTOCOLPGM(" Z:");
|
||||||
SERIAL_PROTOCOL(current_position[Z_AXIS]);
|
SERIAL_PROTOCOL(current_position[Z_AXIS]);
|
||||||
SERIAL_PROTOCOLPGM("E:");
|
SERIAL_PROTOCOLPGM(" E:");
|
||||||
SERIAL_PROTOCOL(current_position[E_AXIS]);
|
SERIAL_PROTOCOL(current_position[E_AXIS]);
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
|
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
|
||||||
SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
|
SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
|
||||||
SERIAL_PROTOCOLPGM("Y:");
|
SERIAL_PROTOCOLPGM(" Y:");
|
||||||
SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
|
SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
|
||||||
SERIAL_PROTOCOLPGM("Z:");
|
SERIAL_PROTOCOLPGM(" Z:");
|
||||||
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
|
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
|
||||||
|
|
||||||
SERIAL_PROTOCOLLN("");
|
SERIAL_PROTOCOLLN("");
|
||||||
|
@ -3022,42 +3044,6 @@ void get_coordinates()
|
||||||
next_feedrate = code_value();
|
next_feedrate = code_value();
|
||||||
if(next_feedrate > 0.0) feedrate = next_feedrate;
|
if(next_feedrate > 0.0) feedrate = next_feedrate;
|
||||||
}
|
}
|
||||||
#ifdef FWRETRACT
|
|
||||||
if(autoretract_enabled)
|
|
||||||
if( !(seen[X_AXIS] || seen[Y_AXIS] || seen[Z_AXIS]) && seen[E_AXIS])
|
|
||||||
{
|
|
||||||
float echange=destination[E_AXIS]-current_position[E_AXIS];
|
|
||||||
if(echange<-MIN_RETRACT) //retract
|
|
||||||
{
|
|
||||||
if(!retracted)
|
|
||||||
{
|
|
||||||
|
|
||||||
destination[Z_AXIS]+=retract_zlift; //not sure why chaninging current_position negatively does not work.
|
|
||||||
//if slicer retracted by echange=-1mm and you want to retract 3mm, corrrectede=-2mm additionally
|
|
||||||
float correctede=-echange-retract_length;
|
|
||||||
//to generate the additional steps, not the destination is changed, but inversely the current position
|
|
||||||
current_position[E_AXIS]+=-correctede;
|
|
||||||
feedrate=retract_feedrate;
|
|
||||||
retracted=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(echange>MIN_RETRACT) //retract_recover
|
|
||||||
{
|
|
||||||
if(retracted)
|
|
||||||
{
|
|
||||||
//current_position[Z_AXIS]+=-retract_zlift;
|
|
||||||
//if slicer retracted_recovered by echange=+1mm and you want to retract_recover 3mm, corrrectede=2mm additionally
|
|
||||||
float correctede=-echange+1*retract_length+retract_recover_length; //total unretract=retract_length+retract_recover_length[surplus]
|
|
||||||
current_position[E_AXIS]+=correctede; //to generate the additional steps, not the destination is changed, but inversely the current position
|
|
||||||
feedrate=retract_recover_feedrate;
|
|
||||||
retracted=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif //FWRETRACT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_arc_coordinates()
|
void get_arc_coordinates()
|
||||||
|
|
Reference in a new issue