Boost by Gear (#573)

* Boost by Gear

* Minor changes to PR

- Changed *2 into bitwise operator
- Reserved 1 extra bit for boostByGearEnabled for 2 additional boost by gear modes in the future

* Added mode to set percentage of boost target table
This commit is contained in:
DylanRooijakkers 2021-07-18 02:37:16 +02:00 committed by GitHub
parent 68997257c2
commit 49a251432c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 10 deletions

View File

@ -80,6 +80,7 @@
#define fullStatus_def = $fullStatus_def_1, $fullStatus_def_2, $fullStatus_def_3, $fullStatus_def_4
boostTableLabels = bits, U08, [0:1], "Duty Cycle %", "kPa"
boostByGearLabels = bits, U08, [0:1], "", "%", "kPa", ""
prgm_out_selection = bits, U08, [0:2], "1", "2", "3", "4", "5", "6", "7", "8"
fuelLoadMax = scalar, U08, "", 1, 0, 0, 511, 0
@ -972,13 +973,22 @@ 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], ""
boostByGearEnabled = bits, U08, 153, [4:5], "Off", "Multiplied %", "Constant limit", "INVALID"
blankfield = bits, U08, 153, [6:6], "",""
unused10_153 = bits, U08, 153, [7:7], ""
iacMaxSteps = scalar, U08, 154, "Steps", 3, 0, 0, {iacStepHome-3}, 0
unused10_154 = array, U08, 155, [37], "", 1, 0, 0, 255, 0
boostByGear1 = scalar, U08, 155, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
boostByGear2 = scalar, U08, 156, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
boostByGear3 = scalar, U08, 157, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
boostByGear4 = scalar, U08, 158, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
boostByGear5 = scalar, U08, 159, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
boostByGear6 = scalar, U08, 160, { bitStringValue(boostByGearLabels , boostByGearEnabled) }, 2.0, 0.0, 0.0, 511.0, 0
unused10_160 = array, U08, 161, [31], "", 1, 0, 0, 255, 0
page = 10
#if CELSIUS
@ -1433,6 +1443,7 @@ page = 14
defaultValue = vvtCL0DutyAng, 0
defaultValue = vvt2CL0DutyAng, 0
defaultValue = ANGLEFILTER_VVT, 0
defaultValue = boostByGearEnabled, 0
;Default pins
defaultValue = fanPin, 0
@ -2551,6 +2562,15 @@ menuDialog = main
dialog = boostCut, "Boost Cut"
field = "Enable Boost limit", boostCutEnabled
field = "Boost Limit", boostLimit, { boostCutEnabled }
dialog = boostByGear, "Boost by Gear"
field = "Enable Boost by Gear", boostByGearEnabled
field = "Gear 1 ", boostByGear1, { boostByGearEnabled }
field = "Gear 2 ", boostByGear2, { boostByGearEnabled }
field = "Gear 3 ", boostByGear3, { boostByGearEnabled }
field = "Gear 4 ", boostByGear4, { boostByGearEnabled }
field = "Gear 5 ", boostByGear5, { boostByGearEnabled }
field = "Gear 6 ", boostByGear6, { boostByGearEnabled }
dialog = boostLoad, ""
field = "Mode", boostType
@ -2776,6 +2796,7 @@ menuDialog = main
field = "Valve minimum duty cycle", boostMinDuty, { boostEnabled && boostType == 1 }
field = "Valve maximum duty cycle", boostMaxDuty, { boostEnabled && boostType == 1 }
panel = boostCut
panel = boostByGear { boostEnabled && boostType == 1 && vssMode > 1 }
field = "Closed Loop settings"
field = "Control mode", boostMode, { boostEnabled && boostType == 1 }
slider = "Sensitivity", boostSens, horizontal, { boostEnabled && boostType == 1 }

View File

@ -172,7 +172,75 @@ void boostControl()
}
else if (configPage4.boostType == CLOSED_LOOP_BOOST)
{
if( (boostCounter & 7) == 1) { currentStatus.boostTarget = get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM) * 2; } //Boost target table is in kpa and divided by 2
if( (boostCounter & 7) == 1)
{
if( (configPage9.boostByGearEnabled == 1) && (configPage2.vssMode > 1) )
{
uint16_t combinedBoost = 0;
switch (currentStatus.gear)
{
case 1:
combinedBoost = ( ((uint16_t)configPage9.boostByGear1 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
case 2:
combinedBoost = ( ((uint16_t)configPage9.boostByGear2 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
case 3:
combinedBoost = ( ((uint16_t)configPage9.boostByGear3 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
case 4:
combinedBoost = ( ((uint16_t)configPage9.boostByGear4 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
case 5:
combinedBoost = ( ((uint16_t)configPage9.boostByGear5 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
case 6:
combinedBoost = ( ((uint16_t)configPage9.boostByGear6 * (uint16_t)get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM)) / 100 ) << 2;
if( combinedBoost <= 511 ){ currentStatus.boostTarget = combinedBoost; }
else{ currentStatus.boostTarget = 511; }
break;
default:
break;
}
}
else if( (configPage9.boostByGearEnabled == 2) && (configPage2.vssMode > 1) )
{
switch (currentStatus.gear)
{
case 1:
currentStatus.boostTarget = (configPage9.boostByGear1 << 1);
break;
case 2:
currentStatus.boostTarget = (configPage9.boostByGear2 << 1);
break;
case 3:
currentStatus.boostTarget = (configPage9.boostByGear3 << 1);
break;
case 4:
currentStatus.boostTarget = (configPage9.boostByGear4 << 1);
break;
case 5:
currentStatus.boostTarget = (configPage9.boostByGear5 << 1);
break;
case 6:
currentStatus.boostTarget = (configPage9.boostByGear6 << 1);
break;
default:
break;
}
}
else{ currentStatus.boostTarget = get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM) << 1; } //Boost target table is in kpa and divided by 2
}
if(currentStatus.MAP >= 100 ) //Only engage boost control above 100kpa.
{
//If flex fuel is enabled, there can be an adder to the boost target based on ethanol content

View File

@ -1116,14 +1116,17 @@ 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 boostByGearEnabled : 2;
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;
byte unused10_158;
byte unused10_159;
byte unused10_160;
byte boostByGear1;
byte boostByGear2;
byte boostByGear3;
byte boostByGear4;
byte boostByGear5;
byte boostByGear6;
byte unused10_161;
byte unused10_162;
byte unused10_163;

View File

@ -491,6 +491,8 @@ void doUpdates()
configPage10.vvtCLMaxAng = 200;
configPage4.ANGLEFILTER_VVT = 0;
configPage9.boostByGearEnabled = 0;
writeAllConfig();
EEPROM.write(EEPROM_DATA_VERSION, 18);
}