This commit is contained in:
Josh Stewart 2020-04-19 08:22:58 +10:00
commit c7b3c4d9b2
4 changed files with 94 additions and 20 deletions

View File

@ -218,8 +218,13 @@
;-------------------------------------------------- ;--------------------------------------------------
page = 1 page = 1
aseTsnDelay = scalar, U08, 0, "S", 0.1, 0.0, 0.0, 25.5, 1 aseTsnDelay = scalar, U08, 0, "S", 0.1, 0.0, 0.0, 25.5, 1
unused1-1 = scalar, U08, 1, "kPa", 1.0, 0.0, 0.0, 255, 0 aeColdPct = scalar, U08, 1, "%", 1.0, 0, 100, 255, 0 ;AE cold adjustment %
unused1-2 = scalar, U08, 2, "%", 1.0, 0.0, 0.0, 255, 0 ;This used to be asePct #if CELSIUS
aeColdTaperMin = scalar, U08, 2, "C", 1.0, -40, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#else
aeColdTaperMin = scalar, U08, 2, "F", 1.8, -22.23, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#endif
aeMode = bits, U08, 3, [0:1], "TPS", "MAP", "INVALID", "INVALID" aeMode = bits, U08, 3, [0:1], "TPS", "MAP", "INVALID", "INVALID"
battVCorMode = bits, U08, 3, [2:2], "Whole PW", "Open Time only" battVCorMode = bits, U08, 3, [2:2], "Whole PW", "Open Time only"
unused1-3c = bits, U08, 3, [3:7], "MAP", "TPS", "INVALID", "INVALID" unused1-3c = bits, U08, 3, [3:7], "MAP", "TPS", "INVALID", "INVALID"
@ -276,7 +281,12 @@ page = 1
perToothIgn = bits, U08, 38, [6:6], "No", "Yes" perToothIgn = bits, U08, 38, [6:6], "No", "Yes"
dfcoEnabled = bits, U08, 38, [7:7], "Off", "On" dfcoEnabled = bits, U08, 38, [7:7], "Off", "On"
unused2-39 = scalar, U08, 39, "ms", 0.1, 0.0, 0.0, 25.5, 1 ;This used to be PrimePulse #if CELSIUS
aeColdTaperMax = scalar, U08, 39, "C", 1.0, -40, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#else
aeColdTaperMax = scalar, U08, 39, "F", 1.8, -22.23, -40, 215, 0 ;AE cold adjustment, taper end clt (no adjustment)
#endif
dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 95.0, 0 dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 95.0, 0
flexFreqLow = scalar, U08, 41, "Hz", 1.0, 0.0, 0.0, 250.0, 0 flexFreqLow = scalar, U08, 41, "Hz", 1.0, 0.0, 0.0, 250.0, 0
flexFreqHigh = scalar, U08, 42, "Hz", 1.0, 0.0, 0.0, 250.0, 0 flexFreqHigh = scalar, U08, 42, "Hz", 1.0, 0.0, 0.0, 250.0, 0
@ -1157,6 +1167,9 @@ page = 11
defaultValue = bootloaderCaps, 0 defaultValue = bootloaderCaps, 0
defaultValue = aeTaperMin, 1000 defaultValue = aeTaperMin, 1000
defaultValue = aeTaperMax, 5000 defaultValue = aeTaperMax, 5000
defaultValue = aeColdPct, 100
defaultValue = aeColdTaperMin, 0
defaultValue = aeColdTaperMax, 60
defaultValue = aeMode, 0 ;Set aeMode to TPS defaultValue = aeMode, 0 ;Set aeMode to TPS
defaultValue = batVoltCorrect, 0 defaultValue = batVoltCorrect, 0
defaultValue = legacyMAP, 0 defaultValue = legacyMAP, 0
@ -1452,6 +1465,9 @@ menuDialog = main
oddfire3 = "The ATDC angle of channel 3 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 2)" oddfire3 = "The ATDC angle of channel 3 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 2)"
oddfire4 = "The ATDC angle of channel 4 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 3)" oddfire4 = "The ATDC angle of channel 4 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 3)"
aeColdPct = "Acceleration enrichment adjustment for cold engine. Cold adjustment % is tapered between start and end temperatures.\n100% = no adjustment."
aeColdTaperMin = "AE cold adjustment taper start temperature. When coolant is below this value, full cold adjustment is applied."
aeColdTaperMax = "AE cold adjustment taper end temperature. When coolant is above this value, no cold adjustment is applied."
dfcoRPM = "The RPM above which DFCO will be active. Typically set a few hundred RPM above maximum idle speed" dfcoRPM = "The RPM above which DFCO will be active. Typically set a few hundred RPM above maximum idle speed"
dfcoHyster = "Hysteresis for DFCO RPM. 200-300 RPM is typical for this, however a higher value may be needed if the RPM is fluctuating around the cutout speed" dfcoHyster = "Hysteresis for DFCO RPM. 200-300 RPM is typical for this, however a higher value may be needed if the RPM is fluctuating around the cutout speed"
dfcoTPSThresh= "The TPS value below which DFCO will be active. Typical value is 5%-10%, but higher may be needed if TPS signal is noisy" dfcoTPSThresh= "The TPS value below which DFCO will be active. Typical value is 5%-10%, but higher may be needed if TPS signal is noisy"
@ -1753,7 +1769,7 @@ menuDialog = main
field = "Output speed", tachoDiv field = "Output speed", tachoDiv
field = "Pulse duration", tachoDuration field = "Pulse duration", tachoDuration
dialog = accelEnrichments_center, "Acceleration Enrichment" dialog = accelEnrichments_aeSettings, ""
field = "Enrichment mode", aeMode field = "Enrichment mode", aeMode
field = "TPSdot Threshold", taeThresh, { aeMode == 0 } field = "TPSdot Threshold", taeThresh, { aeMode == 0 }
field = "MAPdot Threshold", maeThresh, { aeMode == 1 } field = "MAPdot Threshold", maeThresh, { aeMode == 1 }
@ -1761,6 +1777,11 @@ menuDialog = main
field = "Taper Start RPM", aeTaperMin field = "Taper Start RPM", aeTaperMin
field = "Taper End RPM", aeTaperMax field = "Taper End RPM", aeTaperMax
dialog = accelEnrichments_coldAdj, "Acceleration Enrichment cold adjustment"
field = "Cold adjustment", aeColdPct
field = "Cold adjustment taper start temperature", aeColdTaperMin
field = "Cold adjustment taper end temperature", aeColdTaperMax
dialog = accelEnrichments_south, "Decelleration Fuel Cutoff (DFCO)" dialog = accelEnrichments_south, "Decelleration Fuel Cutoff (DFCO)"
field = "Enabled", dfcoEnabled field = "Enabled", dfcoEnabled
field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled } field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled }
@ -1779,6 +1800,10 @@ menuDialog = main
panel = time_accel_tpsdot_curve, { aeMode == 0 } panel = time_accel_tpsdot_curve, { aeMode == 0 }
panel = time_accel_mapdot_curve, { aeMode == 1 } panel = time_accel_mapdot_curve, { aeMode == 1 }
dialog = accelEnrichments_center, "Acceleration Enrichment", xAxis
panel = accelEnrichments_aeSettings
panel = accelEnrichments_coldAdj
dialog = accelEnrichments, "Acceleration Enrichment" dialog = accelEnrichments, "Acceleration Enrichment"
topicHelp = "http://speeduino.com/wiki/index.php/Acceleration_Wizard" topicHelp = "http://speeduino.com/wiki/index.php/Acceleration_Wizard"
panel = accelEnrichments_north, North panel = accelEnrichments_north, North

View File

@ -239,10 +239,12 @@ byte correctionASE()
* @brief Acceleration enrichment correction calculation * @brief Acceleration enrichment correction calculation
* *
* Calculates the % change of the throttle over time (%/second) and performs a lookup based on this * Calculates the % change of the throttle over time (%/second) and performs a lookup based on this
* Coolant-based modifier is applied on the top of this.
* When the enrichment is turned on, it runs at that amount for a fixed period of time (taeTime) * When the enrichment is turned on, it runs at that amount for a fixed period of time (taeTime)
* *
* @return uint16_t The Acceleration enrichment modifier as a %. 100% = No modification. * @return uint16_t The Acceleration enrichment modifier as a %. 100% = No modification.
* As the maximum enrichment amount is +255%, the overall return value from this function can be 100+255=355. Hence this function returns a uint16_t rather than byte * As the maximum enrichment amount is +255% and maximum cold adjustment for this is 255%, the overall return value
* from this function can be 100+(255*255/100)=750. Hence this function returns a uint16_t rather than byte
*/ */
uint16_t correctionAccel() uint16_t correctionAccel()
{ {
@ -291,7 +293,7 @@ uint16_t correctionAccel()
currentStatus.AEEndTime = micros_safe() + ((unsigned long)configPage2.aeTime * 10000); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS / 10, so multiply it by 100 to get it in uS currentStatus.AEEndTime = micros_safe() + ((unsigned long)configPage2.aeTime * 10000); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS / 10, so multiply it by 100 to get it in uS
accelValue = table2D_getValue(&maeTable, currentStatus.mapDOT); accelValue = table2D_getValue(&maeTable, currentStatus.mapDOT);
//Apply the taper to the above //Apply the RPM taper to the above
//The RPM settings are stored divided by 100: //The RPM settings are stored divided by 100:
uint16_t trueTaperMin = configPage2.aeTaperMin * 100; uint16_t trueTaperMin = configPage2.aeTaperMin * 100;
uint16_t trueTaperMax = configPage2.aeTaperMax * 100; uint16_t trueTaperMax = configPage2.aeTaperMax * 100;
@ -305,6 +307,27 @@ uint16_t correctionAccel()
accelValue = percentage((100-taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount. accelValue = percentage((100-taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount.
} }
} }
//Apply AE cold coolant modifier, if CLT is less than taper end temperature
if ( currentStatus.coolant < (int)(configPage2.aeColdTaperMax - CALIBRATION_TEMPERATURE_OFFSET) )
{
//If CLT is less than taper min temp, apply full modifier on top of accelValue
if ( currentStatus.coolant <= (int)(configPage2.aeColdTaperMin - CALIBRATION_TEMPERATURE_OFFSET) )
{
uint16_t accelValue_uint = (uint16_t) accelValue * configPage2.aeColdPct / 100;
accelValue = (int16_t) accelValue_uint;
}
//If CLT is between taper min and max, taper the modifier value and apply it on top of accelValue
else
{
int16_t taperRange = (int16_t) configPage2.aeColdTaperMax - configPage2.aeColdTaperMin;
int16_t taperPercent = (int)((currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET - configPage2.aeColdTaperMin) * 100) / taperRange;
int16_t coldPct = (int16_t) 100+ percentage((100-taperPercent), configPage2.aeColdPct-100);
uint16_t accelValue_uint = (uint16_t) accelValue * coldPct / 100; //Potential overflow (if AE is large) without using uint16_t
accelValue = (int16_t) accelValue_uint;
}
}
accelValue = 100 + accelValue; //Add the 100 normalisation to the calculated amount accelValue = 100 + accelValue; //Add the 100 normalisation to the calculated amount
} //MAE Threshold } //MAE Threshold
} }
@ -332,7 +355,7 @@ uint16_t correctionAccel()
currentStatus.AEEndTime = micros_safe() + ((unsigned long)configPage2.aeTime * 10000); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS / 10, so multiply it by 100 to get it in uS currentStatus.AEEndTime = micros_safe() + ((unsigned long)configPage2.aeTime * 10000); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS / 10, so multiply it by 100 to get it in uS
accelValue = table2D_getValue(&taeTable, currentStatus.tpsDOT); accelValue = table2D_getValue(&taeTable, currentStatus.tpsDOT);
//Apply the taper to the above //Apply the RPM taper to the above
//The RPM settings are stored divided by 100: //The RPM settings are stored divided by 100:
uint16_t trueTaperMin = configPage2.aeTaperMin * 100; uint16_t trueTaperMin = configPage2.aeTaperMin * 100;
uint16_t trueTaperMax = configPage2.aeTaperMax * 100; uint16_t trueTaperMax = configPage2.aeTaperMax * 100;
@ -346,6 +369,27 @@ uint16_t correctionAccel()
accelValue = percentage((100-taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount. accelValue = percentage((100-taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount.
} }
} }
//Apply AE cold coolant modifier, if CLT is less than taper end temperature
if ( currentStatus.coolant < (int)(configPage2.aeColdTaperMax - CALIBRATION_TEMPERATURE_OFFSET) )
{
//If CLT is less than taper min temp, apply full modifier on top of accelValue
if ( currentStatus.coolant <= (int)(configPage2.aeColdTaperMin - CALIBRATION_TEMPERATURE_OFFSET) )
{
uint16_t accelValue_uint = (uint16_t) accelValue * configPage2.aeColdPct / 100;
accelValue = (int16_t) accelValue_uint;
}
//If CLT is between taper min and max, taper the modifier value and apply it on top of accelValue
else
{
int16_t taperRange = (int16_t) configPage2.aeColdTaperMax - configPage2.aeColdTaperMin;
int16_t taperPercent = (int)((currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET - configPage2.aeColdTaperMin) * 100) / taperRange;
int16_t coldPct = (int16_t) 100+ percentage((100-taperPercent), configPage2.aeColdPct-100);
uint16_t accelValue_uint = (uint16_t) accelValue * coldPct / 100; //Potential overflow (if AE is large) without using uint16_t
accelValue = (int16_t) accelValue_uint;
}
}
accelValue = 100 + accelValue; //Add the 100 normalisation to the calculated amount accelValue = 100 + accelValue; //Add the 100 normalisation to the calculated amount
} //TAE Threshold } //TAE Threshold
} //TPS change > 2 } //TPS change > 2

View File

@ -528,8 +528,8 @@ struct statuses {
struct config2 { struct config2 {
byte aseTsnDelay; byte aseTsnDelay;
byte unused2_1; byte aeColdPct; //AE cold clt modifier %
byte unused2_2; //was ASE byte aeColdTaperMin; //AE cold modifier, taper start temp (full modifier), was ASE in early versions
byte aeMode : 2; /**< Acceleration Enrichment mode. 0 = TPS, 1 = MAP. Values 2 and 3 reserved for potential future use (ie blended TPS / MAP) */ byte aeMode : 2; /**< Acceleration Enrichment mode. 0 = TPS, 1 = MAP. Values 2 and 3 reserved for potential future use (ie blended TPS / MAP) */
byte battVCorMode : 1; byte battVCorMode : 1;
byte unused1_3c : 5; byte unused1_3c : 5;
@ -587,7 +587,7 @@ struct config2 {
byte perToothIgn : 1; byte perToothIgn : 1;
byte dfcoEnabled : 1; //Whether or not DFCO is turned on byte dfcoEnabled : 1; //Whether or not DFCO is turned on
byte unused2_39; //Was primePulse byte aeColdTaperMax; //AE cold modifier, taper end temp (no modifier applied), was primePulse in early versions
byte dutyLim; byte dutyLim;
byte flexFreqLow; //Lowest valid frequency reading from the flex sensor byte flexFreqLow; //Lowest valid frequency reading from the flex sensor
byte flexFreqHigh; //Highest valid frequency reading from the flex sensor byte flexFreqHigh; //Highest valid frequency reading from the flex sensor

View File

@ -101,7 +101,7 @@ void doUpdates()
//Convert whatever flex fuel settings are there into the new tables //Convert whatever flex fuel settings are there into the new tables
configPage10.flexBoostBins[0] = 0; configPage10.flexBoostBins[0] = 0;
configPage10.flexBoostAdj[0] = (int8_t)configPage2.unused2_1; configPage10.flexBoostAdj[0] = (int8_t)configPage2.aeColdPct;
configPage10.flexFuelBins[0] = 0; configPage10.flexFuelBins[0] = 0;
configPage10.flexFuelAdj[0] = configPage2.idleUpPin; configPage10.flexFuelAdj[0] = configPage2.idleUpPin;
@ -116,7 +116,7 @@ void doUpdates()
configPage10.flexFuelBins[x] = pct; configPage10.flexFuelBins[x] = pct;
configPage10.flexAdvBins[x] = pct; configPage10.flexAdvBins[x] = pct;
int16_t boostAdder = (((configPage2.unused2_2 - (int8_t)configPage2.unused2_1) * pct) / 100) + (int8_t)configPage2.unused2_1; int16_t boostAdder = (((configPage2.aeColdTaperMin - (int8_t)configPage2.aeColdPct) * pct) / 100) + (int8_t)configPage2.aeColdPct;
configPage10.flexBoostAdj[x] = boostAdder; configPage10.flexBoostAdj[x] = boostAdder;
uint8_t fuelAdder = (((configPage2.idleUpAdder - configPage2.idleUpPin) * pct) / 100) + configPage2.idleUpPin; uint8_t fuelAdder = (((configPage2.idleUpAdder - configPage2.idleUpPin) * pct) / 100) + configPage2.idleUpPin;
@ -169,10 +169,10 @@ void doUpdates()
{ {
//May 2019 version adds the use of a 2D table for the priming pulse rather than a single value. //May 2019 version adds the use of a 2D table for the priming pulse rather than a single value.
//This sets all the values in the 2D table to be the same as the previous single value //This sets all the values in the 2D table to be the same as the previous single value
configPage2.primePulse[0] = configPage2.unused2_39 / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5 configPage2.primePulse[0] = configPage2.aeColdTaperMax / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5
configPage2.primePulse[1] = configPage2.unused2_39 / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5 configPage2.primePulse[1] = configPage2.aeColdTaperMax / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5
configPage2.primePulse[2] = configPage2.unused2_39 / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5 configPage2.primePulse[2] = configPage2.aeColdTaperMax / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5
configPage2.primePulse[3] = configPage2.unused2_39 / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5 configPage2.primePulse[3] = configPage2.aeColdTaperMax / 5; //New priming pulse values are in the range 0-127.5 rather than 0-25.5 so they must be divided by 5
//Set some sane default temperatures for this table //Set some sane default temperatures for this table
configPage2.primeBins[0] = 0; configPage2.primeBins[0] = 0;
configPage2.primeBins[1] = 40; configPage2.primeBins[1] = 40;
@ -181,10 +181,10 @@ void doUpdates()
//Also added is coolant based ASE for both duration and amount //Also added is coolant based ASE for both duration and amount
//All the adder amounts are set to what the single value was previously //All the adder amounts are set to what the single value was previously
configPage2.asePct[0] = configPage2.unused2_2; configPage2.asePct[0] = configPage2.aeColdTaperMin;
configPage2.asePct[1] = configPage2.unused2_2; configPage2.asePct[1] = configPage2.aeColdTaperMin;
configPage2.asePct[2] = configPage2.unused2_2; configPage2.asePct[2] = configPage2.aeColdTaperMin;
configPage2.asePct[3] = configPage2.unused2_2; configPage2.asePct[3] = configPage2.aeColdTaperMin;
//ASE duration is set to 10s for all coolant values //ASE duration is set to 10s for all coolant values
configPage2.aseCount[0] = 10; configPage2.aseCount[0] = 10;
configPage2.aseCount[1] = 10; configPage2.aseCount[1] = 10;
@ -330,6 +330,11 @@ void doUpdates()
configPage10.flexAdvAdj[i] += 40; configPage10.flexAdvAdj[i] += 40;
} }
//AE cold modifier added. Default to sane values
configPage2.aeColdPct = 100;
configPage2.aeColdTaperMin = 40;
configPage2.aeColdTaperMax = 100;
writeAllConfig(); writeAllConfig();
EEPROM.write(EEPROM_DATA_VERSION, 14); EEPROM.write(EEPROM_DATA_VERSION, 14);
} }