Merge pull request #4 from noisymime/master

update with latest 06 nov 15
This commit is contained in:
Autohome2 2015-11-06 21:49:12 +00:00
commit a978a19b8d
5 changed files with 252 additions and 199 deletions

View File

@ -201,7 +201,7 @@ void sendValues(int length)
response[1] = currentStatus.squirt; //Squirt Bitfield
response[2] = currentStatus.engine; //Engine Status Bitfield
response[3] = (byte)(divu100(currentStatus.dwell)); //Dwell in ms * 10
response[4] = currentStatus.MAP; //map
response[4] = (byte)(currentStatus.MAP >> 1); //map value is divided by 2
response[5] = (byte)(currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET); //mat
response[6] = (byte)(currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET); //Coolant ADC
response[7] = currentStatus.tpsADC; //TPS (Raw 0-255)

View File

@ -13,6 +13,7 @@ volatile unsigned long toothOneTime = 0; //The time (micros()) that tooth 1 last
volatile unsigned long toothOneMinusOneTime = 0; //The 2nd to last time (micros()) that tooth 1 last triggered
volatile unsigned int toothHistory[TOOTH_LOG_BUFFER];
volatile unsigned int toothHistoryIndex = 0;
volatile long toothDeltaV; //Represents the change in time taken between the last 2 teeth compared to the previous 2. Positive value represents accleration, negative = deccleration
volatile byte secondaryToothCount; //Used for identifying the current secondary (Usually cam) tooth for patterns with multiple secondary teeth
volatile unsigned long secondaryLastToothTime = 0; //The time (micros()) that the last tooth was registered (Cam input)
@ -20,10 +21,10 @@ volatile unsigned long secondaryLastToothTime = 0; //The time (micros()) that th
volatile int triggerActualTeeth;
volatile unsigned long triggerFilterTime; // The shortest time (in uS) that pulses will be accepted (Used for debounce filtering)
unsigned int triggerSecFilterTime; // The shortest time (in uS) that pulses will be accepted (Used for debounce filtering) for the secondary input
unsigned int triggerToothAngle; //The number of crank degrees that elapse per tooth
int triggerToothAngle; //The number of crank degrees that elapse per tooth
unsigned long revolutionTime; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
unsigned int toothAngles[24]; //An array for storing fixed tooth angles. Currently sized at 24 for the GM 24X decoder, but may grow later if there are other decoders that use this style
int toothAngles[24]; //An array for storing fixed tooth angles. Currently sized at 24 for the GM 24X decoder, but may grow later if there are other decoders that use this style
//Used for identifying long and short pulses on the 4G63 (And possibly other) trigger patterns
#define LONG 0;

View File

@ -43,6 +43,20 @@ inline int stdGetRPM()
return (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
}
/*
This is a special case of RPM measure that is based on the time between the last 2 teeth rather than the time of the last full revolution
This gives much more volatile reading, but is quite useful during cranking, particularly on low resolution patterns.
It can only be used on patterns where the teeth are evently spaced
It takes an argument of the full (COMPLETE) number of teeth per revolution. For a missing tooth wheel, this is the number if the tooth had NOT been missing (Eg 36-1 = 36)
*/
inline int crankingGetRPM(byte totalTeeth)
{
noInterrupts();
revolutionTime = (toothLastToothTime - toothLastMinusOneToothTime) * totalTeeth;
interrupts();
return (US_IN_MINUTE / revolutionTime);
}
/*
Name: Missing tooth wheel
Desc: A multi-tooth wheel with one of more 'missing' teeth. The first tooth after the missing one is considered number 1 and isthe basis for the trigger angle
@ -82,6 +96,7 @@ void triggerPri_missingTooth()
startRevolutions++; //Counter
}
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime - toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
@ -139,11 +154,13 @@ void triggerPri_DualWheel()
toothOneMinusOneTime = toothOneTime;
toothOneTime = curTime;
startRevolutions++; //Counter
if ((startRevolutions & 63) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam
currentStatus.hasSync = true;
//if ((startRevolutions & 63) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam
}
addToothLogEntry(curGap);
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime - toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
@ -183,8 +200,10 @@ int getCrankAngle_DualWheel(int timePerDegree)
int crankAngle = (tempToothCurrentCount - 1) * triggerToothAngle + configPage2.triggerAngle; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
crankAngle += ( (micros() - tempToothLastToothTime) / timePerDegree); //Estimate the number of degrees travelled since the last tooth
if (crankAngle >= 720) { crankAngle -= 720; }
if (crankAngle > 360) { crankAngle -= 360; }
if (crankAngle < 0) { crankAngle += 360; }
return crankAngle;
}
@ -219,14 +238,16 @@ void triggerPri_BasicDistributor()
else { toothCurrentCount++; } //Increment the tooth counter
addToothLogEntry(curGap);
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime -toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
void triggerSec_BasicDistributor() { return; } //Not required
int getRPM_BasicDistributor()
{
return stdGetRPM();
if(currentStatus.RPM < configPage2.crankRPM) { crankingGetRPM((configPage1.nCylinders >> 1)); }
else { return stdGetRPM(); }
}
int getCrankAngle_BasicDistributor(int timePerDegree)
{
@ -241,7 +262,9 @@ int getCrankAngle_BasicDistributor(int timePerDegree)
int crankAngle = (tempToothCurrentCount - 1) * triggerToothAngle + configPage2.triggerAngle; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
if (crankAngle >= 720) { crankAngle -= 720; }
if (crankAngle > 360) { crankAngle -= 360; }
if (crankAngle < 0) { crankAngle += 360; }
return crankAngle;
}
@ -280,9 +303,11 @@ void triggerPri_GM7X()
toothCurrentCount = 3;
currentStatus.hasSync = true;
startRevolutions++; //Counter
return; //We return here so that the tooth times below don't get set (The magical 3rd tooth should not be considered for any calculations that use those times)
}
}
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime - toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
@ -306,7 +331,7 @@ int getCrankAngle_GM7X(int timePerDegree)
int crankAngle;
if( tempToothCurrentCount < 3 )
{
crankAngle = (tempToothCurrentCount - 1) * 60 + 42; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
crankAngle = (tempToothCurrentCount - 1) * triggerToothAngle + 42; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
}
else if( tempToothCurrentCount == 3 )
{
@ -314,7 +339,7 @@ int getCrankAngle_GM7X(int timePerDegree)
}
else
{
crankAngle = (tempToothCurrentCount - 2) * 60 + 42; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
crankAngle = (tempToothCurrentCount - 2) * triggerToothAngle + 42; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
}
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
@ -374,6 +399,7 @@ void triggerPri_4G63()
addToothLogEntry(curGap);
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime - toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
@ -401,14 +427,12 @@ void triggerSec_4G63()
int getRPM_4G63()
{
noInterrupts();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
//triggerFilterTime = revolutionTime >> 5; PROBLEMATIC!!!
return ldiv(US_IN_MINUTE, revolutionTime).quot; //Calc RPM based on last full revolution time (uses ldiv rather than div as US_IN_MINUTE is a long)
if(currentStatus.RPM < configPage2.crankRPM) { crankingGetRPM(2); }
else { return stdGetRPM(); }
}
int getCrankAngle_4G63(int timePerDegree)
int getCrankAngle_4G63(int timePerDegree)
{
if(!currentStatus.hasSync) { return 0;}
//This is the current angle ATDC the engine is at. This is the last known position based on what tooth was last 'seen'. It is only accurate to the resolution of the trigger wheel (Eg 36-1 is 10 degrees)
unsigned long tempToothLastToothTime;
int tempToothCurrentCount;
@ -420,6 +444,7 @@ int getCrankAngle_4G63(int timePerDegree)
int crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage2.triggerAngle; //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was.
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
if (crankAngle >= 720) { crankAngle -= 720; }
if (crankAngle > 360) { crankAngle -= 360; }
if (crankAngle < 0) { crankAngle += 360; }
@ -435,7 +460,7 @@ Provided that the cam signal is used, this decoder simply counts the teeth and t
*/
void triggerSetup_24X()
{
triggerToothAngle = 180; //The number of degrees that passes from tooth to tooth (primary)
triggerToothAngle = 15; //The number of degrees that passes from tooth to tooth (primary)
toothAngles[0] = 12;
toothAngles[1] = 18;
toothAngles[2] = 33;
@ -526,7 +551,7 @@ http://speeduino.com/forum/download/file.php?id=205
*/
void triggerSetup_Jeep2000()
{
triggerToothAngle = 180; //The number of degrees that passes from tooth to tooth (primary)
triggerToothAngle = 0; //The number of degrees that passes from tooth to tooth (primary)
toothAngles[0] = 174;
toothAngles[1] = 194;
toothAngles[2] = 214;
@ -562,9 +587,11 @@ void triggerPri_Jeep2000()
toothCurrentCount++; //Increment the tooth counter
}
addToothLogEntry(curGap);
addToothLogEntry(curGap);
toothLastToothTime = curTime;
toothDeltaV = (toothLastToothTime - toothLastMinusOneToothTime) - (curTime - toothLastToothTime); //Positive value = accleration, Negative = decceleration
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
}
void triggerSec_Jeep2000()
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<msq xmlns="http://www.msefi.com/:msq">
<bibliography author="TunerStudio MS 2.6.14 - EFI Analytics, Inc." tuneComment="" writeDate="Wed Sep 30 14:46:41 EST 2015"/>
<versionInfo fileFormat="4.0" firmwareInfo="" nPages="8" signature="20"/>
<bibliography author="TunerStudio MS 2.6.14 - EFI Analytics, Inc." tuneComment="" writeDate="Sun Nov 01 07:37:21 EST 2015"/>
<versionInfo fileFormat="4.0" firmwareInfo="Bowling &amp; Grippo MS1 Base Code 20" nPages="8" signature="20"/>
<page>
<pcVariable name="tsCanId">"0"</pcVariable>
<pcVariable cols="1" digits="1" name="wueAfrTargetOffset" rows="10" units=":1">
@ -17,14 +17,14 @@
0.0
</pcVariable>
<pcVariable cols="1" digits="0" name="wueAnalRecommend" rows="10" units="%">
212.0
199.0
173.0
156.0
100.0
100.0
100.0
100.0
148.0
145.0
140.0
133.0
126.0
112.0
100.0
</pcVariable>
@ -43,40 +43,40 @@
</page>
<page number="0" size="288">
<constant cols="16" digits="0" name="veTable" rows="16" units="%">
39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0
39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0
39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0
39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0 39.0
39.0 39.0 39.0 39.0 39.0 42.0 44.0 45.0 46.0 47.0 46.0 45.0 44.0 43.0 42.0 41.0
39.0 39.0 40.0 46.0 50.0 53.0 54.0 55.0 55.0 56.0 55.0 54.0 52.0 51.0 50.0 48.0
39.0 44.0 52.0 57.0 60.0 62.0 64.0 64.0 65.0 65.0 64.0 62.0 61.0 59.0 58.0 56.0
40.0 56.0 64.0 68.0 70.0 72.0 73.0 74.0 74.0 74.0 72.0 71.0 69.0 67.0 66.0 64.0
53.0 68.0 75.0 78.0 80.0 81.0 82.0 83.0 83.0 83.0 81.0 79.0 77.0 75.0 73.0 72.0
66.0 79.0 85.0 88.0 89.0 91.0 91.0 92.0 92.0 92.0 90.0 88.0 86.0 83.0 81.0 79.0
79.0 90.0 95.0 97.0 98.0 100.0 100.0 101.0 101.0 100.0 99.0 96.0 94.0 92.0 89.0 87.0
91.0 101.0 104.0 106.0 108.0 109.0 109.0 110.0 110.0 109.0 107.0 105.0 102.0 100.0 97.0 95.0
113.0 120.0 123.0 125.0 126.0 127.0 127.0 128.0 128.0 127.0 125.0 122.0 119.0 116.0 113.0 110.0
123.0 130.0 132.0 134.0 135.0 136.0 136.0 137.0 137.0 136.0 134.0 130.0 127.0 124.0 121.0 118.0
134.0 139.0 141.0 143.0 143.0 144.0 145.0 146.0 146.0 145.0 142.0 139.0 135.0 132.0 129.0 126.0
143.0 148.0 150.0 151.0 152.0 153.0 154.0 154.0 155.0 154.0 151.0 147.0 144.0 140.0 137.0 133.0
23.0 23.0 23.0 24.0 22.0 21.0 19.0 18.0 17.0 15.0 15.0 15.0 15.0 15.0 15.0 15.0
24.0 24.0 24.0 25.0 23.0 22.0 20.0 19.0 18.0 16.0 15.0 15.0 15.0 15.0 15.0 15.0
24.0 25.0 26.0 27.0 26.0 24.0 23.0 21.0 20.0 18.0 17.0 16.0 15.0 15.0 15.0 15.0
26.0 28.0 29.0 30.0 29.0 27.0 26.0 24.0 23.0 21.0 20.0 18.0 17.0 16.0 16.0 16.0
27.0 32.0 34.0 36.0 32.0 30.0 29.0 27.0 26.0 24.0 23.0 21.0 20.0 19.0 19.0 19.0
31.0 37.0 39.0 39.0 36.0 34.0 32.0 30.0 29.0 27.0 26.0 24.0 23.0 21.0 21.0 22.0
35.0 37.0 39.0 39.0 40.0 38.0 36.0 34.0 32.0 31.0 29.0 28.0 26.0 24.0 24.0 24.0
41.0 42.0 43.0 42.0 43.0 41.0 40.0 38.0 36.0 34.0 32.0 31.0 29.0 27.0 26.0 27.0
45.0 46.0 46.0 46.0 45.0 43.0 41.0 40.0 38.0 36.0 34.0 32.0 31.0 29.0 29.0 29.0
45.0 46.0 46.0 46.0 46.0 44.0 42.0 40.0 38.0 36.0 34.0 33.0 31.0 31.0 32.0 32.0
45.0 46.0 46.0 46.0 48.0 45.0 43.0 41.0 40.0 38.0 36.0 34.0 33.0 34.0 34.0 34.0
45.0 46.0 46.0 46.0 48.0 45.0 43.0 41.0 40.0 38.0 36.0 36.0 36.0 37.0 37.0 37.0
50.0 46.0 46.0 46.0 48.0 48.0 45.0 43.0 41.0 40.0 40.0 41.0 41.0 42.0 42.0 42.0
50.0 45.0 45.0 46.0 48.0 48.0 47.0 45.0 43.0 43.0 43.0 43.0 44.0 44.0 44.0 44.0
50.0 45.0 45.0 46.0 48.0 48.0 48.0 46.0 45.0 45.0 45.0 46.0 46.0 47.0 47.0 47.0
60.0 45.0 45.0 46.0 48.0 48.0 48.0 48.0 47.0 48.0 48.0 48.0 48.0 48.0 48.0 48.0
</constant>
<constant cols="1" digits="0" name="rpmBins" rows="16" units="RPM">
500.0
700.0
900.0
1100.0
1300.0
1600.0
1900.0
2200.0
2500.0
3300.0
4100.0
4900.0
1500.0
2100.0
2900.0
3800.0
4700.0
5500.0
5700.0
5900.0
6100.0
6300.0
6500.0
6800.0
7000.0
6600.0
6600.0
</constant>
<constant cols="1" digits="0" name="mapBins" rows="16" units="kPa">
15.0
@ -100,21 +100,21 @@
<page number="1" size="64">
<constant digits="1" name="crankCold" units="ms">5.0</constant>
<constant digits="1" name="crankHot" units="ms">2.0</constant>
<constant digits="0" name="asePct" units="%">4.0</constant>
<constant digits="0" name="asePct" units="%">2.0</constant>
<constant digits="0" name="aseCount" units="s">50.0</constant>
<constant cols="1" digits="0" name="wueBins" rows="10" units="%">
212.0
199.0
173.0
156.0
148.0
145.0
140.0
133.0
112.0
100.0
100.0
100.0
100.0
148.0
135.0
128.0
126.0
112.0
104.0
</constant>
<constant digits="0" name="crankingPct" units="%">20.0</constant>
<constant digits="0" name="crankingPct" units="%">5.0</constant>
<constant name="pinLayout">"Speeduino v0.4"</constant>
<constant digits="1" name="unused16" units="ms">0.0</constant>
<constant digits="1" name="tdePct" units="ms">3.2</constant>
@ -129,15 +129,15 @@
<constant name="display5">"RPM"</constant>
<constant name="displayB1">"RPM"</constant>
<constant name="displayB2">"RPM"</constant>
<constant digits="1" name="reqFuel" units="ms">4.3</constant>
<constant digits="1" name="reqFuel" units="ms">13.2</constant>
<constant digits="0" name="divider">2.0</constant>
<constant name="alternate">"Simultaneous"</constant>
<constant name="alternate">"Alternating"</constant>
<constant digits="1" name="injOpen" units="ms">1.0</constant>
<constant digits="0" name="inj1Ang" units="deg">355.0</constant>
<constant digits="0" name="inj2Ang" units="deg">355.0</constant>
<constant digits="0" name="inj3Ang" units="deg">355.0</constant>
<constant digits="0" name="inj4Ang" units="deg">355.0</constant>
<constant name="mapType">"250 kPa"</constant>
<constant name="mapSample">"Cycle Average"</constant>
<constant name="twoStroke">"Four-stroke"</constant>
<constant name="injType">"Port"</constant>
<constant name="nCylinders">"4"</constant>
@ -149,34 +149,34 @@
<constant name="algorithm">"Speed Density"</constant>
<constant name="baroCorr">"Off"</constant>
<constant name="injTiming">"Bank"</constant>
<constant digits="1" name="primePulse" units="ms">4.0</constant>
<constant digits="1" name="primePulse" units="ms">5.0</constant>
<constant digits="0" name="dutyLim" units="%">85.0</constant>
<constant digits="0" name="unused41" units="RPM">4200.0</constant>
<constant digits="3" name="egoSwitch" units="v">0.0</constant>
<constant digits="0" name="taeColdM" units="%">0.0</constant>
<constant digits="0" name="tpsMin" units="ADC">36.0</constant>
<constant digits="0" name="tpsMax" units="ADC">215.0</constant>
<constant digits="0" name="tpsMin" units="ADC">43.0</constant>
<constant digits="0" name="tpsMax" units="ADC">227.0</constant>
<constant digits="0" name="mapMin" units="kpa">10.0</constant>
<constant digits="0" name="mapMax" units="kpa">260.0</constant>
</page>
<page number="2" size="288">
<constant cols="16" digits="0" name="advTable1" rows="16" units="deg">
21.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
21.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
21.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
21.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 34.0 36.0 37.0 37.0 37.0 38.0 39.0
20.0 23.0 23.0 23.0 24.0 28.0 31.0 32.0 34.0 34.0 36.0 37.0 37.0 37.0 38.0 39.0
20.0 23.0 23.0 23.0 24.0 28.0 31.0 32.0 33.0 34.0 35.0 36.0 36.0 36.0 37.0 38.0
19.0 20.0 22.0 23.0 24.0 27.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 36.0 37.0 38.0
19.0 20.0 21.0 23.0 24.0 26.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 35.0 36.0 37.0
19.0 20.0 21.0 23.0 24.0 25.0 28.0 30.0 31.0 32.0 33.0 34.0 34.0 34.0 35.0 35.0
19.0 20.0 21.0 23.0 24.0 25.0 28.0 29.0 30.0 31.0 32.0 33.0 33.0 33.0 34.0 34.0
19.0 20.0 21.0 23.0 24.0 25.0 28.0 29.0 30.0 31.0 31.0 32.0 32.0 32.0 33.0 33.0
19.0 20.0 22.0 23.0 24.0 25.0 28.0 29.0 30.0 30.0 31.0 31.0 31.0 31.0 32.0 32.0
19.0 20.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 30.0 30.0 30.0 30.0 31.0 31.0
20.0 21.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 30.0 30.0
21.0 22.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0
22.0 22.0 22.0 23.0 24.0 25.0 27.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0
17.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
17.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
17.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 35.0 36.0 37.0 38.0 38.0 39.0 40.0
17.0 22.0 23.0 24.0 25.0 28.0 31.0 33.0 34.0 34.0 36.0 37.0 37.0 37.0 38.0 39.0
16.0 15.0 15.0 23.0 24.0 28.0 31.0 32.0 34.0 34.0 36.0 37.0 37.0 37.0 38.0 39.0
16.0 15.0 15.0 23.0 24.0 28.0 31.0 32.0 33.0 34.0 35.0 36.0 36.0 36.0 37.0 38.0
15.0 20.0 22.0 23.0 24.0 27.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 36.0 37.0 38.0
15.0 20.0 21.0 23.0 24.0 26.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 35.0 36.0 37.0
15.0 20.0 21.0 23.0 24.0 25.0 28.0 30.0 31.0 32.0 33.0 34.0 34.0 34.0 35.0 35.0
15.0 20.0 21.0 23.0 24.0 25.0 28.0 29.0 30.0 31.0 32.0 33.0 33.0 33.0 34.0 34.0
15.0 20.0 21.0 23.0 24.0 25.0 28.0 29.0 30.0 31.0 31.0 32.0 32.0 32.0 33.0 33.0
15.0 20.0 22.0 23.0 24.0 25.0 28.0 29.0 30.0 30.0 31.0 31.0 31.0 31.0 32.0 32.0
15.0 20.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 30.0 30.0 30.0 30.0 31.0 31.0
16.0 21.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 30.0 30.0
17.0 22.0 22.0 23.0 24.0 25.0 28.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0 29.0
18.0 22.0 22.0 23.0 24.0 25.0 27.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0
</constant>
<constant cols="1" digits="0" name="rpmBins2" rows="16" units="RPM">
500.0
@ -216,7 +216,10 @@
</constant>
</page>
<page number="3" size="64">
<constant digits="0" name="TrigAng" units="Deg">250.0</constant>
<constant digits="0" name="unused49" units="RPM">25500.0</constant>
<constant digits="0" name="unused50" units="RPM">25500.0</constant>
<constant digits="0" name="unused51" units="RPM">25500.0</constant>
<constant digits="0" name="TrigAng" units="Deg">0.0</constant>
<constant digits="0" name="FixAng" units="Deg">0.0</constant>
<constant digits="0" name="CrankAng" units="Deg">5.0</constant>
<constant digits="0" name="IgHold">10.0</constant>
@ -230,14 +233,15 @@
<constant digits="0" name="IdleAdvRPM" units="RPM">3200.0</constant>
<constant digits="1" name="IdleAdvCLT" units="C">-20.535</constant>
<constant digits="0" name="IdleDelayTime" units="sec">38.0</constant>
<constant digits="0" name="StgCycles" units="cycles">3.0</constant>
<constant digits="0" name="StgCycles" units="cycles">1.0</constant>
<constant name="dwellcont">"Dwell control"</constant>
<constant name="useDwellLim">"On"</constant>
<constant name="sparkMode">"Wasted Spark"</constant>
<constant digits="1" name="dwellcrank" units="ms">6.0</constant>
<constant digits="1" name="dwellrun" units="ms">3.0</constant>
<constant digits="0" name="numteeth" units="teeth">24.0</constant>
<constant digits="0" name="onetwo" units="teeth">1.0</constant>
<constant digits="0" name="crankRPM" units="rpm">600.0</constant>
<constant digits="0" name="crankRPM" units="rpm">300.0</constant>
<constant digits="0" name="tpsflood" units="%">90.0</constant>
<constant digits="0" name="SoftRevLim" units="rpm">7500.0</constant>
<constant digits="0" name="SoftLimRetard" units="deg">20.0</constant>
@ -269,13 +273,14 @@
</constant>
<constant digits="0" name="dwellLim" units="ms">10.0</constant>
<constant cols="1" digits="0" name="dwellRates" rows="6" units="%">
106.0
105.0
142.0
124.0
111.0
100.0
100.0
91.0
93.0
85.0
</constant>
<constant digits="0" name="unused48" units="RPM">25500.0</constant>
</page>
<page number="4" size="288">
<constant cols="16" digits="1" name="afrTable" rows="16" units="AFR">
@ -334,23 +339,14 @@
</constant>
</page>
<page number="5" size="64">
<constant digits="0" name="unused49" units="RPM">0.0</constant>
<constant digits="0" name="unused50" units="RPM">0.0</constant>
<constant digits="0" name="unused51" units="RPM">4000.0</constant>
<constant digits="0" name="unused53" units="RPM">800.0</constant>
<constant digits="0" name="unused54" units="RPM">2300.0</constant>
<constant digits="0" name="unused55" units="RPM">6500.0</constant>
<constant digits="0" name="unused56" units="RPM">3200.0</constant>
<constant digits="0" name="unused57" units="RPM">3500.0</constant>
<constant digits="0" name="unused58" units="RPM">3800.0</constant>
<constant digits="0" name="unused59" units="RPM">100.0</constant>
<constant digits="0" name="unused60" units="RPM">24300.0</constant>
<constant digits="0" name="unused61" units="RPM">4500.0</constant>
<constant digits="0" name="unused62" units="RPM">3000.0</constant>
<constant digits="0" name="unused63" units="RPM">6000.0</constant>
<constant digits="0" name="unused48" units="RPM">100.0</constant>
<constant name="egoAlgorithm">"PID"</constant>
<constant name="egoType">"Disabled"</constant>
<constant name="egoAlgorithm">"No correction"</constant>
<constant name="egoType">"Narrow Band"</constant>
<constant name="boostEnabled">"Off"</constant>
<constant name="vvtEnabled">"Off"</constant>
<constant digits="0" name="egoKP" units="%">100.0</constant>
@ -369,19 +365,19 @@
<constant digits="0" name="egoLoadMin" units="%">20.0</constant>
<constant cols="1" digits="1" name="brvBins" rows="6" units="V">
6.9
9.4
12.1
9.3
11.9
13.9
16.9
16.8
20.3
</constant>
<constant cols="1" digits="0" name="injBatRates" rows="6" units="%">
110.0
106.0
100.0
99.0
142.0
119.0
100.0
100.0
98.0
90.0
</constant>
<constant cols="1" digits="0" name="airDenBins" rows="9" units="C">
-40.0
@ -407,10 +403,22 @@
</constant>
<constant digits="0" name="boostFreq" units="Hz">30.0</constant>
<constant digits="0" name="vvtFreq" units="Hz">300.0</constant>
<constant digits="0" name="idleFreq" units="Hz">120.0</constant>
<constant digits="0" name="idleFreq" units="Hz">486.0</constant>
<constant name="launchPin">"1"</constant>
<constant name="launchEnable">"No"</constant>
<constant name="unused48h">"No"</constant>
<constant digits="0" name="lnchSoftLim" units="rpm">0.0</constant>
<constant digits="0" name="lnchRetard" units="deg">0.0</constant>
<constant digits="0" name="lnchHardLim" units="rpm">4000.0</constant>
<constant digits="0" name="lnchFuelAdd" units="%">255.0</constant>
</page>
<page number="6" size="64">
<constant name="unused52">"One"</constant>
<constant digits="0" name="unused59" units="RPM">19900.0</constant>
<constant digits="0" name="unused60" units="RPM">10000.0</constant>
<constant digits="0" name="unused61" units="RPM">2000.0</constant>
<constant digits="0" name="unused62" units="RPM">0.0</constant>
<constant digits="0" name="unused63" units="RPM">19800.0</constant>
<constant cols="1" digits="0" name="iacCLValues" rows="10" units="RPM">
0.0
0.0
@ -424,64 +432,64 @@
0.0
</constant>
<constant cols="1" digits="0" name="iacOLStepVal" rows="10" units="Steps">
369.0
327.0
291.0
246.0
213.0
168.0
123.0
87.0
45.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
</constant>
<constant cols="1" digits="0" name="iacOLPWMVal" rows="10" units="Duty %">
0.0
7.0
11.0
16.0
19.0
24.0
29.0
34.0
38.0
43.0
39.0
33.0
31.0
27.0
20.0
9.0
0.0
0.0
0.0
</constant>
<constant cols="1" digits="0" name="iacBins" rows="10" units="C">
-38.0
-19.0
108.0
81.0
52.0
28.0
14.0
1.0
16.0
32.0
55.0
56.0
64.0
71.0
77.0
-12.0
-21.0
-31.0
-37.0
</constant>
<constant cols="1" digits="0" name="iacCrankSteps" rows="4" units="Steps">
123.0
579.0
390.0
300.0
0.0
0.0
0.0
0.0
</constant>
<constant cols="1" digits="0" name="iacCrankDuty" rows="4" units="Duty %">
27.0
31.0
44.0
42.0
59.0
</constant>
<constant cols="1" digits="0" name="iacCrankBins" rows="4" units="C">
-28.0
6.0
44.0
73.0
127.0
85.0
39.0
-13.0
</constant>
<constant name="iacAlgorithm">"None"</constant>
<constant name="iacStepTime">"3"</constant>
<constant digits="0" name="iacFastTemp" units="C">20.0</constant>
<constant digits="0" name="iacStepHome" units="Steps">240.0</constant>
<constant digits="0" name="iacStepHyster" units="Steps">4.0</constant>
<constant name="iacStepTime">"1"</constant>
<constant digits="0" name="iacFastTemp" units="C">-40.0</constant>
<constant digits="0" name="iacStepHome" units="Steps">0.0</constant>
<constant digits="0" name="iacStepHyster" units="Steps">0.0</constant>
<constant name="fanInv">"No"</constant>
<constant name="fanEnable">"No"</constant>
<constant name="unused55a">"No"</constant>
@ -490,73 +498,72 @@
<constant name="unused55d">"No"</constant>
<constant name="unused55e">"No"</constant>
<constant name="unused55f">"No"</constant>
<constant digits="0" name="fanSP" units="°C">77.0</constant>
<constant digits="0" name="fanHyster" units="°C">2.0</constant>
<constant digits="0" name="fanSP" units="°C">-40.0</constant>
<constant digits="0" name="fanHyster" units="°C">-40.0</constant>
</page>
<page number="7" size="160">
<constant cols="8" digits="0" name="boostTable" rows="8" units="%">
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
11.0 10.0 6.0 6.0 6.0 6.0 7.0 7.0
24.0 22.0 20.0 18.0 18.0 18.0 19.0 20.0
32.0 30.0 29.0 28.0 27.0 27.0 27.0 29.0
39.0 39.0 38.0 38.0 37.0 37.0 36.0 36.0
46.0 47.0 47.0 46.0 46.0 45.0 45.0 43.0
56.0 56.0 56.0 55.0 55.0 55.0 55.0 56.0
68.0 68.0 69.0 69.0 69.0 69.0 69.0 69.0
23.0 23.0 23.0 24.0 22.0 21.0 19.0 18.0
17.0 15.0 15.0 15.0 15.0 15.0 15.0 15.0
24.0 24.0 24.0 25.0 23.0 22.0 20.0 19.0
18.0 16.0 15.0 15.0 15.0 15.0 15.0 15.0
24.0 25.0 26.0 27.0 26.0 24.0 23.0 21.0
20.0 18.0 17.0 16.0 15.0 15.0 15.0 15.0
26.0 28.0 29.0 30.0 29.0 27.0 26.0 24.0
23.0 21.0 20.0 18.0 17.0 16.0 16.0 16.0
</constant>
<constant cols="1" digits="0" name="rpmBinsBoost" rows="8" units="RPM">
1000.0
2000.0
2700.0
3300.0
3500.0
3600.0
3200.0
3000.0
3800.0
4500.0
5300.0
6000.0
6800.0
2900.0
2700.0
</constant>
<constant cols="1" digits="0" name="tpsBinsBoost" rows="8" units="TPS">
0.0
10.0
20.0
40.0
25.0
35.0
50.0
60.0
65.0
80.0
90.0
100.0
</constant>
<constant cols="8" digits="0" name="vvtTable" rows="8" units="%">
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
11.0 10.0 6.0 6.0 6.0 6.0 7.0 7.0
24.0 22.0 20.0 18.0 18.0 18.0 19.0 20.0
32.0 30.0 29.0 28.0 27.0 27.0 27.0 29.0
39.0 39.0 38.0 38.0 37.0 37.0 36.0 36.0
46.0 47.0 47.0 46.0 46.0 45.0 45.0 43.0
56.0 56.0 56.0 55.0 55.0 55.0 55.0 56.0
68.0 68.0 69.0 69.0 69.0 69.0 69.0 69.0
31.0 38.0 40.0 39.0 36.0 34.0 32.0 30.0
29.0 27.0 26.0 24.0 23.0 21.0 21.0 22.0
35.0 38.0 40.0 39.0 40.0 38.0 36.0 34.0
32.0 31.0 29.0 28.0 26.0 24.0 24.0 24.0
41.0 43.0 44.0 42.0 43.0 41.0 40.0 38.0
36.0 34.0 32.0 31.0 29.0 27.0 26.0 27.0
45.0 46.0 46.0 46.0 45.0 43.0 41.0 40.0
99.0 98.0 99.0 98.0 31.0 29.0 29.0 29.0
</constant>
<constant cols="1" digits="0" name="rpmBinsVVT" rows="8" units="RPM">
1000.0
2000.0
3000.0
3800.0
4500.0
5300.0
6000.0
6800.0
4600.0
4600.0
4600.0
4600.0
4400.0
4200.0
4000.0
</constant>
<constant cols="1" digits="0" name="tpsBinsVVT" rows="8" units="TPS">
0.0
10.0
20.0
40.0
25.0
35.0
50.0
60.0
65.0
80.0
90.0
100.0
</constant>
</page>
<settings Comment="These setting are only used if this msq is opened without a project.">
<setting name="NARROW_BAND_EGO" value="NARROW_BAND_EGO"/>
<setting name="CELSIUS" value="CELSIUS"/>
<setting name="SPEED_DENSITY" value="SPEED_DENSITY"/>
</settings>

View File

@ -336,7 +336,7 @@ void setup()
if(configPage2.TrigEdge == 0) { attachInterrupt(triggerInterrupt, trigger, RISING); } // Attach the crank trigger wheel interrupt (Hall sensor drags to ground when triggering)
else { attachInterrupt(triggerInterrupt, trigger, FALLING); } // Primary trigger connects to
attachInterrupt(triggerInterrupt2, triggerSec_Jeep2000, RISING);
attachInterrupt(triggerInterrupt2, triggerSec_Jeep2000, CHANGE);
break;
default:
@ -726,7 +726,17 @@ void loop()
int tempStartAngle;
//How fast are we going? Need to know how long (uS) it will take to get from one tooth to the next. We then use that to estimate how far we are between the last tooth and the next one
timePerDegree = ldiv( 166666L, currentStatus.RPM ).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / )
//We use a 1st Deriv accleration prediction, but only when there is an even spacing between primary sensor teeth
//Any decoder that has uneven spacing has its triggerToothAngle set to 0
if(triggerToothAngle > 0)
{
long toothAccel = toothDeltaV / triggerToothAngle; //An amount represengint the current acceleration or decceleration of the crank in degrees per uS per uS
timePerDegree = ldiv( 166666L, currentStatus.RPM ).quot + (toothAccel * (micros() - toothLastToothTime)); //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / )
}
else
{
timePerDegree = ldiv( 166666L, currentStatus.RPM ).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / )
}
//Check that the duty cycle of the chosen pulsewidth isn't too high. This is disabled at cranking
if( !BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) )
@ -739,9 +749,8 @@ void loop()
//***********************************************************************************************
//BEGIN INJECTION TIMING
//Determine next firing angles
//1
int PWdivTimerPerDegree = div(currentStatus.PW, timePerDegree).quot; //How many crank degrees the calculated PW will take at the current speed
injector1StartAngle = configPage1.inj1Ang - ( PWdivTimerPerDegree ); //This is a little primitive, 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
injector1StartAngle = configPage1.inj1Ang - ( PWdivTimerPerDegree ); //This is a little primitive, but is based on the idea that all fuel needs to be delivered before the inlet valve opens. See http://www.extraefi.co.uk/sequential_fuel.html for more detail
if(injector1StartAngle < 0) {injector1StartAngle += 360;}
//Repeat the above for each cylinder
switch (configPage1.nCylinders)
@ -820,7 +829,7 @@ void loop()
break;
//4 cylinders
case 4:
ignition2StartAngle = channel2IgnDegrees + 360 - currentStatus.advance - dwellAngle; //(div((configPage2.dwellRun*100), timePerDegree).quot ));
ignition2StartAngle = channel2IgnDegrees + 360 - currentStatus.advance - dwellAngle;
if(ignition2StartAngle > 360) {ignition2StartAngle -= 360;}
if(ignition2StartAngle < 0) {ignition2StartAngle += 360;}
break;
@ -946,9 +955,13 @@ void loop()
crankAngle = getCrankAngle(timePerDegree); //Refresh with the latest crank angle
if(ignitionOn && (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ))
{
//if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions)
if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions)
//if (ign1LastRev != startRevolutions)
{
unsigned long ignition1StartTime;
if(ignition1StartAngle > crankAngle) { ignition1StartTime = ((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree); }
else { ignition1StartTime = ((unsigned long)(360 - crankAngle + ignition1StartAngle) * (unsigned long)timePerDegree); }
setIgnitionSchedule1(ign1StartFunction,
((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell,
@ -961,7 +974,12 @@ void loop()
tempStartAngle = ignition2StartAngle - channel2IgnDegrees;
if ( tempStartAngle < 0) { tempStartAngle += 360; }
if ( (tempStartAngle > tempCrankAngle) && ign2LastRev != startRevolutions)
//if ( ign2LastRev != startRevolutions )
{
unsigned long ignition2StartTime;
if(tempStartAngle > tempCrankAngle) { ignition2StartTime = ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree); }
else { ignition2StartTime = ((unsigned long)(360 - tempCrankAngle + tempStartAngle) * (unsigned long)timePerDegree); }
setIgnitionSchedule2(ign2StartFunction,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell,