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