From adf6b99b388c8af5095def8ff770e01debe9e7de Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 2 Dec 2017 18:58:27 -0500 Subject: [PATCH] better state validation --- firmware/controllers/math/engine_math.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index a92b0f162e..ad0b87c747 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -287,8 +287,10 @@ int TriggerShape::findAngleIndex(float target DECLARE_ENGINE_PARAMETER_SUFFIX) { } void TriggerShape::findTriggerPosition(event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_SUFFIX) { + efiAssertVoid(!cisnan(angleOffset), "findAngle#1"); // convert engine cycle angle into trigger cycle angle angleOffset += tdcPosition(); + efiAssertVoid(!cisnan(angleOffset), "findAngle#2"); fixAngle(angleOffset, "addFuel#2"); int index = triggerIndexByAngle[(int)angleOffset];