Tentative 6 cylinder support (3000GT) added to 4G63 decoder

Requested in #76
Needs testing. Select the decoder and set cylinders to 6.
Note that the Medium and Aggressive trigger filters do NOT currently
work for 6 cylinders and should not be used.
This commit is contained in:
Josh Stewart 2017-05-16 16:49:35 +10:00
parent f27f883a5c
commit 81c548a9e8
2 changed files with 51 additions and 12 deletions

View File

@ -271,7 +271,7 @@ page = 4
TrigSpeed = bits, U08, 5,[1:1], "Crank Speed", "Cam Speed"
IgInv = bits, U08, 5,[2:2], "Going Low", "Going High"
oddfire = bits, U08, 5,[3:3], "No", "Yes"
TrigPattern= bits, U08, 5,[4:7], "Missing Tooth", "Basic Distributor", "Dual Wheel", "GM 7X", "4G63 / Miata", "GM 24X", "Jeep 2000", "Audi 135", "Honda D17", "Miata 99-05", "Mazda AU", "Non-360 Dual", "Nissan 360", "Subaru 6/7", "INVALID", "INVALID"
TrigPattern= bits, U08, 5,[4:7], "Missing Tooth", "Basic Distributor", "Dual Wheel", "GM 7X", "4G63 / Miata / 3000GT", "GM 24X", "Jeep 2000", "Audi 135", "Honda D17", "Miata 99-05", "Mazda AU", "Non-360 Dual", "Nissan 360", "Subaru 6/7", "INVALID", "INVALID"
TrigEdgeSec= bits, U08, 6,[0:0], "Leading", "Trailing"
fuelPumpPin= bits , U08, 6,[1:6], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
useResync = bits, U08, 6,[7:7], "No", "Yes"

View File

@ -488,12 +488,33 @@ void triggerSetup_4G63()
toothLastToothTime = micros(); //Set a startup value here to avoid filter errors when starting
//Note that these angles are for every rising and falling edge
if(configPage1.nCylinders == 6)
{
// 70 / 50 for 6 cylinder applications
/*
toothAngles[0] = 355; //Rising edge of tooth #1
toothAngles[1] = 65; //
toothAngles[2] = 115; //
toothAngles[3] = 185; //Should be #1
toothAngles[4] = 235; //
toothAngles[5] = 305; //
*/
toothAngles[0] = 355; //Falling edge of tooth #1
toothAngles[1] = 105; //Rising edge of tooth #2
toothAngles[2] = 175; //Falling edge of tooth #2
toothAngles[3] = 285; //Rising edge of tooth #1
toothAngles[0] = 185; //
toothAngles[1] = 235; //
toothAngles[2] = 305; //
toothAngles[3] = 355; //
toothAngles[4] = 65; //
toothAngles[5] = 115; //
}
else
{
// 70 / 110 for 4 cylinder
toothAngles[0] = 355; //Falling edge of tooth #1
toothAngles[1] = 105; //Rising edge of tooth #2
toothAngles[2] = 175; //Falling edge of tooth #2
toothAngles[3] = 285; //Rising edge of tooth #1
}
/*
* https://forums.libreems.org/attachment.php?aid=34
toothAngles[0] = 715; //Falling edge of tooth #1
@ -529,7 +550,7 @@ void triggerPri_4G63()
toothLastToothTime = curTime;
toothCurrentCount++;
if(toothCurrentCount == 1 || toothCurrentCount > 4) //Trigger is on CHANGE, hence 4 pulses = 1 crank rev
if(toothCurrentCount == 1 || toothCurrentCount > configPage1.nCylinders) //Trigger is on CHANGE, hence 4 pulses = 1 crank rev
{
toothCurrentCount = 1; //Reset the counter
toothOneMinusOneTime = toothOneTime;
@ -544,25 +565,43 @@ void triggerPri_4G63()
{
if( toothCurrentCount == 1 ) { endCoil1Charge(); }
else if( toothCurrentCount == 3 ) { endCoil2Charge(); }
else if( toothCurrentCount == 5 ) { endCoil3Charge(); }
}
//Whilst this is an uneven tooth pattern, if the specific angle between the last 2 teeth is specified, 1st deriv prediction can be used
if(configPage2.triggerFilter == 1 || currentStatus.RPM < 1800)
if(configPage2.triggerFilter == 1 || currentStatus.RPM < 1400)
{
//Lite filter
if(toothCurrentCount == 1 || toothCurrentCount == 3) { triggerToothAngle = 70; triggerFilterTime = curGap; } //Trigger filter is set to whatever time it took to do 70 degrees (Next trigger is 110 degrees away)
else { triggerToothAngle = 110; triggerFilterTime = (curGap * 3) >> 3; } //Trigger filter is set to (110*3)/8=41.25=41 degrees (Next trigger is 70 degrees away).
if(toothCurrentCount == 1 || toothCurrentCount == 3 || toothCurrentCount == 5)
{
triggerToothAngle = 70;
triggerFilterTime = curGap; //Trigger filter is set to whatever time it took to do 70 degrees (Next trigger is 110 degrees away)
if(configPage1.nCylinders == 6)
{
triggerFilterTime = (curGap >> 2); //Trigger filter is set to (70/4)=17.5=17 degrees (Next trigger is 50 degrees away).
}
}
else
{
triggerToothAngle = 110;
triggerFilterTime = (curGap * 3) >> 3; //Trigger filter is set to (110*3)/8=41.25=41 degrees (Next trigger is 70 degrees away).
if(configPage1.nCylinders == 6)
{
triggerToothAngle = 50;
triggerFilterTime = (curGap * 3) >> 2; //Trigger filter is set to (50*3)/4=37.5=37 degrees (Next trigger is 70 degrees away).
}
}
}
else if(configPage2.triggerFilter == 2)
{
//Medium filter level
if(toothCurrentCount == 1 || toothCurrentCount == 3) { triggerToothAngle = 70; triggerFilterTime = (curGap * 5) >> 2 ; } //87.5 degrees with a target of 110
if(toothCurrentCount == 1 || toothCurrentCount == 3 || toothCurrentCount == 5) { triggerToothAngle = 70; triggerFilterTime = (curGap * 5) >> 2 ; } //87.5 degrees with a target of 110
else { triggerToothAngle = 110; triggerFilterTime = (curGap >> 1); } //55 degrees with a target of 70
}
else if (configPage2.triggerFilter == 3)
{
//Aggressive filter level
if(toothCurrentCount == 1 || toothCurrentCount == 3) { triggerToothAngle = 70; triggerFilterTime = (curGap * 11) >> 3 ; } //96.26 degrees with a target of 110
if(toothCurrentCount == 1 || toothCurrentCount == 3 || toothCurrentCount == 5) { triggerToothAngle = 70; triggerFilterTime = (curGap * 11) >> 3 ; } //96.26 degrees with a target of 110
else { triggerToothAngle = 110; triggerFilterTime = (curGap * 9) >> 5; } //61.87 degrees with a target of 70
}
else { triggerFilterTime = 0; } //trigger filter is turned off.