diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index a8b31531f0..a100731afc 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1776,7 +1776,7 @@ typedef enum { CUSTOM_OBD_78 = 6078, CUSTOM_OBD_79 = 6079, - CUSTOM_OBD_80 = 6080, + CUSTOM_OBD_TRIGGER_SHAPE = 6080, CUSTOM_OBD_81 = 6081, CUSTOM_OBD_82 = 6082, CUSTOM_OBD_83 = 6083, @@ -1845,7 +1845,7 @@ typedef enum { CUSTOM_ERR_TOO_FEW_EVENTS = 6140, CUSTOM_ERR_FLASH_CRC_FAILED = 6141, CUSTOM_ERR_NOT_INPUT_PIN = 6142, - CUSTOM_ERR_6143 = 6143, + CUSTOM_ERR_SKIPPED_TOOTH_SHAPE = 6143, CUSTOM_ERR_6144 = 6144, CUSTOM_ERR_6145 = 6145, CUSTOM_ERR_6146 = 6146, diff --git a/firmware/controllers/trigger/decoders/trigger_universal.cpp b/firmware/controllers/trigger/decoders/trigger_universal.cpp index 2b24cb701f..667277b476 100644 --- a/firmware/controllers/trigger/decoders/trigger_universal.cpp +++ b/firmware/controllers/trigger/decoders/trigger_universal.cpp @@ -31,9 +31,11 @@ void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int to void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode DECLARE_ENGINE_PARAMETER_S) { if (totalTeethCount <= 0) { - firmwareError(CUSTOM_ERR_6143, "totalTeethCount is zero or less: %d", totalTeethCount); + warning(CUSTOM_OBD_TRIGGER_SHAPE, "totalTeethCount is zero or less: %d", totalTeethCount); + s->shapeDefinitionError = true; return; } + s->shapeDefinitionError = false; efiAssertVoid(s != NULL, "TriggerShape is NULL"); s->initialize(operationMode, false); diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 84540d71f6..863d22dcb4 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -627,6 +627,11 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, state->reset(); + if (shape->shapeDefinitionError) { + state->triggerDefinitionError = true; + return 0; + } + // todo: should this variable be declared 'static' to reduce stack usage? TriggerStimulatorHelper helper; diff --git a/firmware/controllers/trigger/trigger_simulator.cpp b/firmware/controllers/trigger/trigger_simulator.cpp index d83495e6a1..113510946a 100644 --- a/firmware/controllers/trigger/trigger_simulator.cpp +++ b/firmware/controllers/trigger/trigger_simulator.cpp @@ -62,7 +62,7 @@ void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(uint32_t index, nextStep(state, shape, i, triggerConfig PASS_ENGINE_PARAMETER); } if (state->getTotalRevolutionCounter() != 3) { - warning(CUSTOM_OBD_80, "sync failed/wrong gap parameters trigger=%s", getTrigger_type_e(engineConfiguration->trigger.type)); + warning(CUSTOM_OBD_TRIGGER_SHAPE, "sync failed/wrong gap parameters trigger=%s", getTrigger_type_e(engineConfiguration->trigger.type)); state->triggerDefinitionError = true; return; }