Expand filter configuration for decoders
This commit is contained in:
parent
e61dcc566b
commit
a0fa7527d6
40
decoders.ino
40
decoders.ino
|
@ -45,6 +45,17 @@ inline int stdGetRPM()
|
|||
return tempRPM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the new filter time based on the current settings.
|
||||
* This ONLY works for even spaced decoders
|
||||
*/
|
||||
inline void setFilter(unsigned long curGap)
|
||||
{
|
||||
if(configPage2.triggerFilter == 1) { triggerFilterTime = curGap >> 2; } //Lite filter level is 50% of previous gap
|
||||
else if(configPage2.triggerFilter == 2) { triggerFilterTime = curGap >> 1; } //Medium filter level is 50% of previous gap
|
||||
else if (configPage2.triggerFilter == 3) { triggerFilterTime = (curGap * 3) >> 2; } //Aggressive filter level is 75% of previous gap
|
||||
}
|
||||
|
||||
/*
|
||||
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.
|
||||
|
@ -98,7 +109,12 @@ void triggerPri_missingTooth()
|
|||
toothOneTime = curTime;
|
||||
currentStatus.hasSync = true;
|
||||
startRevolutions++; //Counter
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Filter can only be recalc'd for the regular teeth, not the missing one.
|
||||
setFilter(curGap);
|
||||
}
|
||||
|
||||
toothLastMinusOneToothTime = toothLastToothTime;
|
||||
toothLastToothTime = curTime;
|
||||
|
@ -169,9 +185,7 @@ void triggerPri_DualWheel()
|
|||
//if ((startRevolutions & 63) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam
|
||||
}
|
||||
|
||||
//Filter
|
||||
if(configPage2.triggerFilter == 2) { triggerFilterTime = curGap >> 1; } //Normal filter level is 50% of previous gap
|
||||
else if (configPage2.triggerFilter == 3) { triggerFilterTime = (curGap * 3) >> 2; } //Aggressive filter level is 75% of previous gap
|
||||
setFilter(curGap); //Recalc the new filter value
|
||||
|
||||
toothLastMinusOneToothTime = toothLastToothTime;
|
||||
toothLastToothTime = curTime;
|
||||
|
@ -245,7 +259,7 @@ void triggerPri_BasicDistributor()
|
|||
{
|
||||
curTime = micros();
|
||||
curGap = curTime - toothLastToothTime;
|
||||
if ( curGap < triggerFilterTime ) { return; } //Debounce check. Pulses should never be less than triggerFilterTime
|
||||
if ( curGap < triggerFilterTime ) { return; } //Noise rejection check. Pulses should never be less than triggerFilterTime
|
||||
|
||||
if(toothCurrentCount == triggerActualTeeth ) //Check if we're back to the beginning of a revolution
|
||||
{
|
||||
|
@ -255,7 +269,12 @@ void triggerPri_BasicDistributor()
|
|||
currentStatus.hasSync = true;
|
||||
startRevolutions++; //Counter
|
||||
}
|
||||
else { toothCurrentCount++; } //Increment the tooth counter
|
||||
else
|
||||
{
|
||||
toothCurrentCount++; //Increment the tooth counter
|
||||
}
|
||||
|
||||
setFilter(curGap); //Recalc the new filter value
|
||||
|
||||
addToothLogEntry(curGap);
|
||||
|
||||
|
@ -636,6 +655,7 @@ void triggerPri_Jeep2000()
|
|||
if(toothCurrentCount == 13) { currentStatus.hasSync = false; return; } //Indicates sync has not been achieved (Still waiting for 1 revolution of the crank to take place)
|
||||
curTime = micros();
|
||||
curGap = curTime - toothLastToothTime;
|
||||
if ( curGap < triggerFilterTime ) { return; } //Noise rejection check. Pulses should never be less than triggerFilterTime
|
||||
|
||||
if(toothCurrentCount == 0)
|
||||
{
|
||||
|
@ -649,6 +669,8 @@ void triggerPri_Jeep2000()
|
|||
{
|
||||
toothCurrentCount++; //Increment the tooth counter
|
||||
}
|
||||
|
||||
setFilter(curGap); //Recalc the new filter value
|
||||
|
||||
addToothLogEntry(curGap);
|
||||
|
||||
|
@ -728,6 +750,8 @@ void triggerPri_Audi135()
|
|||
toothOneTime = curTime;
|
||||
startRevolutions++; //Counter
|
||||
}
|
||||
|
||||
setFilter(curGap); //Recalc the new filter value
|
||||
|
||||
toothLastMinusOneToothTime = toothLastToothTime;
|
||||
toothLastToothTime = curTime;
|
||||
|
@ -782,8 +806,8 @@ int getCrankAngle_Audi135(int timePerDegree)
|
|||
|
||||
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Name: Honda D17
|
||||
Desc: GM 7X trigger wheel. It has six equally spaced teeth and a seventh tooth for cylinder identification.
|
||||
Note: Within the code below, the sync tooth is referred to as tooth #3 rather than tooth #7. This makes for simpler angle calculations
|
||||
Desc:
|
||||
Note:
|
||||
*/
|
||||
void triggerSetup_HondaD17()
|
||||
{
|
||||
|
|
|
@ -224,7 +224,7 @@ page = 4
|
|||
useDwellLim= bits, U08, 12, [1:1], "Off", "On"
|
||||
sparkMode = bits, U08, 12, [2:3], "Wasted Spark", "Single Channel", "Wasted COP", "Sequential"
|
||||
dfcoEnabled= bits, U08, 12, [4:4], "Off", "On"
|
||||
TrigFilter = bits, U08, 12, [5:6], "Off, "INVALID", "Normal", "Aggressive"
|
||||
TrigFilter = bits, U08, 12, [5:6], "Off, "Weak", "Medium", "Aggressive"
|
||||
dwellcrank = scalar, U08, 13, "ms", 0.1, 0, 0, 25, 1
|
||||
dwellrun = scalar, U08, 14, "ms", 0.1, 0, 0, 8, 1
|
||||
numteeth = scalar, U08, 15, "teeth", 1.0, 0.0, 0.0, 255, 0
|
||||
|
@ -566,7 +566,7 @@ page = 8
|
|||
TrigAng = "The Angle ATDC when tooth No:1 on the primary wheel passes the primary sensor."
|
||||
StgCycles = "The number of revolutions that will be skipped during cranking before the injectors and coils are fired."
|
||||
TrigEdge = "The Trigger edge of the primary sensor.\nLeading.\nTrailing."
|
||||
TrigFilter = "Tuning of the trigger filter algorithm. The more aggressive the setting, the more noise will be removed, but this also increases the chance of some true readings being filtered out. Only select 'Aggressive' if not other options are working"
|
||||
TrigFilter = "Tuning of the trigger filter algorithm. The more aggressive the setting, the more noise will be removed, however this increases the chance of some true readings being filtered out (False positive). Medium is safe for most setups. Only select 'Aggressive' if not other options are working"
|
||||
|
||||
sparkMode = "Wasted Spark: Ignition outputs are on the channels <= half the number of cylinders. Eg 4 cylinder outputs on IGN1 and IGN2.\nSingle Channel: All ignition pulses are output on IGN1.\nWasted COP: Ignition pulses are output on all ignition channels up to the number of cylinders. Eg 4 cylinder outputs on all ignition channels. No valid for >4 cylinders"
|
||||
IgInv = "Whether the spark fires when the ignition sign goes high or goes low. Most ignition systems 'Going Low' but please verify this as damage to coils can result from the incorrect selection"
|
||||
|
|
Loading…
Reference in New Issue