Odd fire support added for up to 4 cylinders

This commit is contained in:
Josh Stewart 2016-09-22 21:59:38 +10:00
parent 091cf250ff
commit 0981e3264e
2 changed files with 44 additions and 23 deletions

View File

@ -61,6 +61,9 @@ const int map_page_size = 288;
#define SIZE_BYTE 8
#define SIZE_INT 16
#define EVEN_FIRE 1
#define ODD_FIRE 0
//Table sizes
#define CALIBRATION_TABLE_SIZE 512
#define CALIBRATION_TEMPERATURE_OFFSET 40 // All temperature measurements are stored offset by 40 degrees. This is so we can use an unsigned byte (0-255) to represent temperature ranges from -40 to 215
@ -223,12 +226,9 @@ struct config1 {
unsigned int mapMax;
byte fpPrime; //Time (In seconds) that the fuel pump should be primed for on power up
byte stoich;
byte unused51;
byte unused52;
byte unused53;
byte unused54;
byte unused55;
byte unused56;
unsigned int oddfire2; //The ATDC angle of channel 2 for oddfire
unsigned int oddfire3; //The ATDC angle of channel 3 for oddfire
unsigned int oddfire4; //The ATDC angle of channel 4 for oddfire
byte unused57;
byte unused58;
byte unused59;
@ -246,7 +246,7 @@ struct config2 {
int triggerAngle;
byte FixAng;
byte CrankAng;
byte IgHold;
byte TrigAngMul; //Multiplier for non evenly divisible tooth counts.
byte TrigEdge : 1;
byte TrigSpeed : 1;
@ -254,8 +254,8 @@ struct config2 {
byte oddfire : 1;
byte TrigPattern : 4;
byte IdleAdv;
byte IdleAdvTPS;
byte unused4_6;
byte unused4_7;
byte IdleAdvRPM;
byte IdleAdvCLT; //The temperature below which the idle is advanced
byte IdleDelayTime;

View File

@ -480,13 +480,15 @@ void setup()
break;
case 2:
channel1IgnDegrees = 0;
channel2IgnDegrees = 180;
if (configPage1.engineType == EVEN_FIRE ) { channel2IgnDegrees = 180; }
else { channel2IgnDegrees = configPage1.oddfire2; }
//For alternatiing injection, the squirt occurs at different times for each channel
if(configPage1.injTiming == INJ_SEMISEQUENTIAL)
{
channel1InjDegrees = 0;
channel2InjDegrees = 180;
channel2InjDegrees = channel2IgnDegrees; //Set to the same as the ignition degrees (Means there's no need for another if to check for oddfire)
}
else { channel1InjDegrees = channel2InjDegrees = 0; } //For simultaneous, all squirts happen at the same time
@ -495,15 +497,24 @@ void setup()
break;
case 3:
channel1IgnDegrees = 0;
channel2IgnDegrees = 120;
channel3IgnDegrees = 240;
if (configPage1.engineType == EVEN_FIRE )
{
channel2IgnDegrees = 120;
channel3IgnDegrees = 240;
}
else
{
channel2IgnDegrees = configPage1.oddfire2;
channel3IgnDegrees = configPage1.oddfire3;
}
//For alternatiing injection, the squirt occurs at different times for each channel
if(configPage1.injTiming == INJ_SEMISEQUENTIAL)
{
channel1InjDegrees = 0;
channel2InjDegrees = 120;
channel3InjDegrees = 240;
channel2InjDegrees = channel2IgnDegrees;
channel3InjDegrees = channel2IgnDegrees;
}
else if (configPage1.injTiming == INJ_SEQUENTIAL)
{
@ -519,26 +530,36 @@ void setup()
break;
case 4:
channel1IgnDegrees = 0;
channel2IgnDegrees = 180;
if(useSequentialIgnition)
if (configPage1.engineType == EVEN_FIRE )
{
channel3IgnDegrees = 360;
channel4IgnDegrees = 540;
channel2IgnDegrees = 180;
if(useSequentialIgnition)
{
channel3IgnDegrees = 360;
channel4IgnDegrees = 540;
}
}
else
{
channel2IgnDegrees = configPage1.oddfire2;
channel3IgnDegrees = configPage1.oddfire3;
channel4IgnDegrees = configPage1.oddfire4;
}
//For alternatiing injection, the squirt occurs at different times for each channel
if(configPage1.injTiming == INJ_SEMISEQUENTIAL)
{
channel1InjDegrees = 0;
channel2InjDegrees = 180;
channel2InjDegrees = channel2IgnDegrees;
}
else if (useSequentialFuel)
{
channel1InjDegrees = 0;
channel2InjDegrees = 180;
channel3InjDegrees = 360;
channel4InjDegrees = 540;
channel2InjDegrees = channel2IgnDegrees;
channel3InjDegrees = channel3IgnDegrees;
channel4InjDegrees = channel4IgnDegrees;
}
else { channel1InjDegrees = channel2InjDegrees = 0; } //For simultaneous, all squirts happen at the same time