pid: fix coefficents

This commit is contained in:
Vasily Davydov 2022-10-27 17:07:59 +03:00
parent fa8734a9a8
commit 45c2ec6409
2 changed files with 14 additions and 14 deletions

View File

@ -20,7 +20,7 @@ enum _global_values
LCD_SIZE = 16,
TIMER_GLOBAL_TIMEOUT = 120000,
TIMER_SENSORS_TIMEOUT = 5000,
TIMER_PRESSURE_TIMEOUT = 250,
TIMER_PRESSURE_TIMEOUT = 150,
TIMER_ERROR_VALUE = -255,
};

View File

@ -207,7 +207,7 @@ StateHandler::handleControlButtons (uint8_t button)
}
if (current_mode == MANUAL && saveSetAndDisplay (MANUAL))
{
this->_propeller->spin (getSetSpeed () * 10);
this->_propeller->spin (fan_speed_normalized ());
}
else
{
@ -264,15 +264,15 @@ int
StateHandler::fan_speed_normalized ()
{
int speed = value[MANUAL].getCurrent ();
if (speed <= 92)
speed += 8;
if (speed <= 95)
speed += 5;
return speed * 10;
}
void
StateHandler::pid ()
{
float kP = 1.0, kI = 0.1, kD = 0.125;
float kP = 0.6, kI = 0.05, kD = 0.125;
int error = 0, last_error = 0, derivative = 0;
error = saved_set_value[AUTO] - saved_curr_value[AUTO];
last_error = error;