M200 implementation

This commit is contained in:
whosawhatsis
2014-01-31 00:54:19 -08:00
parent adbf226de1
commit d24df7af2c
4 changed files with 47 additions and 1 deletions

View File

@@ -188,6 +188,14 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2
int saved_feedmultiply;
int extrudemultiply=100; //100->1 200->2
float filament_area[EXTRUDERS] = {1.0
#if EXTRUDERS > 1
, 1.0
#if EXTRUDERS > 2
, 1.0
#endif
#endif
};
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
float add_homeing[3]={0,0,0};
#ifdef DELTA
@@ -2190,6 +2198,33 @@ void process_commands()
}
break;
#endif //BLINKM
case 200: // M200 S<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
{
float area;
if(code_seen('S')) {
float radius = code_value() / 2;
if(radius == 0) {
area = 1;
} else {
area = M_PI * pow(radius, 2);
}
} else {
//reserved for setting filament diameter via UFID or filament measuring device
break;
}
tmp_extruder = active_extruder;
if(code_seen('T')) {
tmp_extruder = code_value();
if(tmp_extruder >= EXTRUDERS) {
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
}
SERIAL_ECHOLN(tmp_extruder);
break;
}
filament_area[tmp_extruder] = area;
}
break;
case 201: // M201
for(int8_t i=0; i < NUM_AXIS; i++)
{