Impl. useSeparateVeForIdle/useSeparateAdvanceForIdle (#522)

This commit is contained in:
andreika-git 2017-12-23 19:24:20 +02:00 committed by rusefi
parent fc818cf156
commit d6dd4fb3f3
2 changed files with 18 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include "interpolation.h"
#include "efilib2.h"
#include "engine_math.h"
#include "tps.h"
EXTERN_ENGINE;
@ -102,6 +103,15 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
+ engine->engineState.cltTimingCorrection
// todo: uncomment once we get useable knock - engine->knockCount
;
// get advance from the separate table for Idle
if (CONFIG(useSeparateAdvanceForIdle)) {
float idleAdvance = interpolate2d("idleAdvance", rpm, config->idleAdvanceBins, config->idleAdvance, IDLE_ADVANCE_CURVE_SIZE);
// interpolate between idle table and normal (running) table using TPS threshold
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
result = interpolateClamped(0.0f, idleAdvance, boardConfiguration->idlePidDeactivationTpsThreshold, result, tps);
}
engine->m.advanceLookupTime = GET_TIMESTAMP() - engine->m.beforeAdvance;
return result;
}

View File

@ -262,7 +262,14 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/**
* *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/
*/
currentVE = baroCorrection * veMap.getValue(rpm, map) * 0.01;
float rawVe = veMap.getValue(rpm, map);
// get VE from the separate table for Idle
if (CONFIG(useSeparateVeForIdle)) {
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe, IDLE_VE_CURVE_SIZE);
// interpolate between idle table and normal (running) table using TPS threshold
rawVe = interpolateClamped(0.0f, idleVe, boardConfiguration->idlePidDeactivationTpsThreshold, rawVe, tps);
}
currentVE = baroCorrection * rawVe * 0.01;
targetAFR = afrMap.getValue(rpm, map);
} else {
baseTableFuel = getBaseTableFuel(rpm, engineLoad);