Initial commit of the trigger filter setting (Only currently applies to dual wheel)

This commit is contained in:
Josh Stewart 2016-04-17 02:38:06 +10:00
parent 3978e0e71a
commit e61dcc566b
3 changed files with 12 additions and 3 deletions

View File

@ -155,7 +155,7 @@ void triggerPri_DualWheel()
{
curTime = micros();
curGap = curTime - toothLastToothTime;
if ( curGap < triggerFilterTime ) { return; } //Debounce check. Pulses should never be less than triggerFilterTime, so if they are it means a false trigger. (A 36-1 wheel at 8000pm will have triggers approx. every 200uS)
if ( curGap < triggerFilterTime ) { return; } //Debounce check. Pulses should never be less than triggerFilterTime, so if they are it means a false trigger.
toothCurrentCount++; //Increment the tooth counter
addToothLogEntry(curGap);
if ( !currentStatus.hasSync ) { return; }
@ -167,7 +167,11 @@ void triggerPri_DualWheel()
toothOneTime = curTime;
startRevolutions++; //Counter
//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
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;

View File

@ -250,7 +250,8 @@ struct config2 {
byte useDwellLim : 1; //Whether the dwell limiter is off or on
byte sparkMode : 2; //Spark output mode (Eg Wasted spark, single channel or Wasted COP)
byte dfcoEnabled : 1; //Whether or not DFCO is turned on
byte dwellUnused : 3;
byte triggerFilter : 2; //The mode of trigger filter being used (0=Off, 1=Light (Not currently used), 2=Normal, 3=Aggressive)
byte dwellUnused : 1;
byte dwellCrank; //Dwell time whilst cranking
byte dwellRun; //Dwell time whilst running

View File

@ -224,6 +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"
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
@ -445,6 +446,7 @@ page = 8
defaultValue = mapMin, 10
defaultValue = mapMax, 260
defaultValue = fpPrime, 3
defaultValue = TrigFilter, 0
[Menu]
@ -564,6 +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"
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"
@ -723,6 +726,7 @@ page = 8
field = "Note: This is the number of revolutions that will be skipped during"
field = "cranking before the injectors and coils are fired"
field = "Trigger edge", TrigEdge
field = "Trigger Filter", TrigFilter
dialog = sparkSettings,"Spark Settings",4
field = "Spark output mode", sparkMode