Skip to content

Commit

Permalink
Implement Cranking to Running Adv.Angle Interpolation for faster start (
Browse files Browse the repository at this point in the history
rusefi#506)

* Implement Cranking to Running Adv.Angle Interpolation for faster start

* Reduce code dup. and rename minRpm

* fix
  • Loading branch information
andreika-git authored and rusefi committed Dec 3, 2017
1 parent 0d3bed0 commit 6290bef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion firmware/controllers/algo/advance_map.cpp
Expand Up @@ -33,6 +33,8 @@ extern TunerStudioOutputChannels tsOutputChannels;
static ign_Map3D_t advanceMap("advance");
static ign_Map3D_t iatAdvanceCorrectionMap("iat corr");

static int minCrankingRpm = 0;

static const float iatTimingRpmBins[IGN_LOAD_COUNT] = {880, 1260, 1640, 2020, 2400, 2780, 3000, 3380, 3760, 4140, 4520, 5000, 5700, 6500, 7200, 8000};

//880 1260 1640 2020 2400 2780 3000 3380 3760 4140 4520 5000 5700 6500 7200 8000
Expand Down Expand Up @@ -65,6 +67,7 @@ bool isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIG(timingMode) == TM_FIXED)
return engineConfiguration->fixedTiming;

engine->m.beforeAdvance = GET_TIMESTAMP();
if (cisnan(engineLoad)) {
warning(CUSTOM_NAN_ENGINE_LOAD, "NaN engine load");
Expand Down Expand Up @@ -106,7 +109,12 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle_t angle;
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
angle = engineConfiguration->crankingTimingAngle;
// Interpolate the cranking timing angle to the earlier running angle for faster engine start
angle_t crankingToRunningTransitionAngle = getRunningAdvance(CONFIG(cranking.rpm), engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
// interpolate not from zero, but starting from min. possible rpm detected
if (rpm < minCrankingRpm || minCrankingRpm == 0)
minCrankingRpm = rpm;
angle = interpolateClamped(minCrankingRpm, engineConfiguration->crankingTimingAngle, CONFIG(cranking.rpm), crankingToRunningTransitionAngle, rpm);
} else {
angle = getRunningAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
}
Expand Down

0 comments on commit 6290bef

Please sign in to comment.