Corrected limiting of 2 stroke injection to 360 degrees. See #162

This commit is contained in:
Josh Stewart 2018-09-07 13:52:50 +10:00
parent 9f81ab6344
commit 8e4a9c82f3
2 changed files with 16 additions and 10 deletions

View File

@ -182,6 +182,9 @@
#define OPEN_LOOP_BOOST 0
#define CLOSED_LOOP_BOOST 1
#define FOUR_STROKE 0
#define TWO_STROKE 1
#define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance
#define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke

View File

@ -341,7 +341,10 @@ void setup()
mainLoopCount = 0;
currentStatus.nSquirts = configPage2.nCylinders / configPage2.divider; //The number of squirts being requested. This is manaully overriden below for sequential setups (Due to TS req_fuel calc limitations)
CRANK_ANGLE_MAX_INJ = 720 / currentStatus.nSquirts;
if(currentStatus.nSquirts == 0) { currentStatus.nSquirts = 1; } //Safety check
if(configPage2.strokes == FOUR_STROKE) { CRANK_ANGLE_MAX_INJ = 720 / currentStatus.nSquirts; }
else { CRANK_ANGLE_MAX_INJ = 360 / currentStatus.nSquirts; }
//Calculate the number of degrees between cylinders
switch (configPage2.nCylinders) {
@ -351,9 +354,9 @@ void setup()
maxIgnOutputs = 1;
//Sequential ignition works identically on a 1 cylinder whether it's odd or even fire.
if(configPage4.sparkMode == IGN_MODE_SEQUENTIAL) { CRANK_ANGLE_MAX_IGN = 720; }
if( (configPage4.sparkMode == IGN_MODE_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) ) { CRANK_ANGLE_MAX_IGN = 720; }
if (configPage2.injLayout == INJ_SEQUENTIAL)
if ( (configPage2.injLayout == INJ_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) )
{
CRANK_ANGLE_MAX_INJ = 720;
currentStatus.nSquirts = 1;
@ -371,9 +374,9 @@ void setup()
else { channel2IgnDegrees = configPage2.oddfire2; }
//Sequential ignition works identically on a 2 cylinder whether it's odd or even fire (With the default being a 180 degree second cylinder).
if(configPage4.sparkMode == IGN_MODE_SEQUENTIAL) { CRANK_ANGLE_MAX_IGN = 720; }
if( (configPage4.sparkMode == IGN_MODE_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) ) { CRANK_ANGLE_MAX_IGN = 720; }
if (configPage2.injLayout == INJ_SEQUENTIAL)
if ( (configPage2.injLayout == INJ_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) )
{
CRANK_ANGLE_MAX_INJ = 720;
currentStatus.nSquirts = 1;
@ -398,7 +401,7 @@ void setup()
maxIgnOutputs = 3;
if (configPage2.engineType == EVEN_FIRE )
{
if(configPage4.sparkMode == IGN_MODE_SEQUENTIAL)
if( (configPage4.sparkMode == IGN_MODE_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) )
{
channel2IgnDegrees = 240;
channel3IgnDegrees = 480;
@ -418,7 +421,7 @@ void setup()
}
//For alternatiing injection, the squirt occurs at different times for each channel
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) )
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) || (configPage2.strokes == TWO_STROKE) )
{
channel1InjDegrees = 0;
channel2InjDegrees = 120;
@ -466,7 +469,7 @@ void setup()
channel2InjDegrees = channel2InjDegrees / (currentStatus.nSquirts / 2);
}
if(configPage4.sparkMode == IGN_MODE_SEQUENTIAL)
if( (configPage4.sparkMode == IGN_MODE_SEQUENTIAL) && (configPage2.strokes == FOUR_STROKE) )
{
channel3IgnDegrees = 360;
channel4IgnDegrees = 540;
@ -490,7 +493,7 @@ void setup()
}
//For alternatiing injection, the squirt occurs at different times for each channel
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) )
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) || (configPage2.strokes == TWO_STROKE) )
{
channel2InjDegrees = 180;
@ -547,7 +550,7 @@ void setup()
}
//For alternatiing injection, the squirt occurs at different times for each channel
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) )
if( (configPage2.injLayout == INJ_SEMISEQUENTIAL) || (configPage2.injLayout == INJ_PAIRED) || (configPage2.strokes == TWO_STROKE) )
{
channel1InjDegrees = 0;
channel2InjDegrees = 72;