Adjust for full sensitivity scale on ideal PID controller

This commit is contained in:
Josh Stewart 2017-09-07 08:58:24 +10:00
parent 7c0932a396
commit 62d3c19c31
1 changed files with 2 additions and 1 deletions

View File

@ -428,7 +428,7 @@ bool integerPID_ideal::Compute()
if(timeChange >= *mySampleTime)
{
/*Compute all the working error variables*/
uint16_t sensitivity = 5001 - *mySensitivity;
uint16_t sensitivity = 10001 - (*mySensitivity * 2);
long unitless_setpoint = (((long)*mySetpoint - 0) * 10000L) / (sensitivity - 0);
long unitless_input = (((long)*myInput - 0) * 10000L) / (sensitivity - 0);
long error = unitless_setpoint - unitless_input;
@ -530,6 +530,7 @@ void integerPID_ideal::Initialize()
{
ITerm = 0;
lastInput = *myInput;
lastError = 0;
}
/* SetControllerDirection(...)*************************************************