From 8fc87e062a0163c1c823acdfe29e56523d57dc07 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Wed, 22 Mar 2017 12:44:22 +1100 Subject: [PATCH] Fixes for closed loop stepper idle (Now ready for wider testing) --- reference/speeduino.ini | 8 ++++---- speeduino/idle.ino | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 0371a428..0cd49601 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1091,9 +1091,9 @@ menuDialog = main field = "Idle valve direction", iacPWMdir, { iacAlgorithm == 2 || iacAlgorithm == 3 } dialog = closedloop_idle, "Closed loop Idle" - field = "P", idleKP, { iacAlgorithm == 3 } - field = "I", idleKI, { iacAlgorithm == 3 } - field = "D", idleKD, { iacAlgorithm == 3 } + field = "P", idleKP, { iacAlgorithm == 3 || iacAlgorithm == 5 } + field = "I", idleKI, { iacAlgorithm == 3 || iacAlgorithm == 5 } + field = "D", idleKD, { iacAlgorithm == 3 || iacAlgorithm == 5 } field = "Minimum valve duty", iacCLminDuty, { iacAlgorithm == 3 } field = "Maximum valve duty", iacCLmaxDuty, { iacAlgorithm == 3 } @@ -1715,7 +1715,7 @@ menuDialog = main ochGetCommand = "A" - ochBlockSize = 39 + ochBlockSize = 40 secl = scalar, U08, 0, "sec", 1.000, 0.000 squirt = scalar, U08, 1, "bits", 1.000, 0.000 diff --git a/speeduino/idle.ino b/speeduino/idle.ino index 9b21afd3..cd959420 100644 --- a/speeduino/idle.ino +++ b/speeduino/idle.ino @@ -170,7 +170,7 @@ void initialiseIdle() idleStepper.curIdleStep = 0; 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.SetMode(AUTOMATIC); //Turn PID on 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 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(); currentStatus.idleLoad = idleStepper.curIdleStep >> 1; //Current step count (Divided by 2 for byte)