if ((millis() - lastInput) > 3000) // return to RUN after 3 seconds idle
{
opState = RUN;
return;
}
lcd.setCursor(0,1);
lcd.print(Kp);
lcd.print(" ");
DoControl();
}
}
// ************************************************
// Integral Tuning State
// UP/DOWN to change Ki
// RIGHT for Kd
// LEFT for Kp
// SHIFT for 10x tuning
// ************************************************
void TuneI()
{
lcd.setBacklight(TEAL);
lcd.print(F("Set Ki"));
uint8_t buttons = 0;
while(true)
{
buttons = ReadButtons();
float increment = 0.01;
if (buttons & BUTTON_SHIFT)
{
increment *= 10;
}
if (buttons & BUTTON_LEFT)
{
opState = TUNE_P;
return;
}
if (buttons & BUTTON_RIGHT)
{
opState = TUNE_D;
return;
}
if (buttons & BUTTON_UP)
{
Ki += increment;
delay(200);
}
if (buttons & BUTTON_DOWN)
{
Ki -= increment;
delay(200);
Commentaires sur ces manuels