Merge branch 'master' of https://github.com/noisymime/speeduino
This commit is contained in:
commit
2cda68277b
|
@ -5,6 +5,8 @@ All functions in the gamma file return
|
|||
#ifndef CORRECTIONS_H
|
||||
#define CORRECTIONS_H
|
||||
|
||||
#define IGN_IDLE_THRESHOLD 200 //RPM threshold (below CL idle target) for when ign based idle control will engage
|
||||
|
||||
void initialiseCorrections();
|
||||
|
||||
uint16_t correctionsFuel();
|
||||
|
|
|
@ -43,6 +43,7 @@ int TPS_rateOfChange;
|
|||
byte activateMAPDOT; //The mapDOT value seen when the MAE was activated.
|
||||
byte activateTPSDOT; //The tpsDOT value seen when the MAE was activated.
|
||||
|
||||
bool idleAdvActive = false;
|
||||
uint16_t AFRnextCycle;
|
||||
unsigned long knockStartTime;
|
||||
byte lastKnockCount;
|
||||
|
@ -821,7 +822,7 @@ int8_t correctionIdleAdvance(int8_t advance)
|
|||
|
||||
int8_t ignIdleValue = advance;
|
||||
//Adjust the advance based on idle target rpm.
|
||||
if( (configPage2.idleAdvEnabled >= 1) && (runSecsX10 >= (configPage2.idleAdvDelay * 5)) )
|
||||
if( (configPage2.idleAdvEnabled >= 1) && (runSecsX10 >= (configPage2.idleAdvDelay * 5)) && idleAdvActive)
|
||||
{
|
||||
currentStatus.CLIdleTarget = (byte)table2D_getValue(&idleTargetTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET); //All temps are offset by 40 degrees
|
||||
int idleRPMdelta = (currentStatus.CLIdleTarget - (currentStatus.RPM / 10) ) + 50;
|
||||
|
@ -844,6 +845,10 @@ int8_t correctionIdleAdvance(int8_t advance)
|
|||
}
|
||||
else { idleAdvTaper = 0; }
|
||||
}
|
||||
|
||||
if ( !idleAdvActive && BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN) && (currentStatus.RPM > (((uint16_t)currentStatus.CLIdleTarget * 10) - (uint16_t)IGN_IDLE_THRESHOLD)) ) { idleAdvActive = true; } //Active only after the engine is 200 RPM below target on first time
|
||||
else if (idleAdvActive && !BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) { idleAdvActive = false; } //Clear flag if engine isn't running anymore
|
||||
|
||||
return ignIdleValue;
|
||||
}
|
||||
/** Ignition soft revlimit correction.
|
||||
|
|
|
@ -583,7 +583,6 @@ extern volatile bool fpPrimed; //Tracks whether or not the fuel pump priming has
|
|||
extern volatile bool injPrimed; //Tracks whether or not the injector priming has been completed yet
|
||||
extern volatile unsigned int toothHistoryIndex;
|
||||
extern unsigned long currentLoopTime; /**< The time (in uS) that the current mainloop started */
|
||||
extern unsigned long previousLoopTime; /**< The time (in uS) that the previous mainloop started */
|
||||
extern volatile uint16_t ignitionCount; /**< The count of ignition events that have taken place since the engine started */
|
||||
//The below shouldn't be needed and probably should be cleaned up, but the Atmel SAM (ARM) boards use a specific type for the trigger edge values rather than a simple byte/int
|
||||
#if defined(CORE_SAMD21)
|
||||
|
|
|
@ -139,7 +139,6 @@ volatile bool fpPrimed = false; ///< Tracks whether or not the fuel pump priming
|
|||
volatile bool injPrimed = false; ///< Tracks whether or not the injectors priming has been completed yet
|
||||
volatile unsigned int toothHistoryIndex = 0; ///< Current index to @ref toothHistory array
|
||||
unsigned long currentLoopTime; /**< The time (in uS) that the current mainloop started */
|
||||
unsigned long previousLoopTime; /**< The time (in uS) that the previous mainloop started */
|
||||
volatile uint16_t ignitionCount; /**< The count of ignition events that have taken place since the engine started */
|
||||
#if defined(CORE_SAMD21)
|
||||
PinStatus primaryTriggerEdge;
|
||||
|
|
|
@ -429,7 +429,6 @@ void initialiseAll()
|
|||
}
|
||||
|
||||
//Initial values for loop times
|
||||
previousLoopTime = 0;
|
||||
currentLoopTime = micros_safe();
|
||||
mainLoopCount = 0;
|
||||
|
||||
|
|
|
@ -182,7 +182,6 @@ void loop()
|
|||
//Displays currently disabled
|
||||
// if (configPage2.displayType && (mainLoopCount & 255) == 1) { updateDisplay();}
|
||||
|
||||
previousLoopTime = currentLoopTime;
|
||||
currentLoopTime = micros_safe();
|
||||
unsigned long timeToLastTooth = (currentLoopTime - toothLastToothTime);
|
||||
if ( (timeToLastTooth < MAX_STALL_TIME) || (toothLastToothTime > currentLoopTime) ) //Check how long ago the last tooth was seen compared to now. If it was more than half a second ago then the engine is probably stopped. toothLastToothTime can be greater than currentLoopTime if a pulse occurs between getting the latest time and doing the comparison
|
||||
|
|
Loading…
Reference in New Issue