diff --git a/corrections.ino b/corrections.ino index 2aa21a32..7a7e659e 100644 --- a/corrections.ino +++ b/corrections.ino @@ -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); diff --git a/math.h b/math.h index 0ccee976..d0591c27 100644 --- a/math.h +++ b/math.h @@ -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 diff --git a/speeduino.ino b/speeduino.ino index 0e47a140..bc604dc8 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -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