Separate out stepper homing steps from maximum number of steps (#257)
* Provide support for changing the idle stepper direction through the use of an "inverted Y/N" setting. This is to avoid the need to change wiring if it turns out the stepper is working in the opposite direction to what is expected. * Add a new setting maximum number of stepper motor steps, so that homing can be done more reliably.
This commit is contained in:
parent
f877ef0623
commit
0e5f50d1e9
|
@ -0,0 +1 @@
|
|||
e75d053adb61abb85da3f6fe8970696475c7e228
|
|
@ -854,10 +854,12 @@ page = 9
|
|||
iacStepperInv = bits, U08, 153, [0:0], "No", "Yes"
|
||||
iacCoolTime = bits, U08, 153, [1:3], "0", "1", "2", "3", "4", "5", "6","INVALID"
|
||||
blankfield = bits, U08, 153, [4:4], "",""
|
||||
|
||||
unused10_153 = bits, U08, 153, [5:7], ""
|
||||
|
||||
iacMaxSteps = scalar, U08, 154, "Steps", 3, 0, 0, {iacStepHome-3}, 0
|
||||
|
||||
unused10_154 = array, U08, 154, [38], "", 1, 0, 0, 255, 0
|
||||
unused10_154 = array, U08, 155, [37], "", 1, 0, 0, 255, 0
|
||||
|
||||
page = 10
|
||||
#if CELSIUS
|
||||
|
@ -1343,6 +1345,7 @@ menuDialog = main
|
|||
iacCoolTime = "Cool time between each step. Set to zero if you don't want any cooling at all"
|
||||
|
||||
iacStepHome = "Homing steps to perform on startup. Must be greater than the fully open steps value"
|
||||
iacMaxSteps = "Maximum number of steps the IAC can be moved away from the home position. Should always be less than Homing steps."
|
||||
iacStepHyster = "The minimum number of steps to move in any one go."
|
||||
iacAlgorithm = "Selects method of idle control.\nNone = no idle control valve.\nOn/Off valve.\nPWM valve (2,3 wire).\nStepper Valve (4,6,8 wire)."
|
||||
iacPWMdir = "Normal PWM valves increase RPM with higher duty. If RPM decreases with higher duty then select Reverse"
|
||||
|
@ -1751,6 +1754,7 @@ menuDialog = main
|
|||
field = "Cool time (ms)", iacCoolTime, { iacAlgorithm == 4 || iacAlgorithm == 5 }
|
||||
field = "Home steps", iacStepHome, { iacAlgorithm == 4 || iacAlgorithm == 5 }
|
||||
field = "Minimum Steps", iacStepHyster, { iacAlgorithm == 4 || iacAlgorithm == 5 }
|
||||
field = "Don't exceed", iacMaxSteps, { iacAlgorithm == 4 || iacAlgorithm == 5 }
|
||||
field = "Stepper Inverted", iacStepperInv, { iacAlgorithm == 4 || iacAlgorithm == 5 }
|
||||
|
||||
dialog = pwm_idle, "PWM Idle"
|
||||
|
|
|
@ -811,7 +811,8 @@ struct config9 {
|
|||
byte iacStepperInv : 1; //stepper direction of travel to allow reversing. 0=normal, 1=inverted.
|
||||
byte iacCoolTime : 3; // how long to wait for the stepper to cool between steps
|
||||
|
||||
byte unused10_154;
|
||||
byte iacMaxSteps; // Step limit beyond which the stepper won't be driven. Should always be less than homing steps. Stored div 3 as per home steps.
|
||||
|
||||
byte unused10_155;
|
||||
byte unused10_156;
|
||||
byte unused10_157;
|
||||
|
|
|
@ -152,7 +152,7 @@ void initialiseIdle()
|
|||
idleStepper.moreAirDirection = STEPPER_BACKWARD;
|
||||
}
|
||||
|
||||
idlePID.SetOutputLimits(0, (configPage6.iacStepHome * 3)); //Maximum number of steps probably needs its own setting
|
||||
idlePID.SetOutputLimits(0, (configPage9.iacMaxSteps * 3)); //Maximum number of steps; always less than home steps count.
|
||||
idlePID.SetTunings(configPage6.idleKP, configPage6.idleKI, configPage6.idleKD);
|
||||
idlePID.SetMode(AUTOMATIC); //Turn PID on
|
||||
break;
|
||||
|
@ -256,6 +256,11 @@ void idleControl()
|
|||
//Currently cranking. Use the cranking table
|
||||
idleStepper.targetIdleStep = table2D_getValue(&iacCrankStepsTable, (currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET)) * 3; //All temps are offset by 40 degrees. Step counts are divided by 3 in TS. Multiply back out here
|
||||
if(currentStatus.idleUpActive == true) { idleStepper.targetIdleStep += configPage2.idleUpAdder; } //Add Idle Up amount if active
|
||||
|
||||
//limit to the configured max steps. This must include any idle up adder, to prevent over-opening.
|
||||
if (idleStepper.targetIdleStep > configPage9.iacMaxSteps * 3)
|
||||
idleStepper.targetIdleStep = configPage9.iacMaxSteps * 3;
|
||||
|
||||
doStep();
|
||||
}
|
||||
else if( (currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) < iacStepTable.axisX[IDLE_TABLE_SIZE-1])
|
||||
|
@ -269,6 +274,10 @@ void idleControl()
|
|||
if(currentStatus.idleUpActive == true) { idleStepper.targetIdleStep += configPage2.idleUpAdder; } //Add Idle Up amount if active
|
||||
iacStepTime = configPage6.iacStepTime * 1000;
|
||||
iacCoolTime = configPage9.iacCoolTime * 1000;
|
||||
|
||||
//limit to the configured max steps. This must include any idle up adder, to prevent over-opening.
|
||||
if (idleStepper.targetIdleStep > configPage9.iacMaxSteps * 3)
|
||||
idleStepper.targetIdleStep = configPage9.iacMaxSteps * 3;
|
||||
}
|
||||
doStep();
|
||||
}
|
||||
|
@ -297,6 +306,10 @@ void idleControl()
|
|||
idlePID.Compute(true);
|
||||
idleStepper.targetIdleStep = idle_pid_target_value;
|
||||
|
||||
//limit to the configured max steps. This must include any idle up adder, to prevent over-opening.
|
||||
if (idleStepper.targetIdleStep > configPage9.iacMaxSteps * 3)
|
||||
idleStepper.targetIdleStep = configPage9.iacMaxSteps * 3;
|
||||
|
||||
doStep();
|
||||
currentStatus.idleLoad = idleStepper.curIdleStep >> 1; //Current step count (Divided by 2 for byte)
|
||||
idleCounter++;
|
||||
|
@ -442,6 +455,10 @@ static inline void disableIdle()
|
|||
*/
|
||||
idleStepper.targetIdleStep = table2D_getValue(&iacCrankStepsTable, (currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET)) * 3; //All temps are offset by 40 degrees. Step counts are divided by 3 in TS. Multiply back out here
|
||||
if(currentStatus.idleUpActive == true) { idleStepper.targetIdleStep += configPage2.idleUpAdder; } //Add Idle Up amount if active?
|
||||
|
||||
//limit to the configured max steps. This must include any idle up adder, to prevent over-opening.
|
||||
if (idleStepper.targetIdleStep > configPage9.iacMaxSteps * 3)
|
||||
idleStepper.targetIdleStep = configPage9.iacMaxSteps * 3;
|
||||
}
|
||||
}
|
||||
BIT_CLEAR(currentStatus.spark, BIT_SPARK_IDLE); //Turn the idle control flag off
|
||||
|
|
Loading…
Reference in New Issue