overworked autotemp, removed one layer of nesting from the ultralcd.

This commit is contained in:
Bernhard 2011-12-04 09:48:53 +01:00
parent 4f909963e4
commit dfd240b260
5 changed files with 470 additions and 431 deletions

View file

@ -670,6 +670,7 @@ FORCE_INLINE void process_commands()
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
LCD_MESSAGE(time);
autotempShutdown();
}
break;
case 42: //M42 -Change pin status via gcode

View file

@ -436,5 +436,6 @@ void CardReader::printingHasFinished()
{
finishAndDisableSteppers();
}
autotempShutdown();
}
#endif //SDSUPPORT

View file

@ -91,7 +91,7 @@ static float previous_nominal_speed; // Nominal speed of previous path line segm
#ifdef AUTOTEMP
float autotemp_max=250;
float autotemp_min=210;
float autotemp_factor=1;
float autotemp_factor=0.1;
bool autotemp_enabled=false;
#endif

View file

@ -108,6 +108,16 @@ FORCE_INLINE float isCoolingHotend(uint8_t extruder){
};
FORCE_INLINE bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
FORCE_INLINE void autotempShutdown(){
#ifdef AUTOTEMP
if(autotemp_enabled)
{
autotemp_enabled=false;
if(degTargetHotend0()>autotemp_min)
setTargetHotend0(0);
}
#endif
}
void disable_heater();
void setWatch();
void updatePID();

View file

@ -503,8 +503,9 @@ void MainMenu::showTune()
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
{
linechanging=!linechanging;
@ -527,7 +528,7 @@ void MainMenu::showTune()
feedmultiplychanged=true;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemT_nozzle:
{
@ -537,8 +538,9 @@ void MainMenu::showTune()
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -560,7 +562,6 @@ void MainMenu::showTune()
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemT_fan:
@ -571,8 +572,9 @@ void MainMenu::showTune()
lcd.setCursor(13,line);lcd.print(ftostr3(fanpwm));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
{
linechanging=!linechanging;
@ -595,7 +597,7 @@ void MainMenu::showTune()
analogWrite(FAN_PIN, fanpwm);
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemT_flow://axis_steps_per_unit[i] = code_value();
{
@ -605,8 +607,9 @@ void MainMenu::showTune()
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -632,7 +635,7 @@ void MainMenu::showTune()
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
}
}
}break;
default:
break;
@ -688,8 +691,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -711,7 +715,7 @@ void MainMenu::showControlTemp()
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
#ifdef AUTOTEMP
case ItemCT_autotempmin:
@ -719,21 +723,22 @@ void MainMenu::showControlTemp()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(autotemp_max);
encoderpos=intround(autotemp_min);
}
else
{
autotemp_max=encoderpos;
autotemp_min=encoderpos;
encoderpos=activeline*lcdslow;
beepshort();
}
@ -745,7 +750,7 @@ void MainMenu::showControlTemp()
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCT_autotempmax:
{
@ -755,8 +760,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -778,7 +784,7 @@ void MainMenu::showControlTemp()
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCT_autotempfact:
{
@ -788,8 +794,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -811,7 +818,7 @@ void MainMenu::showControlTemp()
if(encoderpos>99) encoderpos=99;
lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
}
}
}break;
case ItemCT_autotempactive:
{
@ -825,14 +832,20 @@ void MainMenu::showControlTemp()
lcdprintPGM("Off");
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
autotemp_enabled=!autotemp_enabled;
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On ");
else
lcdprintPGM("Off");
BLOCK;
}
}
}break;
#endif //autotemp
case ItemCT_fan:
@ -843,8 +856,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(ftostr3(fanpwm));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
{
linechanging=!linechanging;
@ -867,7 +881,7 @@ void MainMenu::showControlTemp()
analogWrite(FAN_PIN, fanpwm);
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCT_PID_P:
{
@ -877,8 +891,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(itostr4(Kp));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -901,7 +916,7 @@ void MainMenu::showControlTemp()
if(encoderpos>9990) encoderpos=9990;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
}
}
}break;
case ItemCT_PID_I:
{
@ -911,8 +926,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -935,7 +951,7 @@ void MainMenu::showControlTemp()
if(encoderpos>9990) encoderpos=9990;
lcd.setCursor(13,line);lcd.print(ftostr51(encoderpos/10.));
}
}
}break;
case ItemCT_PID_D:
{
@ -945,8 +961,10 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -969,7 +987,7 @@ void MainMenu::showControlTemp()
if(encoderpos>9990) encoderpos=9990;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
}
}
}break;
case ItemCT_PID_C:
#ifdef PID_ADD_EXTRUSION_RATE
@ -980,8 +998,9 @@ void MainMenu::showControlTemp()
lcd.setCursor(13,line);lcd.print(itostr3(Kc));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1004,7 +1023,7 @@ void MainMenu::showControlTemp()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}
#endif
break;
@ -1051,8 +1070,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1074,7 +1094,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
}
}
}break;
case ItemCM_xyjerk: //max_xy_jerk
{
@ -1084,8 +1104,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1108,7 +1129,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCM_vmaxx:
@ -1126,8 +1147,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1150,7 +1172,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCM_vmin:
@ -1161,8 +1183,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1185,7 +1208,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCM_vtravmin:
{
@ -1195,8 +1218,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1219,7 +1243,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCM_amaxx:
@ -1237,8 +1261,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1260,7 +1285,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
}
}
}break;
case ItemCM_aret://float retract_acceleration = 7000;
{
@ -1270,8 +1295,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1294,7 +1320,7 @@ void MainMenu::showControlMotion()
if(encoderpos>990) encoderpos=990;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
}
}
}break;
case ItemCM_esteps://axis_steps_per_unit[i] = code_value();
{
@ -1304,8 +1330,9 @@ void MainMenu::showControlMotion()
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
if((activeline==line) )
{
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
@ -1331,7 +1358,7 @@ void MainMenu::showControlMotion()
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
}
}
}break;
default:
break;