better state validation

This commit is contained in:
rusefi 2017-12-02 18:58:27 -05:00
parent 06e522a4f0
commit adf6b99b38
1 changed files with 2 additions and 0 deletions

View File

@ -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];