diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index d76eeb7766..0e6713fb2f 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -52,7 +52,14 @@ static const ignition_table_t defaultIatTiming = { {-4.4, -4.9, -5.9, -5.9, -5.9, -5.9, -4.9, -4.9, -4.9, -4.9, -4.9, -3.9, -3.9, -3.9, -3.9, -3.9}, }; -float getBaseAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) { +bool_t isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_S) { + return boardConfiguration->enabledStep1Limiter && rpm >= engineConfiguration->step1rpm; +} + +/** + * @return ignition timing angle advance before TDC + */ +static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) { engine->m.beforeAdvance = GET_TIMESTAMP(); if (cisnan(engineLoad)) { warning(OBD_PCM_Processor_Fault, "NaN engine load"); @@ -63,6 +70,10 @@ float getBaseAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) { engine->m.beforeZeroTest = GET_TIMESTAMP(); engine->m.zeroTestTime = GET_TIMESTAMP() - engine->m.beforeZeroTest; + if (isStep1Condition(rpm PASS_ENGINE_PARAMETER)) { + return engineConfiguration->step1timing; + } + float iatCorrection = iatAdvanceCorrectionMap.getValue(engine->engineState.clt, (float) rpm); float result = advanceMap.getValue(engineLoad, (float) rpm) + iatCorrection; @@ -75,7 +86,7 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) { if (isCrankingR(rpm)) { angle = engineConfiguration->crankingTimingAngle; } else { - angle = getBaseAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER); + angle = getRunningAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER); } angle -= engineConfiguration->ignitionBaseAngle; fixAngle(angle); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index ff34796b3a..457a2ac503 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -291,5 +291,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20150524; + return 20150525; }