add option to invert vvt control (#4425)

* add option to invert vvt control

* s

* s

* s

* one bit per cam type

* move the space

* I don't spelling good

* changelog
This commit is contained in:
Matthew Kennedy 2022-08-09 13:22:55 -07:00 committed by GitHub
parent a227c5f9ec
commit 66b4523575
4 changed files with 24 additions and 4 deletions

View File

@ -33,6 +33,7 @@ Release template (copy/paste this for new release):
- Many more options for Lua CAN rx filters/callbacks #4387
- Password protection against tune access #4243
- Additional CAN messages #4401
- Option to invert VVT control (exhaust cams, etc) #4424
### Fixed
- Lua CAN reception fixed for 11-bit IDs where the frame would be received, but a corrupt ID was passed to the handler function. #4321

View File

@ -71,6 +71,16 @@ expected<percent_t> VvtController::getOpenLoop(angle_t target) {
return 0;
}
static bool shouldInvertVvt(int camIndex) {
// grumble grumble, can't do an array of bits in c++
switch (camIndex) {
case 0: return engineConfiguration->invertVvtControlIntake;
case 1: return engineConfiguration->invertVvtControlExhaust;
}
return false;
}
expected<percent_t> VvtController::getClosedLoop(angle_t target, angle_t observation) {
float retVal = m_pid.getOutput(target, observation);
@ -88,7 +98,14 @@ expected<percent_t> VvtController::getClosedLoop(angle_t target, angle_t observa
}
#endif /* EFI_TUNER_STUDIO */
return retVal;
// User labels say "advance" and "retard"
// "advance" means that additional solenoid duty makes indicated VVT position more positive
// "retard" means that additional solenoid duty makes indicated VVT position more negative
if (shouldInvertVvt(m_cam)) {
return -retVal;
} else {
return retVal;
}
}
void VvtController::setOutput(expected<percent_t> outputValue) {

View File

@ -1075,10 +1075,10 @@ bit launchSmoothRetard;+Interpolates the Ignition Retard from 0 to 100% within t
bit isPhaseSyncRequiredForIgnition;Some engines are OK running semi-random sequential while other engine require phase synchronization
bit useCltBasedRpmLimit,"yes","no";If enabled, use a curve for RPM limit (based on coolant temperature) instead of a constant value.
bit forceO2Heating,"yes","no";If enabled, don't wait for engine start to heat O2 sensors. WARNING: this will reduce the life of your sensor, as condensation in the exhaust from a cold start can crack the sensing element.
bit unused_1484_bit_25
bit unused_1484_bit_26
bit invertVvtControlIntake, "retard","advance";If increased VVT duty cycle increases the indicated VVT angle, set this to 'advance'. If it decreases, set this to 'retard'. Most intake cams use 'advance', and most exhaust cams use 'retard'.
bit invertVvtControlExhaust,"retard","advance";If increased VVT duty cycle increases the indicated VVT angle, set this to 'advance'. If it decreases, set this to 'retard'. Most intake cams use 'advance', and most exhaust cams use 'retard'.
bit unused_1484_bit_27
bit unused_1484_bit_28
bit unused_1484_bit_38
bit unused_1484_bit_29
bit unused_1484_bit_30
bit unused_1484_bit_31

View File

@ -3122,6 +3122,8 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "VVT solenoid bank 2 exhaust", vvtPins4
field = "PWM frequency", vvtOutputFrequency1, {vvtPins1 != 0 || vvtPins2 != 0}
field = "Detailed status in console", isVerboseAuxPid1, {vvtPins1 != 0 || vvtPins2 != 0}
field = "VVT solenoid intake cams control direction", invertVvtControlIntake, { vvtPins1 != 0 || vvtPins3 != 0 }
field = "VVT solenoid exhaust cams control direction", invertVvtControlExhaust, { vvtPins2 != 0 || vvtPins4 != 0 }
dialog = vvtPidDialog1, "Intake PID"
field = "offset", auxPid1_offset, {vvtPins1 != 0}