Skip to content
Permalink
Browse files

6&8-cyl wasted cop (#314)

* Added 6-cyl cop mode

* Update to ini

* Why not 8-cyl wasted COP too

Co-authored-by: Pasi Kemppainen <pazi88@users.noreply.github.com>
  • Loading branch information
pazi88 committed Mar 26, 2020
1 parent e6cf7b5 commit 1b4d81453c02f75d7b4724c972d52e7ade5db017
Showing with 80 additions and 4 deletions.
  1. +1 −1 reference/speeduino.ini
  2. +43 −3 speeduino/init.ino
  3. +18 −0 speeduino/scheduledIO.h
  4. +18 −0 speeduino/scheduledIO.ino
@@ -1392,7 +1392,7 @@ menuDialog = main
TrigEdgeSec = "The Trigger edge of the secondary (Cam) sensor.\nLeading.\nTrailing."
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 no 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"
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. Note that your board needs to have same number of igntion outputs as cylinders to be able to run this"
IgInv = "Whether the spark fires when the ignition signal goes high or goes low. Nearly all ignition systems use 'Going Low' but please verify this as damage to coils can result from the incorrect selection. (NOTE: THIS IS NOT MEGASQUIRT. THIS SETTING IS USUALLY THE OPPOSITE OF WHAT THEY USE!)"
sparkDur = "The duration of the spark at full dwell. Typically around 1ms"
fixAngEnable= "If enabled, timing will be locked/fixed and the ignition map will be ignored. Note that this value will be overriden by the fixed cranking value when cranking"
@@ -810,8 +810,8 @@ void initialiseAll()
break;

case IGN_MODE_WASTEDCOP:
//Wasted COP mode. Ignition channels 1&3 and 2&4 are paired together
//This is not a valid mode for >4 cylinders
//Wasted COP mode. Note, most of the boards can only run this for 4-cyl only.
//Wasted COP mode for 4 cylinders. Ignition channels 1&3 and 2&4 are paired together
if( configPage2.nCylinders <= 4 )
{
ign1StartFunction = beginCoil1and3Charge;
@@ -824,9 +824,49 @@ void initialiseAll()
ign4StartFunction = nullCallback;
ign4EndFunction = nullCallback;
}
//Wasted COP mode for 6 cylinders. Ignition channels 1&4, 2&5 and 3&6 are paired together
else if( configPage2.nCylinders == 6 )
{
ign1StartFunction = beginCoil1and4Charge;
ign1EndFunction = endCoil1and4Charge;
ign2StartFunction = beginCoil2and5Charge;
ign2EndFunction = endCoil2and5Charge;
ign3StartFunction = beginCoil3and6Charge;
ign3EndFunction = endCoil3and6Charge;

ign4StartFunction = nullCallback;
ign4EndFunction = nullCallback;
ign5StartFunction = nullCallback;
ign5EndFunction = nullCallback;
ign6StartFunction = nullCallback;
ign6EndFunction = nullCallback;
}
//Wasted COP mode for 8 cylinders. Ignition channels 1&5, 2&6, 3&7 and 4&8 are paired together
else if( configPage2.nCylinders == 8 )
{
ign1StartFunction = beginCoil1and5Charge;
ign1EndFunction = endCoil1and5Charge;
ign2StartFunction = beginCoil2and6Charge;
ign2EndFunction = endCoil2and6Charge;
ign3StartFunction = beginCoil3and7Charge;
ign3EndFunction = endCoil3and7Charge;
ign3StartFunction = beginCoil4and8Charge;
ign3EndFunction = endCoil4and8Charge;

ign4StartFunction = nullCallback;
ign4EndFunction = nullCallback;
ign5StartFunction = nullCallback;
ign5EndFunction = nullCallback;
ign6StartFunction = nullCallback;
ign6EndFunction = nullCallback;
ign7StartFunction = nullCallback;
ign7EndFunction = nullCallback;
ign8StartFunction = nullCallback;
ign8EndFunction = nullCallback;
}
else
{
//If the person has inadvertantly selected this when running more than 4 cylinders, just use standard Wasted spark mode
//If the person has inadvertantly selected this when running more than 4 cylinders or other than 6 cylinders, just use standard Wasted spark mode
ign1StartFunction = beginCoil1Charge;
ign1EndFunction = endCoil1Charge;
ign2StartFunction = beginCoil2Charge;
@@ -45,6 +45,24 @@ void beginCoil1and3Charge();
void endCoil1and3Charge();
void beginCoil2and4Charge();
void endCoil2and4Charge();

//For 6-cyl cop
void beginCoil1and4Charge();
void endCoil1and4Charge();
void beginCoil2and5Charge();
void endCoil2and5Charge();
void beginCoil3and6Charge();
void endCoil3and6Charge();

//For 8-cyl cop
void beginCoil1and5Charge();
void endCoil1and5Charge();
void beginCoil2and6Charge();
void endCoil2and6Charge();
void beginCoil3and7Charge();
void endCoil3and7Charge();
void beginCoil4and8Charge();
void endCoil4and8Charge();
/*
#define beginCoil1and3Charge() beginCoil1Charge(); beginCoil3Charge()
#define endCoil1and3Charge()
@@ -76,4 +76,22 @@
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
#endif

//For 6cyl wasted COP mode)
void beginCoil1and4Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
void endCoil1and4Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil4, coilLOW); }
void beginCoil2and5Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil5, coilHIGH); tachoOutputFlag = READY; }
void endCoil2and5Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil5, coilLOW); }
void beginCoil3and6Charge() { digitalWrite(pinCoil3, coilHIGH); digitalWrite(pinCoil6, coilHIGH); tachoOutputFlag = READY; }
void endCoil3and6Charge() { digitalWrite(pinCoil3, coilLOW); digitalWrite(pinCoil6, coilLOW); }

//For 8cyl wasted COP mode)
void beginCoil1and5Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil5, coilHIGH); tachoOutputFlag = READY; }
void endCoil1and5Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil5, coilLOW); }
void beginCoil2and6Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil6, coilHIGH); tachoOutputFlag = READY; }
void endCoil2and6Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil6, coilLOW); }
void beginCoil3and7Charge() { digitalWrite(pinCoil3, coilHIGH); digitalWrite(pinCoil7, coilHIGH); tachoOutputFlag = READY; }
void endCoil3and7Charge() { digitalWrite(pinCoil3, coilLOW); digitalWrite(pinCoil7, coilLOW); }
void beginCoil4and8Charge() { digitalWrite(pinCoil4, coilHIGH); digitalWrite(pinCoil8, coilHIGH); tachoOutputFlag = READY; }
void endCoil4and8Charge() { digitalWrite(pinCoil4, coilLOW); digitalWrite(pinCoil8, coilLOW); }

void nullCallback() { return; }

0 comments on commit 1b4d814

Please sign in to comment.
You can’t perform that action at this time.