Initial commit of IAT based timing retard

This commit is contained in:
Josh Stewart 2016-01-03 07:40:27 +11:00
parent 9a6d6dba00
commit 2c747e5459
3 changed files with 30 additions and 15 deletions

View File

@ -249,8 +249,8 @@ struct config2 {
byte wueBins[10]; //Warmup Enrichment bins (Values are in configTable1)
byte dwellLimit;
byte dwellCorrectionValues[6]; //Correction table for dwell vs battery voltage
byte unused48;
byte unused49;
byte iatRetBins[6]; // Inlet Air Temp timing retard curve bins
byte iatRetValues[6]; // Inlet Air Temp timing retard curve values
byte unused50;
byte unused51;
byte unused52;

View File

@ -240,18 +240,13 @@ page = 4
dwellLim = scalar, U08, 41, "ms", 1, 0, 0, 32, 0
dwellRates = array, U08, 42, [6], "%", 1.0, 0.0, 0.00, 255.0, 0
unused4-48 = scalar, U08, 48, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-52 = scalar, U08, 52, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-53 = scalar, U08, 53, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-54 = scalar, U08, 54, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-55 = scalar, U08, 55, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-56 = scalar, U08, 56, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-57 = scalar, U08, 57, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-58 = scalar, U08, 58, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-59 = scalar, U08, 59, "RPM", 100.0, 0.0, 100, 25500, 0
;IAT (Inlet air temp) timing retard
#if CELSIUS
iatRetBins = array, U08, 48, [ 6], "C", 1.0, 0.0, 0.00, 255.0, 0
#else
iatRetBins = array, U08, 48, [ 6], "F", 1.0, 0.0, 0.00, 255.0, 0
#endif
iatRetRates = array, U08, 54, [ 6], "deg", 1.0, 0.0, 0.00, 255.0, 0
unused4-60 = scalar, U08, 60, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
unused4-62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
@ -473,9 +468,9 @@ page = 8
subMenu = sparkTbl, "Spark Table", 2
;subMenu = IdleAdvance, "Idle Advance settings",
;subMenu = Knock, "Kn&ock System"
;subMenu = IatCltIg, "&IAT/Clt Related Ignition"
subMenu = dwellSettings, "Dwell settings"
subMenu = dwell_correction_curve, "Dwell Compensation"
subMenu = iat_retard_curve, "&IAT Retard"
;subMenu = wheelsim, "Stim for wheel"
;subMenu = oddwheel, "Oddfire Wheel settings", 7, { wheelon && oddfire }
@ -808,6 +803,14 @@ page = 8
xBins = airDenBins, iat
yBins = airDenRates
; IAT based ignition timing retard
curve = iat_retard_curve, "IAT timing retard"
columnLabel = "Retard", "Inlet Air Temp"
xAxis = -40, 200, 5
yAxis = 0, 40, 5
xBins = iatRetBins, iat
yBins = iatRetRates
; Curves for idle control
; Standard duty table for PWM valves
curve = iacPwm_curve, "IAC PWM Duty"

View File

@ -77,6 +77,7 @@ struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D)
struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D)
struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D)
byte cltCalibrationTable[CALIBRATION_TABLE_SIZE];
byte iatCalibrationTable[CALIBRATION_TABLE_SIZE];
byte o2CalibrationTable[CALIBRATION_TABLE_SIZE];
@ -176,6 +177,10 @@ void setup()
IATDensityCorrectionTable.xSize = 9;
IATDensityCorrectionTable.values = configPage3.airDenRates;
IATDensityCorrectionTable.axisX = configPage3.airDenBins;
IATRetardTable.valueSize = SIZE_BYTE;
IATRetardTable.xSize = 6;
IATRetardTable.values = configPage2.iatRetValues;
IATRetardTable.axisX = configPage2.iatRetBins;
//Setup the calibration tables
loadCalibration();
@ -756,6 +761,8 @@ void loop()
//Check for fixed ignition angles
if (configPage2.FixAng != 0) { currentStatus.advance = configPage2.FixAng; } //Check whether the user has set a fixed timing angle
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { currentStatus.advance = configPage2.CrankAng; } //Use the fixed cranking ignition angle
//Adjust the advance based on IAT
currentStatus.advance -= table2D_getValue(&IATRetardTable, currentStatus.IAT);
int injector1StartAngle = 0;
int injector2StartAngle = 0;
@ -1123,6 +1130,11 @@ void loop()
/*
#ifdef defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//For the AVR chips, use the faster bit flipping method of switching pins
void ignitionSetter(byte *port, bool startCharge)
{
if(
}
void openInjector1() { *inj1_pin_port |= (inj1_pin_mask); ; BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1); }
void closeInjector1() { *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1); }
void beginCoil1Charge() { *ign1_pin_port |= (ign1_pin_mask); BIT_SET(currentStatus.spark, 0); digitalWrite(pinTachOut, LOW); }