Allow for use of negative advance (i.e. ATDC) values for launch

This commit is contained in:
Josh Stewart 2017-01-21 12:58:45 +11:00
parent 5379de5736
commit ad825c2051
5 changed files with 19 additions and 19 deletions

View File

@ -21,13 +21,13 @@ static inline byte correctionLaunch(); //Launch control correction
static inline bool correctionDFCO(); //Decelleration fuel cutoff
byte correctionsIgn();
static inline byte correctionFixedTiming(byte);
static inline byte correctionCrankingFixedTiming(byte);
static inline byte correctionFlexTiming(byte);
static inline byte correctionIATretard(byte);
static inline byte correctionSoftRevLimit(byte);
static inline byte correctionSoftLaunch(byte);
static inline byte correctionSoftFlatShift(byte);
static inline int8_t correctionFixedTiming(int8_t);
static inline int8_t correctionCrankingFixedTiming(int8_t);
static inline int8_t correctionFlexTiming(int8_t);
static inline int8_t correctionIATretard(int8_t);
static inline int8_t correctionSoftRevLimit(int8_t);
static inline int8_t correctionSoftLaunch(int8_t);
static inline int8_t correctionSoftFlatShift(int8_t);
#endif // CORRECTIONS_H

View File

@ -314,7 +314,7 @@ static inline byte correctionAFRClosedLoop()
//******************************** IGNITION ADVANCE CORRECTIONS ********************************
byte correctionsIgn(byte advance)
int8_t correctionsIgn(int8_t advance)
{
advance = correctionFlexTiming(advance);
@ -329,19 +329,19 @@ byte correctionsIgn(byte advance)
return advance;
}
static inline byte correctionFixedTiming(byte advance)
static inline int8_t correctionFixedTiming(int8_t advance)
{
if (configPage2.FixAng != 0) { return configPage2.FixAng; } //Check whether the user has set a fixed timing angle
return advance;
}
static inline byte correctionCrankingFixedTiming(byte advance)
static inline int8_t correctionCrankingFixedTiming(int8_t advance)
{
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { return configPage2.CrankAng; } //Use the fixed cranking ignition angle
return advance;
}
static inline byte correctionFlexTiming(byte advance)
static inline int8_t correctionFlexTiming(int8_t advance)
{
if(!configPage1.flexEnabled) { return advance; } //Check for flex being enabled
byte flexRange = configPage1.flexAdvHigh - configPage1.flexAdvLow;
@ -352,7 +352,7 @@ static inline byte correctionFlexTiming(byte advance)
return advance + currentStatus.flexIgnCorrection;
}
static inline byte correctionIATretard(byte advance)
static inline int8_t correctionIATretard(int8_t advance)
{
//Adjust the advance based on IAT. If the adjustment amount is greater than the current advance, just set advance to 0
byte advanceIATadjust = table2D_getValue(&IATRetardTable, currentStatus.IAT);
@ -360,14 +360,14 @@ static inline byte correctionIATretard(byte advance)
else { return 0; }
}
static inline byte correctionSoftRevLimit(byte advance)
static inline int8_t correctionSoftRevLimit(int8_t advance)
{
BIT_CLEAR(currentStatus.spark, BIT_SPARK_SFTLIM);
if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim) * 100) ) { BIT_SET(currentStatus.spark, BIT_SPARK_SFTLIM); return configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
return advance;
}
static inline byte correctionSoftLaunch(byte advance)
static inline int8_t correctionSoftLaunch(int8_t advance)
{
//SoftCut rev limit for 2-step launch control.
if (configPage3.launchEnabled && clutchTrigger && (currentStatus.clutchEngagedRPM < ((unsigned int)(configPage3.flatSArm) * 100)) && (currentStatus.RPM > ((unsigned int)(configPage3.lnchSoftLim) * 100)) )
@ -382,7 +382,7 @@ static inline byte correctionSoftLaunch(byte advance)
return advance;
}
static inline byte correctionSoftFlatShift(byte advance)
static inline int8_t correctionSoftFlatShift(int8_t advance)
{
if(configPage3.flatSEnable && clutchTrigger && (currentStatus.clutchEngagedRPM > ((unsigned int)(configPage3.flatSArm) * 100)) && (currentStatus.RPM > (currentStatus.clutchEngagedRPM-configPage3.flatSSoftWin) ) )
{

View File

@ -394,7 +394,7 @@ struct config3 {
byte launchHiLo : 1;
byte lnchSoftLim;
byte lnchRetard;
int8_t lnchRetard; //Allow for negative advance value (ATDC)
byte lnchHardLim;
byte lnchFuelAdd;

View File

@ -360,7 +360,7 @@ page = 6
vvtPin = bits , U08, 13, [0:5], "Board Default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
unused6-13e = bits, U08, 13, [6:6], "ONE", "INVALID"
unused6-13f = bits, U08, 13, [7:7], "ONE", "INVALID"
boostPin = bits , U08, 14, [0:5], "Board Default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
boostPin = bits, U08, 14, [0:5], "Board Default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
unused6-14e = bits, U08, 14, [6:6], "ONE", "INVALID"
unused6-14f = bits, U08, 14, [7:7], "ONE", "INVALID"
brvBins = array, U08, 15, [6], "V", 0.1, 0, 6, 24, 1 ; Bins for the battery reference voltage
@ -383,7 +383,7 @@ page = 6
launchHiLo = bits, U08, 48, [7:7], "LOW", "HIGH"
lnchSoftLim = scalar, U08, 49, "rpm", 100, 0.0, 100, 25500, 0
lnchRetard = scalar, U08, 50, "deg", 1.0, 0.0, 0.0, 80, 0
lnchRetard = scalar, S08, 50, "deg", 1.0, 0.0, -30, 40, 0
lnchHardLim = scalar, U08, 51, "rpm", 100, 0.0, 100, 25500, 0
lnchFuelAdd = scalar, U08, 52, "%", 1.0, 0.0, 0.0, 80, 0

View File

@ -316,7 +316,7 @@ void loadConfig()
for(int x=EEPROM_CONFIG3_XBINS; x<EEPROM_CONFIG3_YBINS; x++)
{
offset = x - EEPROM_CONFIG3_XBINS;
ignitionTable.axisX[offset] = (EEPROM.read(x) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
ignitionTable.axisX[offset] = (EEPROM.read(x) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
}
//TPS/MAP bins
for(int x=EEPROM_CONFIG3_YBINS; x<EEPROM_CONFIG4_START; x++)