MISRA cleanup
This commit is contained in:
parent
654aa728d5
commit
a2e1379fd6
|
@ -58,8 +58,8 @@ volatile int triggerActualTeeth;
|
|||
volatile unsigned long triggerFilterTime; // The shortest time (in uS) that pulses will be accepted (Used for debounce filtering)
|
||||
unsigned long triggerSecFilterTime; // The shortest time (in uS) that pulses will be accepted (Used for debounce filtering) for the secondary input
|
||||
unsigned int triggerSecFilterTime_duration; // The shortest valid time (in uS) pulse DURATION
|
||||
volatile int triggerToothAngle; //The number of crank degrees that elapse per tooth
|
||||
volatile bool triggerToothAngleIsCorrect = false; //Whether or not the triggerToothAngle variable is currently accurate. Some patterns have times when the triggerToothAngle variable cannot be accurately set.
|
||||
volatile uint16_t triggerToothAngle; //The number of crank degrees that elapse per tooth
|
||||
volatile bool triggerToothAngleIsCorrect = false; //Whether or not the triggerToothAngle variable is currently accurate. Some patterns have times when the triggerToothAngle variable cannot be accurately set.
|
||||
bool secondDerivEnabled; //The use of the 2nd derivative calculation is limited to certain decoders. This is set to either true or false in each decoders setup routine
|
||||
bool decoderIsSequential; //Whether or not the decoder supports sequential operation
|
||||
bool decoderIsLowRes = false; //Is set true, certain extra calculations are performed for better timing accuracy
|
||||
|
|
|
@ -926,13 +926,12 @@ int getCrankAngle_4G63(int timePerDegree)
|
|||
{
|
||||
//This is the current angle ATDC the engine is at. This is the last known position based on what tooth was last 'seen'. It is only accurate to the resolution of the trigger wheel (Eg 36-1 is 10 degrees)
|
||||
unsigned long tempToothLastToothTime, tempToothLastMinusOneToothTime;
|
||||
int tempToothCurrentCount, tempToothAngle;
|
||||
int tempToothCurrentCount;
|
||||
//Grab some variables that are used in the trigger code and assign them to temp variables.
|
||||
noInterrupts();
|
||||
tempToothCurrentCount = toothCurrentCount;
|
||||
tempToothLastToothTime = toothLastToothTime;
|
||||
tempToothLastMinusOneToothTime = toothLastMinusOneToothTime;
|
||||
tempToothAngle = triggerToothAngle;
|
||||
interrupts();
|
||||
|
||||
crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage2.triggerAngle; //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was.
|
||||
|
@ -941,7 +940,7 @@ int getCrankAngle_4G63(int timePerDegree)
|
|||
unsigned long elapsedTime = micros() - tempToothLastToothTime;
|
||||
//crankAngle += uSToDegrees(elapsedTime);
|
||||
unsigned long toothTime = tempToothLastToothTime - tempToothLastMinusOneToothTime;
|
||||
crankAngle += (elapsedTime * triggerToothAngle) / toothTime;
|
||||
crankAngle += int16_t((elapsedTime * triggerToothAngle) / toothTime);
|
||||
//timePerDegree = toothTime / tempToothAngle;
|
||||
|
||||
if (crankAngle >= 720) { crankAngle -= 720; }
|
||||
|
@ -2527,8 +2526,6 @@ void triggerPri_ThirtySixMinus222()
|
|||
|
||||
if ( (curGap > targetGap) )
|
||||
{
|
||||
//if(toothCurrentCount < (triggerActualTeeth) && (currentStatus.hasSync == true) ) { currentStatus.hasSync = false; } //This occurs when we're at tooth #1, but haven't seen all the other teeth. This indicates a signal issue so we flag lost sync so this will attempt to resync on the next revolution.
|
||||
//else
|
||||
{
|
||||
if(toothSystemCount == 1)
|
||||
{
|
||||
|
|
|
@ -725,21 +725,22 @@ static inline void ignitionSchedule1Interrupt() //Most ARM chips can simply call
|
|||
ignitionSchedule1.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||
ignitionSchedule1.startTime = micros();
|
||||
IGN1_COMPARE = ignitionSchedule1.endCompare;
|
||||
}
|
||||
/*
|
||||
This code is all to do with the staged ignition timing testing. That is, calling this interrupt slightly before the true ignition point and recalculating the end time for more accuracy
|
||||
IGN1_COMPARE = ignitionSchedule1.endCompare - 20;
|
||||
ignitionSchedule1.Status = STAGED;
|
||||
}
|
||||
//This code is all to do with the staged ignition timing testing. That is, calling this interrupt slightly before the true ignition point and recalculating the end time for more accuracy
|
||||
//IGN1_COMPARE = ignitionSchedule1.endCompare - 50;
|
||||
//ignitionSchedule1.Status = STAGED;
|
||||
}
|
||||
else if (ignitionSchedule1.Status == STAGED)
|
||||
{
|
||||
int16_t crankAngle = getCrankAngle(timePerDegree);
|
||||
if(crankAngle > CRANK_ANGLE_MAX_IGN) { crankAngle -= CRANK_ANGLE_MAX_IGN; }
|
||||
if(ignition1EndAngle > crankAngle)
|
||||
{ IGN1_COMPARE = IGN1_COUNTER + uS_TO_TIMER_COMPARE( (ignition1EndAngle - crankAngle) * timePerDegree ); }
|
||||
{
|
||||
IGN1_COMPARE = IGN1_COUNTER + uS_TO_TIMER_COMPARE( fastDegreesToUS((ignition1EndAngle - crankAngle)) );
|
||||
}
|
||||
else { IGN1_COMPARE = ignitionSchedule1.endCompare; }
|
||||
|
||||
ignitionSchedule1.Status = RUNNING;
|
||||
}*/
|
||||
}
|
||||
else if (ignitionSchedule1.Status == RUNNING)
|
||||
{
|
||||
ignitionSchedule1.EndCallback();
|
||||
|
|
|
@ -1452,10 +1452,14 @@ void loop()
|
|||
if( (ignitionSchedule1.Status == RUNNING) && (ignition1EndAngle > crankAngle) && configPage2.StgCycles == 0)
|
||||
{
|
||||
unsigned long uSToEnd = 0;
|
||||
//if(ignition1EndAngle > crankAngle) { uSToEnd = fastDegreesToUS( (ignition1EndAngle - crankAngle) ); }
|
||||
//else { uSToEnd = fastDegreesToUS( (360 + ignition1EndAngle - crankAngle) ); }
|
||||
uSToEnd = fastDegreesToUS( (ignition1EndAngle - crankAngle) );
|
||||
//uSToEnd = ((ignition1EndAngle - crankAngle) * (toothLastToothTime - toothLastMinusOneToothTime)) / triggerToothAngle;
|
||||
|
||||
ONLY ONE OF THE BELOW SHOULD BE USED (PROBABLY THE FIRST):
|
||||
*********
|
||||
if(ignition1EndAngle > crankAngle) { uSToEnd = fastDegreesToUS( (ignition1EndAngle - crankAngle) ); }
|
||||
else { uSToEnd = fastDegreesToUS( (360 + ignition1EndAngle - crankAngle) ); }
|
||||
*********
|
||||
uSToEnd = ((ignition1EndAngle - crankAngle) * (toothLastToothTime - toothLastMinusOneToothTime)) / triggerToothAngle;
|
||||
*********
|
||||
|
||||
refreshIgnitionSchedule1( uSToEnd + fixedCrankingOverride );
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ void setPinMapping(byte boardID)
|
|||
pinCoil2 = 24; //Done
|
||||
pinCoil3 = 51; //Won't work (No mapping for pin 32)
|
||||
pinCoil4 = 52; //Won't work (No mapping for pin 33)
|
||||
pinFuelPump = 53; //Won't work (No mapping for pin 37)
|
||||
pinFuelPump = 26; //Requires PVT4 adapter or above
|
||||
pinFan = 50; //Won't work (No mapping for pin 35)
|
||||
pinTachOut = 28; //Done
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue