diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index 2ea3605d5a..d91961296e 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -101,7 +101,7 @@ 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 (isCrankingR(rpm)) { + if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { angle = engineConfiguration->crankingTimingAngle; } else { if (CONFIG(timingMode) == TM_DYNAMIC) { diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 5fd76e7ad1..05c60dcfcd 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -62,12 +62,12 @@ RpmCalculator::RpmCalculator() { oneDegreeUs = NAN; } -bool RpmCalculator::isStopped() { +bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) { return false; } -bool RpmCalculator::isCranking() { - return false; +bool RpmCalculator::isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) { + return ((rpmValue) > 0 && (rpmValue) < CONFIG(cranking.rpm)); } //bool RpmCalculator::isRunning() { @@ -80,8 +80,7 @@ bool RpmCalculator::isCranking() { bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) { efitick_t nowNt = getTimeNowNt(); if (ENGINE(stopEngineRequestTimeNt) != 0) { - if (nowNt - - ENGINE(stopEngineRequestTimeNt)< 3 * US2NT(US_PER_SECOND_LL)) { + if (nowNt - ENGINE(stopEngineRequestTimeNt) < 3 * US2NT(US_PER_SECOND_LL)) { return false; } } diff --git a/firmware/controllers/trigger/rpm_calculator.h b/firmware/controllers/trigger/rpm_calculator.h index 084ac7c3e3..d904a75755 100644 --- a/firmware/controllers/trigger/rpm_calculator.h +++ b/firmware/controllers/trigger/rpm_calculator.h @@ -57,11 +57,11 @@ public: /** * Returns true if the engine is not spinning (RPM==0) */ - bool isStopped(); + bool isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE); /** * Returns true if the engine is cranking */ - bool isCranking(); + bool isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE); /** * Returns true if the engine is running and not cranking */