Add ignition advance gauge and comms
This commit is contained in:
parent
f085bbefc4
commit
c51e09dedb
|
@ -79,7 +79,7 @@ This function returns the current values of a fixed group of variables
|
|||
*/
|
||||
void sendValues(int length)
|
||||
{
|
||||
byte response[22];
|
||||
byte response[23];
|
||||
|
||||
response[0] = (uint8_t)1; //rtc.sec;
|
||||
response[1] = currentStatus.squirt;
|
||||
|
@ -101,8 +101,9 @@ void sendValues(int length)
|
|||
response[17] = 0x00; //Total GammaE (%)
|
||||
response[18] = currentStatus.VE; //Current VE 1 (%)
|
||||
response[19] = 0x00; //Pulsewidth 2 divided by 10 (in ms)
|
||||
response[20] = 0x00; //mCurrent VE 2 (%)
|
||||
response[20] = 0x00; //Current VE 2 (%)
|
||||
response[21] = 0x00; //Idle
|
||||
response[22] = currentStatus.advance;
|
||||
|
||||
Serial.write(response, (size_t)22);
|
||||
Serial.flush();
|
||||
|
|
|
@ -17,6 +17,7 @@ struct statuses {
|
|||
byte TPS;
|
||||
byte VE;
|
||||
byte O2;
|
||||
byte advance;
|
||||
volatile byte squirt;
|
||||
byte engine;
|
||||
unsigned long PW; //In uS
|
||||
|
|
|
@ -196,8 +196,8 @@ void loop()
|
|||
//Calculate an injector pulsewidth form the VE
|
||||
currentStatus.PW = PW(req_fuel_uS, currentStatus.VE, currentStatus.MAP, 100, engineInjectorDeadTime); //The 100 here is just a placeholder for any enrichment factors (Cold start, acceleration etc). To add 10% extra fuel, this would be 110
|
||||
//Perform a lookup to get the desired ignition advance
|
||||
byte ignitionAdvance = getTableValue(ignitionTable, currentStatus.MAP, currentStatus.RPM);
|
||||
ignitionAdvance = 10;
|
||||
currentStatus.advance = getTableValue(ignitionTable, currentStatus.MAP, currentStatus.RPM);
|
||||
currentStatus.advance = 10;
|
||||
|
||||
//Determine the current crank angle
|
||||
//This is the current angle ATDC the engine is at
|
||||
|
@ -214,7 +214,7 @@ void loop()
|
|||
//int injectorStartAngle = 355 - (currentStatus.PW / timePerDegree); //This is a bit rough, but is based on the idea that all fuel needs to be delivered before the inlet valve opens. I am using 355 as the point at which the injector MUST be closed by. See http://www.extraefi.co.uk/sequential_fuel.html for more detail
|
||||
//int ignitionStartAngle = 360 - ignitionAdvance - (configPage2.dwellRun / timePerDegree); // 360 - desired advance angle - number of degrees the dwell will take
|
||||
int injectorStartAngle = 355 - ( fastDivide32(currentStatus.PW, timePerDegree) ); //As above, but using fastDivide function
|
||||
int ignitionStartAngle = 360 - ignitionAdvance - (fastDivide32(configPage2.dwellRun, timePerDegree) ); //As above, but using fastDivide function
|
||||
int ignitionStartAngle = 360 - currentStatus.advance - (fastDivide32(configPage2.dwellRun, timePerDegree) ); //As above, but using fastDivide function
|
||||
ignitionStartAngle = 340;
|
||||
|
||||
//Finally calculate the time (uS) until we reach the firing angles and set the schedules
|
||||
|
@ -233,7 +233,7 @@ void loop()
|
|||
{
|
||||
setIgnitionSchedule1(beginCoil1Charge,
|
||||
(ignitionStartAngle - crankAngle) * timePerDegree,
|
||||
(configPage2.dwellRun * 1000),
|
||||
(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
|
||||
endCoil1Charge
|
||||
);
|
||||
}
|
||||
|
|
|
@ -543,6 +543,7 @@ help = helpEnrichments, "Enrichments Help"
|
|||
cltGauge = coolant, "Coolant Temp", "%TEMP", -40, 250, 0, 30, 200, 220, 0, 0
|
||||
matGauge = mat, "Manifold Air Temp", "%TEMP", -40, 215, 0, 30, 200, 210, 0, 0
|
||||
#endif
|
||||
advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0,
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -675,7 +676,7 @@ help = helpEnrichments, "Enrichments Help"
|
|||
|
||||
ochGetCommand = "A"
|
||||
|
||||
ochBlockSize = 22
|
||||
ochBlockSize = 23
|
||||
|
||||
secl = scalar, U08, 0, "sec", 1.000, 0.000
|
||||
squirt = scalar, U08, 1, "bits", 1.000, 0.000
|
||||
|
@ -707,6 +708,7 @@ help = helpEnrichments, "Enrichments Help"
|
|||
blank1 = scalar, U08, 19 ; Raw inputs, as they come from MS.
|
||||
blank2 = scalar, U08, 20
|
||||
blank3 = scalar, U08, 21
|
||||
advance = scalar, U08, 22, "deg", 1.000, 0.000
|
||||
|
||||
; Computed output channels. See "megatuneExamples.ini" for all the
|
||||
; pre-defined variables, search for "???" and you'll see them.
|
||||
|
|
Loading…
Reference in New Issue