// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
// M206 - set additional homeing offset
-// M220 - set speed factor override percentage S:factor in percent
+// M220 S<factor in percent>- set speed factor override percentage
+// M221 S<factor in percent>- set extrude factor override percentage
// M240 - Trigger a camera to take a photograph
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
volatile int feedmultiply=100; //100->1 200->2
int saved_feedmultiply;
volatile bool feedmultiplychanged=false;
+volatile int extrudemultiply=100; //100->1 200->2
+volatile bool extrudemultiplychanged=false;
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
float add_homeing[3]={0,0,0};
uint8_t active_extruder = 0;
serial_char = MYSERIAL.read();
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) )
{
- if(!serial_count) return; //if empty line
+ if(!serial_count) { //if empty line
+ comment_mode = false; //for new command
+ return;
+ }
cmdbuffer[bufindw][serial_count] = 0; //terminate string
if(!comment_mode){
+ comment_mode = false; //for new command
fromsd[bufindw] = false;
if(strstr(cmdbuffer[bufindw], "N") != NULL)
{
}
bufindw = (bufindw + 1)%BUFSIZE;
buflen += 1;
-
}
- comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else
card.checkautostart(true);
}
- if(serial_char=='\n')
- comment_mode = false; //for new command
if(!serial_count)
{
+ comment_mode = false; //for new command
return; //if empty line
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
buflen += 1;
bufindw = (bufindw + 1)%BUFSIZE;
}
+ comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else
}
}
break;
-
-
+ case 221: // M221 S<factor in percent>- set extrude factor override percentage
+ {
+ if(code_seen('S'))
+ {
+ extrudemultiply = code_value() ;
+ extrudemultiplychanged=true;
+ }
+ break;
#ifdef PIDTEMP
case 301: // M301
static float previous_speed[4]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment
+extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent)
+
#ifdef AUTOTEMP
float autotemp_max=250;
float autotemp_min=210;
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
-
-
#ifdef PREVENT_DANGEROUS_EXTRUDE
if(target[E_AXIS]!=position[E_AXIS])
if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
+ block->steps_e *= extrudemultiply;
+ block-?steps_e /= 100;
block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
// Bail if this is a zero-length block
delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
- delta_mm[E_AXIS] = (target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS];
+ delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
if ( block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0 ) {
block->millimeters = abs(delta_mm[E_AXIS]);
} else {