add autotemp support to the lcd

This commit is contained in:
Bernhard 2011-11-27 16:45:19 +01:00
parent b128d25f27
commit 6aecf80278

View file

@ -660,7 +660,12 @@ void MainMenu::showTune()
// //
enum { enum {
ItemCT_exit, ItemCT_nozzle, ItemCT_fan, ItemCT_exit,ItemCT_nozzle,
#ifdef AUTOTEMP
ItemCT_autotempactive,
ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
#endif
ItemCT_fan,
ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
}; };
@ -708,7 +713,128 @@ void MainMenu::showControlTemp()
} }
} }
}break; }break;
#ifdef AUTOTEMP
case ItemCT_autotempmin:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
}
if((activeline==line) )
{
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(autotemp_max);
}
else
{
autotemp_max=encoderpos;
encoderpos=activeline*lcdslow;
beepshort();
}
BLOCK;
}
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCT_autotempmax:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
}
if((activeline==line) )
{
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(autotemp_max);
}
else
{
autotemp_max=encoderpos;
encoderpos=activeline*lcdslow;
beepshort();
}
BLOCK;
}
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}
}break;
case ItemCT_autotempfact:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
}
if((activeline==line) )
{
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(autotemp_factor*100);
}
else
{
autotemp_max=encoderpos;
encoderpos=activeline*lcdslow;
beepshort();
}
BLOCK;
}
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
if(encoderpos>99) encoderpos=99;
lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
}
}
}break;
case ItemCT_autotempactive:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On");
else
lcdprintPGM("Off");
}
if((activeline==line) )
{
if(CLICKED)
{
autotemp_enabled=!autotemp_enabled;
BLOCK;
}
}
}break;
#endif //autotemp
case ItemCT_fan: case ItemCT_fan:
{ {
if(force_lcd_update) if(force_lcd_update)
@ -1620,6 +1746,19 @@ char *ftostr31(const float &x)
return conv; return conv;
} }
char *ftostr32(const float &x)
{
int xx=x*100;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/100)%10+'0';
conv[2]='.';
conv[3]=(xx/10)%10+'0';
conv[4]=(xx)%10+'0';
conv[6]=0;
return conv;
}
char *itostr31(const int &xx) char *itostr31(const int &xx)
{ {
conv[0]=(xx>=0)?'+':'-'; conv[0]=(xx>=0)?'+':'-';