IncludeAFR option added
This commit is contained in:
parent
a59135a0e6
commit
1fefada496
|
@ -627,6 +627,7 @@ page = 8
|
||||||
ignCranklock = "On certain low resolution ignition patterns, the cranking timing can be locked to occur when a pulse is recieved."
|
ignCranklock = "On certain low resolution ignition patterns, the cranking timing can be locked to occur when a pulse is recieved."
|
||||||
|
|
||||||
multiplyMAP = "If enabled, the MAP reading is included directly into the pulsewidth calculation. This results in a flatter VE table that can be easier to tune in some instances"
|
multiplyMAP = "If enabled, the MAP reading is included directly into the pulsewidth calculation. This results in a flatter VE table that can be easier to tune in some instances"
|
||||||
|
includeAFR = "When enabled, the current AFR reading is included directly in the pulsewidth calculation as a percentage of the stoichiometric ration."
|
||||||
|
|
||||||
|
|
||||||
[UserDefinedTS]
|
[UserDefinedTS]
|
||||||
|
@ -688,7 +689,7 @@ page = 8
|
||||||
|
|
||||||
dialog = veTableDialog_south, ""
|
dialog = veTableDialog_south, ""
|
||||||
field = "Multiply VE value by MAP", multiplyMAP
|
field = "Multiply VE value by MAP", multiplyMAP
|
||||||
field = "Include AFR directly", includeAFR, { 1 == 0 }
|
field = "Include AFR directly", includeAFR, { egoType == 2 }
|
||||||
|
|
||||||
dialog = veTableDialog, "VE Table"
|
dialog = veTableDialog, "VE Table"
|
||||||
panel = veTableDialog_north, North
|
panel = veTableDialog_north, North
|
||||||
|
|
|
@ -327,17 +327,19 @@ unsigned int PW(int REQ_FUEL, byte VE, byte MAP, int corrections, int injOpen, b
|
||||||
//Standard float version of the calculation
|
//Standard float version of the calculation
|
||||||
//return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen);
|
//return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen);
|
||||||
//Note: The MAP and TPS portions are currently disabled, we use VE and corrections only
|
//Note: The MAP and TPS portions are currently disabled, we use VE and corrections only
|
||||||
int iVE, iMAP, iCorrections, iTPS;
|
int iVE, iMAP, iAFR, iCorrections, iTPS;
|
||||||
|
|
||||||
//100% float free version, does sacrifice a little bit of accuracy, but not much.
|
//100% float free version, does sacrifice a little bit of accuracy, but not much.
|
||||||
iVE = ((int)VE << 7) / 100;
|
iVE = ((int)VE << 7) / 100;
|
||||||
if( configPage1.multiplyMAP ) { iMAP = ((int)MAP << 7) / currentStatus.baro; }
|
if( configPage1.multiplyMAP ) { iMAP = ((int)MAP << 7) / currentStatus.baro; } //Include multiply MAP (vs baro) if enabled
|
||||||
|
if( configPage1.includeAFR ) { iAFR = ((int)currentStatus.O2 << 7) / configPage1.stoich; } //Include AFR (vs stoich) if enabled
|
||||||
iCorrections = (corrections << 7) / 100;
|
iCorrections = (corrections << 7) / 100;
|
||||||
//int iTPS = ((int)TPS << 7) / 100;
|
//int iTPS = ((int)TPS << 7) / 100;
|
||||||
|
|
||||||
|
|
||||||
unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long
|
unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long
|
||||||
if( configPage1.multiplyMAP ) { intermediate = (intermediate * iMAP) >> 7; }
|
if( configPage1.multiplyMAP ) { intermediate = (intermediate * iMAP) >> 7; }
|
||||||
|
if( configPage1.includeAFR ) { intermediate = (intermediate * iAFR) >> 7; }
|
||||||
intermediate = (intermediate * iCorrections) >> 7;
|
intermediate = (intermediate * iCorrections) >> 7;
|
||||||
//intermediate = (intermediate * iTPS) >> 7;
|
//intermediate = (intermediate * iTPS) >> 7;
|
||||||
if(intermediate == 0) { return 0; } //If the pulsewidth is 0, we return here before the opening time gets added
|
if(intermediate == 0) { return 0; } //If the pulsewidth is 0, we return here before the opening time gets added
|
||||||
|
|
Loading…
Reference in New Issue