Sanity check on RPM calc

This commit is contained in:
Josh Stewart 2016-04-01 08:54:58 +11:00
parent 07aed4cf49
commit f78f2ae268
2 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,9 @@ inline int stdGetRPM()
noInterrupts();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
int tempRPM = (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
if(tempRPM >= MAX_RPM) { return currentStatus.RPM; } //Sanity check
return tempRPM;
}
/*
@ -496,7 +498,7 @@ int getCrankAngle_4G63(int timePerDegree)
}
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Name: GM 24X
Name: GM
Desc: TBA
Note: Useful references:
http://www.vems.hu/wiki/index.php?page=MembersPage%2FJorgenKarlsson%2FTwentyFourX

View File

@ -52,7 +52,7 @@ struct config3 configPage3;
struct config4 configPage4;
int req_fuel_uS, inj_opentime_uS;
#define MAX_RPM 15000 //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 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
volatile byte startRevolutions = 0; //A counter for how many revolutions have been completed since sync was achieved.
volatile byte ign1LastRev;