Tweaks to the missing tooth per tooth timing

This commit is contained in:
Josh Stewart 2017-07-05 21:12:21 +10:00
parent 80471100be
commit fa49d38253
3 changed files with 18 additions and 7 deletions

View File

@ -61,10 +61,10 @@ bool secondDerivEnabled; //The use of the 2nd derivative calculation is limited
bool decoderIsSequential; //Whether or not the decoder supports sequential operation
byte checkSyncToothCount; //How many teeth must've been seen on this revolution before we try to confirm sync (Useful for missing tooth type decoders)
int ignition1EndTooth = 0;
int ignition2EndTooth = 0;
int ignition3EndTooth = 0;
int ignition4EndTooth = 0;
int16_t ignition1EndTooth = 0;
int16_t ignition2EndTooth = 0;
int16_t ignition3EndTooth = 0;
int16_t ignition4EndTooth = 0;
int toothAngles[24]; //An array for storing fixed tooth angles. Currently sized at 24 for the GM 24X decoder, but may grow later if there are other decoders that use this style

View File

@ -232,10 +232,17 @@ int getCrankAngle_missingTooth(int timePerDegree)
void triggerSetEndTeeth_missingTooth()
{
ignition1EndTooth = ( (ignition1EndAngle - configPage2.triggerAngle) / triggerToothAngle ) - 1;
if(ignition1EndTooth > configPage2.triggerTeeth) { ignition1EndTooth -= configPage2.triggerTeeth; }
if(ignition1EndTooth <= 0) { ignition1EndTooth -= configPage2.triggerTeeth; }
if(ignition1EndTooth > triggerActualTeeth) { ignition1EndTooth = triggerActualTeeth; }
ignition2EndTooth = ( (ignition2EndAngle - configPage2.triggerAngle) / triggerToothAngle ) - 1;
ignition3EndTooth = ( (ignition3EndAngle - configPage2.triggerAngle) / triggerToothAngle ) - 1;
ignition4EndTooth = ( (ignition4EndAngle - configPage2.triggerAngle) / triggerToothAngle ) - 1;
}
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -86,7 +86,8 @@ unsigned long currentLoopTime; //The time the current loop started (uS)
unsigned long previousLoopTime; //The time the previous loop started (uS)
int CRANK_ANGLE_MAX = 720;
int CRANK_ANGLE_MAX_IGN = 360, CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
int CRANK_ANGLE_MAX_IGN = 360;
int CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
static byte coilHIGH = HIGH;
static byte coilLOW = LOW;
@ -98,6 +99,7 @@ byte deltaToothCount = 0; //The last tooth that was used with the deltaV calc
int rpmDelta;
byte ignitionCount;
uint16_t fixedCrankingOverride = 0;
int16_t lastAdvance; //Stores the previous advance figure to track changes.
bool clutchTrigger;
bool previousClutchTrigger;
@ -1106,7 +1108,7 @@ void loop()
//Begin the fuel calculation
//Calculate an injector pulsewidth from the VE
currentStatus.corrections = correctionsFuel();
//currentStatus.corrections = 100;
lastAdvance = currentStatus.advance; //Store the previous advance value
if (configPage1.algorithm == 0) //Check which fuelling algorithm is being used
{
//Speed Density
@ -1380,7 +1382,9 @@ void loop()
default:
break;
}
if(configPage1.perToothIgn == true) { triggerSetEndTeeth(); } //If ignition timing is being tracked per tooth, perform the calcs to get the end teeth
//If ignition timing is being tracked per tooth, perform the calcs to get the end teeth
//This only needs to be run if the advance figure has changed, otherwise the end teeth will still be the same
if( (configPage1.perToothIgn == true) && (lastAdvance != currentStatus.advance) ) { triggerSetEndTeeth(); }
//***********************************************************************************************
//| BEGIN FUEL SCHEDULES