Fixes for closed loop stepper idle (Now ready for wider testing)

This commit is contained in:
Josh Stewart 2017-03-22 12:44:22 +11:00
parent 697e3a2c17
commit 8fc87e062a
2 changed files with 6 additions and 6 deletions

View File

@ -1091,9 +1091,9 @@ menuDialog = main
field = "Idle valve direction", iacPWMdir, { iacAlgorithm == 2 || iacAlgorithm == 3 } field = "Idle valve direction", iacPWMdir, { iacAlgorithm == 2 || iacAlgorithm == 3 }
dialog = closedloop_idle, "Closed loop Idle" dialog = closedloop_idle, "Closed loop Idle"
field = "P", idleKP, { iacAlgorithm == 3 } field = "P", idleKP, { iacAlgorithm == 3 || iacAlgorithm == 5 }
field = "I", idleKI, { iacAlgorithm == 3 } field = "I", idleKI, { iacAlgorithm == 3 || iacAlgorithm == 5 }
field = "D", idleKD, { iacAlgorithm == 3 } field = "D", idleKD, { iacAlgorithm == 3 || iacAlgorithm == 5 }
field = "Minimum valve duty", iacCLminDuty, { iacAlgorithm == 3 } field = "Minimum valve duty", iacCLminDuty, { iacAlgorithm == 3 }
field = "Maximum valve duty", iacCLmaxDuty, { iacAlgorithm == 3 } field = "Maximum valve duty", iacCLmaxDuty, { iacAlgorithm == 3 }
@ -1715,7 +1715,7 @@ menuDialog = main
ochGetCommand = "A" ochGetCommand = "A"
ochBlockSize = 39 ochBlockSize = 40
secl = scalar, U08, 0, "sec", 1.000, 0.000 secl = scalar, U08, 0, "sec", 1.000, 0.000
squirt = scalar, U08, 1, "bits", 1.000, 0.000 squirt = scalar, U08, 1, "bits", 1.000, 0.000

View File

@ -170,7 +170,7 @@ void initialiseIdle()
idleStepper.curIdleStep = 0; idleStepper.curIdleStep = 0;
idleStepper.stepperStatus = SOFF; idleStepper.stepperStatus = SOFF;
idlePID.SetOutputLimits(0, (configPage4.iacStepHome * 3) << 7); //Maximum number of steps probably needs its own setting idlePID.SetOutputLimits(0, (configPage4.iacStepHome * 3)); //Maximum number of steps probably needs its own setting
idlePID.SetTunings(configPage3.idleKP, configPage3.idleKI, configPage3.idleKD); idlePID.SetTunings(configPage3.idleKP, configPage3.idleKI, configPage3.idleKD);
idlePID.SetMode(AUTOMATIC); //Turn PID on idlePID.SetMode(AUTOMATIC); //Turn PID on
break; break;
@ -267,7 +267,7 @@ void idleControl()
idle_cl_target_rpm = table2D_getValue(&iacClosedLoopTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 10; //All temps are offset by 40 degrees idle_cl_target_rpm = table2D_getValue(&iacClosedLoopTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 10; //All temps are offset by 40 degrees
idlePID.Compute(); idlePID.Compute();
idleStepper.targetIdleStep = (idle_pid_target_value >> 7); //Target is scaled down by 128 to bring it inline with most stepper motors range. Allows a sane range of around 300 steps (Maximum RPM error of 600, P=64) idleStepper.targetIdleStep = idle_pid_target_value;
doStep(); doStep();
currentStatus.idleLoad = idleStepper.curIdleStep >> 1; //Current step count (Divided by 2 for byte) currentStatus.idleLoad = idleStepper.curIdleStep >> 1; //Current step count (Divided by 2 for byte)