better state validation

This commit is contained in:
rusefi 2017-05-03 18:08:04 -04:00
parent 16c98a50ed
commit fed67399d2
2 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ current binaries are always available at http://rusefi.com/build_server/
| Release date | Revision | Details |
| ------------ | --------- | ------- |
| 05/03/2017 | r13967 | improvement: ChibiOS 3.2 |
| 04/06/2017 | r13759 | major improvement #72: ChibiOS 3.1 |
| 03/26/2017 | r13330 | super annoying bug #336 fixed |
| 03/20/2017 | r13233 | improvements #375 & #376: hard FPU mode & migrating to fresh version of arm gcc |

View File

@ -53,6 +53,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
engine->engineCycleEventCount = getLength();
float firstAngle = getAngle(triggerShapeSynchPointIndex);
assertAngleRange(triggerShapeSynchPointIndex, "firstAngle");
int frontOnlyIndex = 0;
@ -64,6 +65,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
eventAngles[1] = 0;
frontOnlyIndexes[0] = 0;
} else {
assertAngleRange(triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex");
int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
efiAssertVoid(engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;