Minor cleanups before release
This commit is contained in:
parent
8f0d654ffa
commit
0de3a231c9
|
@ -4,8 +4,13 @@
|
||||||
int fastMap1023toX(int, int);
|
int fastMap1023toX(int, int);
|
||||||
unsigned long percentage(byte, unsigned long);
|
unsigned long percentage(byte, unsigned long);
|
||||||
|
|
||||||
#define degreesToUS(degrees) (decoderIsLowRes == true ) ? ((degrees * 166666UL) / currentStatus.RPM) : degrees * (unsigned long)timePerDegree
|
//#define degreesToUS(degrees) (decoderIsLowRes == true ) ? ((degrees * 166666UL) / currentStatus.RPM) : (degrees * (unsigned long)timePerDegree)
|
||||||
|
#define degreesToUS(degrees) ((degrees * revolutionTime) / 360)
|
||||||
|
//#define degreesToUS(degrees) ((degrees * revolutionTime * 3054198967ULL) >> 40) //Fast version of divide by 360
|
||||||
|
//#define degreesToUS(degrees) (degrees * (unsigned long)timePerDegree)
|
||||||
|
|
||||||
#define uSToDegrees(time) (((unsigned long)time * currentStatus.RPM) / 166666)
|
#define uSToDegrees(time) (((unsigned long)time * currentStatus.RPM) / 166666)
|
||||||
|
//#define uSToDegrees(time) ( (((uint64_t)time * currentStatus.RPM * 211107077ULL) >> 45) ) //Crazy magic numbers method from Hackers delight (www.hackersdelight.org/magic.htm)
|
||||||
#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) ^ ((d) < 0)) ? (((n) - (d)/2)/(d)) : (((n) + (d)/2)/(d)))
|
#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) ^ ((d) < 0)) ? (((n) - (d)/2)/(d)) : (((n) + (d)/2)/(d)))
|
||||||
|
|
||||||
//This is a dedicated function that specifically handles the case of mapping 0-1023 values into a 0 to X range
|
//This is a dedicated function that specifically handles the case of mapping 0-1023 values into a 0 to X range
|
||||||
|
|
|
@ -37,10 +37,12 @@ uint16_t MAPcurRev; //Tracks which revolution we're sampling on
|
||||||
*/
|
*/
|
||||||
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
|
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
|
||||||
|
|
||||||
void instanteneousMAPReading();
|
static inline void instanteneousMAPReading() __attribute__((always_inline));
|
||||||
void readMAP();
|
static inline void readMAP() __attribute__((always_inline));
|
||||||
|
void readTPS();
|
||||||
void flexPulse();
|
void flexPulse();
|
||||||
|
|
||||||
|
|
||||||
#if defined(ANALOG_ISR)
|
#if defined(ANALOG_ISR)
|
||||||
//Analog ISR interrupt routine
|
//Analog ISR interrupt routine
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -48,7 +48,7 @@ void initialiseADC()
|
||||||
MAPrunningValue = 0;
|
MAPrunningValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instanteneousMAPReading()
|
static inline void instanteneousMAPReading()
|
||||||
{
|
{
|
||||||
unsigned int tempReading;
|
unsigned int tempReading;
|
||||||
//Instantaneous MAP readings
|
//Instantaneous MAP readings
|
||||||
|
@ -71,7 +71,7 @@ void instanteneousMAPReading()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void readMAP()
|
static inline void readMAP()
|
||||||
{
|
{
|
||||||
unsigned int tempReading;
|
unsigned int tempReading;
|
||||||
//MAP Sampling system
|
//MAP Sampling system
|
||||||
|
|
|
@ -1339,11 +1339,13 @@ void loop()
|
||||||
ign1EndFunction
|
ign1EndFunction
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(ignition1EndAngle > crankAngle && configPage2.StgCycles == 0)
|
if(ignition1EndAngle > crankAngle && configPage2.StgCycles == 0)
|
||||||
{
|
{
|
||||||
unsigned long uSToEnd = degreesToUS( (ignition1EndAngle - crankAngle) );
|
unsigned long uSToEnd = degreesToUS( (ignition1EndAngle - crankAngle) );
|
||||||
//refreshIgnitionSchedule1( uSToEnd + fixedCrankingOverride );
|
refreshIgnitionSchedule1( uSToEnd + fixedCrankingOverride );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
tempCrankAngle = crankAngle - channel2IgnDegrees;
|
tempCrankAngle = crankAngle - channel2IgnDegrees;
|
||||||
if( tempCrankAngle < 0) { tempCrankAngle += CRANK_ANGLE_MAX_IGN; }
|
if( tempCrankAngle < 0) { tempCrankAngle += CRANK_ANGLE_MAX_IGN; }
|
||||||
|
|
Loading…
Reference in New Issue