Added PID autotune. (experimental)

M303 Starts autotune. Wait till the Kp Ki and Kd constants are printed.
Put these values in Configuration.h
This commit is contained in:
Erik van der Zalm
2012-03-08 21:43:21 +01:00
parent 116dc86b8a
commit c077316b2b
5 changed files with 274 additions and 169 deletions

View File

@@ -315,19 +315,18 @@ void MainMenu::showStatus()
static int olddegHotEnd0=-1;
static int oldtargetHotEnd0=-1;
//force_lcd_update=true;
if(force_lcd_update||feedmultiplychanged) //initial display of content
if(force_lcd_update) //initial display of content
{
feedmultiplychanged=false;
encoderpos=feedmultiply;
clear();
lcd.setCursor(0,0);lcdprintPGM("\002123/567\001 ");
lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
#if defined BED_USES_THERMISTOR || defined BED_USES_AD595
lcd.setCursor(10,0);lcdprintPGM("B123/567\001 ");
lcd.setCursor(10,0);lcdprintPGM("B---/---\001 ");
#endif
}
int tHotEnd0=intround(degHotend0());
if((abs(tHotEnd0-olddegHotEnd0)>1)||force_lcd_update) //>1 because otherwise the lcd is refreshed to often.
if((tHotEnd0!=olddegHotEnd0)||force_lcd_update)
{
lcd.setCursor(1,0);
lcd.print(ftostr3(tHotEnd0));
@@ -379,8 +378,15 @@ void MainMenu::showStatus()
lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
oldzpos=currentz;
}
static int oldfeedmultiply=0;
int curfeedmultiply=feedmultiply;
if(feedmultiplychanged == true) {
feedmultiplychanged == false;
encoderpos = curfeedmultiply;
}
if(encoderpos!=curfeedmultiply||force_lcd_update)
{
curfeedmultiply=encoderpos;
@@ -391,12 +397,14 @@ void MainMenu::showStatus()
feedmultiply=curfeedmultiply;
encoderpos=curfeedmultiply;
}
if((curfeedmultiply!=oldfeedmultiply)||force_lcd_update)
{
oldfeedmultiply=curfeedmultiply;
lcd.setCursor(0,2);
lcd.print(itostr3(curfeedmultiply));lcdprintPGM("% ");
}
if(messagetext[0]!='\0')
{
lcd.setCursor(0,LCD_HEIGHT-1);
@@ -404,7 +412,6 @@ void MainMenu::showStatus()
uint8_t n=strlen(messagetext);
for(int8_t i=0;i<LCD_WIDTH-n;i++)
lcd.print(" ");
messagetext[0]='\0';
}