From 0f486242dc851bc0d3871d38a394ee275238a4f6 Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 24 Jul 2018 20:22:16 -0400 Subject: [PATCH] docs & constraint --- firmware/controllers/algo/engine.cpp | 4 ++-- firmware/controllers/algo/engine.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 15394cf410..494d30a805 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -184,7 +184,7 @@ TransmissionState::TransmissionState() { } EngineState::EngineState() { - dwellAngle = 0; + dwellAngle = NAN; engineNoiseHipLevel = 0; injectorLag = 0; warningCounter = 0; @@ -231,7 +231,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { int rpm = ENGINE(rpmCalculator).getRpm(PASS_ENGINE_PARAMETER_SIGNATURE); sparkDwell = getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX); - dwellAngle = sparkDwell / getOneDegreeTimeMs(rpm); + dwellAngle = cisnan(rpm) ? NAN : sparkDwell / getOneDegreeTimeMs(rpm); if (hasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) { engine->sensors.currentAfr = getAfr(PASS_ENGINE_PARAMETER_SIGNATURE); } diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 28567bb09f..129f6b71b1 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -166,6 +166,7 @@ public: /** * ignition dwell duration as crankshaft angle + * NAN if engine is stopped */ angle_t dwellAngle;