Honour dwellCrank

This commit is contained in:
Josh Stewart 2015-02-07 18:16:08 +11:00
parent 415481c789
commit ea647441d3
3 changed files with 11 additions and 7 deletions

View File

@ -132,10 +132,8 @@ void sendValues(int length)
response[10] = currentStatus.egoCorrection; //Exhaust gas correction (%) response[10] = currentStatus.egoCorrection; //Exhaust gas correction (%)
response[11] = 0x00; //Air Correction (%) response[11] = 0x00; //Air Correction (%)
response[12] = currentStatus.wueCorrection; //Warmup enrichment (%) response[12] = currentStatus.wueCorrection; //Warmup enrichment (%)
//response[13] = (byte)(div(currentStatus.RPM, 100).quot); //rpm / 100
response[13] = highByte(currentStatus.RPM); //rpm HB response[13] = highByte(currentStatus.RPM); //rpm HB
response[14] = lowByte(currentStatus.RPM); //rpm LB response[14] = lowByte(currentStatus.RPM); //rpm LB
//response[14] = (byte)(currentStatus.PW / 200); //Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS.
response[15] = currentStatus.TAEamount; //acceleration enrichment (%) response[15] = currentStatus.TAEamount; //acceleration enrichment (%)
response[16] = 0x00; //Barometer correction (%) response[16] = 0x00; //Barometer correction (%)
response[17] = currentStatus.corrections; //Total GammaE (%) response[17] = currentStatus.corrections; //Total GammaE (%)

View File

@ -56,6 +56,7 @@ struct statuses {
int iatADC; int iatADC;
int batADC; int batADC;
int O2ADC; int O2ADC;
int dwell;
byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125) byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125)
byte advance; byte advance;
byte corrections; byte corrections;

View File

@ -394,8 +394,13 @@ void loop()
//*********************************************************************************************** //***********************************************************************************************
//| BEGIN IGNITION CALCULATIONS //| BEGIN IGNITION CALCULATIONS
if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim * 100)) ) { currentStatus.advance -= configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees) if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim * 100)) ) { currentStatus.advance -= configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
int dwell = (configPage2.dwellRun * 100); //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
int dwellAngle = (div(dwell, timePerDegree).quot ); //Set dwell
//Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { currentStatus.dwell = (configPage2.dwellCrank * 100); }
else { currentStatus.dwell = (configPage2.dwellRun * 100); }
int dwellAngle = (div(currentStatus.dwell, timePerDegree).quot );
//Calculate start angle for each channel //Calculate start angle for each channel
//1 //1
ignition1StartAngle = 360 - currentStatus.advance - dwellAngle; // 360 - desired advance angle - number of degrees the dwell will take ignition1StartAngle = 360 - currentStatus.advance - dwellAngle; // 360 - desired advance angle - number of degrees the dwell will take
@ -472,7 +477,7 @@ void loop()
{ {
setIgnitionSchedule1(beginCoil1Charge, setIgnitionSchedule1(beginCoil1Charge,
((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree), ((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree),
dwell, currentStatus.dwell,
endCoil1Charge endCoil1Charge
); );
} }
@ -485,7 +490,7 @@ void loop()
{ {
setIgnitionSchedule2(beginCoil2Charge, setIgnitionSchedule2(beginCoil2Charge,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree), ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
dwell, currentStatus.dwell,
endCoil2Charge endCoil2Charge
); );
} }
@ -498,7 +503,7 @@ void loop()
{ {
setIgnitionSchedule3(beginCoil3Charge, setIgnitionSchedule3(beginCoil3Charge,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree), ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
dwell, currentStatus.dwell,
endCoil3Charge endCoil3Charge
); );
} }