Merge pull request #1452 from thinkyhead/fix_M200_bug

M200 cleanup, normalization of EXTRUDER loops
This commit is contained in:
Scott Lahteine 2015-02-02 21:58:15 -08:00
commit d8b7f29fa2

View File

@ -2893,26 +2893,16 @@ Sigma_Exit:
float area = .0; float area = .0;
if(code_seen('D')) { if(code_seen('D')) {
float diameter = (float)code_value(); float diameter = code_value();
if (diameter == 0.0) {
// setting any extruder filament size disables volumetric on the assumption that // setting any extruder filament size disables volumetric on the assumption that
// slicers either generate in extruder values as cubic mm or as as filament feeds // slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders // for all extruders
volumetric_enabled = false; volumetric_enabled = (diameter != 0.0);
} else { if (volumetric_enabled) {
filament_size[tmp_extruder] = (float)code_value(); filament_size[tmp_extruder] = diameter;
// make sure all extruders have some sane value for the filament size // make sure all extruders have some sane value for the filament size
filament_size[0] = (filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[0]); for (int i=0; i<EXTRUDERS; i++)
#if EXTRUDERS > 1 if (! filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
filament_size[1] = (filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[1]);
#if EXTRUDERS > 2
filament_size[2] = (filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[2]);
#if EXTRUDERS > 3
filament_size[3] = (filament_size[3] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
volumetric_enabled = true;
} }
} else { } else {
//reserved for setting filament diameter via UFID or filament measuring device //reserved for setting filament diameter via UFID or filament measuring device
@ -3032,32 +3022,10 @@ Sigma_Exit:
switch(t) switch(t)
{ {
case 0: case 0:
{
autoretract_enabled=false;
retracted[0]=false;
#if EXTRUDERS > 1
retracted[1]=false;
#endif
#if EXTRUDERS > 2
retracted[2]=false;
#endif
#if EXTRUDERS > 3
retracted[3]=false;
#endif
}break;
case 1: case 1:
{ {
autoretract_enabled=true; autoretract_enabled = (t == 1);
retracted[0]=false; for (int i=0; i<EXTRUDERS; i++) retracted[i] = false;
#if EXTRUDERS > 1
retracted[1]=false;
#endif
#if EXTRUDERS > 2
retracted[2]=false;
#endif
#if EXTRUDERS > 3
retracted[3]=false;
#endif
}break; }break;
default: default:
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -4696,15 +4664,6 @@ float calculate_volumetric_multiplier(float diameter) {
} }
void calculate_volumetric_multipliers() { void calculate_volumetric_multipliers() {
volumetric_multiplier[0] = calculate_volumetric_multiplier(filament_size[0]); for (int i=0; i<EXTRUDERS; i++)
#if EXTRUDERS > 1 volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
volumetric_multiplier[1] = calculate_volumetric_multiplier(filament_size[1]);
#if EXTRUDERS > 2
volumetric_multiplier[2] = calculate_volumetric_multiplier(filament_size[2]);
#if EXTRUDERS > 3
volumetric_multiplier[3] = calculate_volumetric_multiplier(filament_size[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
} }