Revert fastMap usage

This commit is contained in:
Josh Stewart 2015-01-30 23:51:01 +11:00
parent 965b6d89eb
commit 9c920f060b
3 changed files with 5 additions and 4 deletions

View File

@ -72,7 +72,7 @@ byte correctionAccel()
if( BIT_CHECK(currentStatus.engine, BIT_ENGINE_ACC) )
{
//If it is currently running, check whether it should still be running or whether it's reached it's end time
if( micros() >= currentStatus.TAEEndTime )
if( currentLoopTime >= currentStatus.TAEEndTime )
{
//Time to turn enrichment off
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ACC);

1
math.h
View File

@ -7,6 +7,7 @@ int fastMap(int x, int in_min, int in_max, int out_min, int out_max)
/*
The following are all fast versions of specific divisions
Ref: http://www.hackersdelight.org/divcMore.pdf
*/
//Unsigned divide by 10

View File

@ -269,8 +269,8 @@ void loop()
//-----------------------------------------------------------------------------------------------------
currentStatus.TPSlast = currentStatus.TPS;
currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value
currentStatus.tpsADC = fastMap(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
currentStatus.TPS = fastMap(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
currentStatus.tpsADC = map(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
//The IAT and CLT readings can be done less frequently. This still runs about 4 times per second
if ((mainLoopCount & 255) == 1)
@ -294,7 +294,7 @@ void loop()
if(currentStatus.RPM > ((unsigned int)configPage2.crankRPM * 100)) //Crank RPM stored in byte as RPM / 100
{ //Sets the engine running bit, clears the engine cranking bit
BIT_SET(currentStatus.engine, BIT_ENGINE_RUN);
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_CRANK);
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_CRANK);
}
else
{ //Sets the engine cranking bit, clears the engine running bit