Skip to content

Commit

Permalink
Fix useSeparateAdvanceForIdle now using corrections (rusefi#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreika-git authored and rusefi committed Jan 3, 2018
1 parent 0cc9955 commit e33f9db
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions firmware/controllers/algo/advance_map.cpp
Expand Up @@ -97,21 +97,23 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
#endif
}

float result = advanceMap.getValue((float) rpm, engineLoad)
+ iatCorrection
+ engine->fsioTimingAdjustment
+ engine->engineState.cltTimingCorrection
// todo: uncomment once we get useable knock - engine->knockCount
;
float advanceAngle = advanceMap.getValue((float) rpm, engineLoad);

// 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);
advanceAngle = interpolateClamped(0.0f, idleAdvance, boardConfiguration->idlePidDeactivationTpsThreshold, advanceAngle, tps);
}

float result = advanceAngle
+ iatCorrection
+ engine->fsioTimingAdjustment
+ engine->engineState.cltTimingCorrection
// todo: uncomment once we get useable knock - engine->knockCount
;

engine->m.advanceLookupTime = GET_TIMESTAMP() - engine->m.beforeAdvance;
return result;
}
Expand Down

0 comments on commit e33f9db

Please sign in to comment.