diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index b8125fc129..a09b02e331 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1838,11 +1838,11 @@ typedef enum { CUSTOM_ERR_PIN_ALREADY_USED_2 = 6134, CUSTOM_ERR_ICU_STATE = 6135, CUSTOM_ERR_TCHARGE_NOT_READY = 6136, - CUSTOM_ERR_6137 = 6137, + CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG = 6137, CUSTOM_ERR_FUEL_TABLE_NOT_READY = 6138, CUSTOM_ERR_TCHARGE_NOT_READY2 = 6139, - CUSTOM_ERR_6140 = 6140, + CUSTOM_ERR_COMMAND_LOWER_CASE_EXPECTED = 6140, CUSTOM_ERR_FLASH_CRC_FAILED = 6141, CUSTOM_ERR_NOT_INPUT_PIN = 6142, CUSTOM_ERR_SKIPPED_TOOTH_SHAPE = 6143, diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index f3b1a5f6f3..39113a1242 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -50,15 +50,21 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE triggerShapeSynchPointIndex = findTriggerZeroEventIndex(state, this, triggerConfig PASS_ENGINE_PARAMETER); - engine->engineCycleEventCount = getLength(); - efiAssertVoid(engine->engineCycleEventCount > 0, "shapeLength=0"); + int length = getLength(); + engine->engineCycleEventCount = length; + efiAssertVoid(length > 0, "shapeLength=0"); + if (length >= PWM_PHASE_MAX_COUNT) { + warning(CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG, "Count above %d", length); + shapeDefinitionError = true; + return; + } float firstAngle = getAngle(triggerShapeSynchPointIndex); assertAngleRange(triggerShapeSynchPointIndex, "firstAngle"); int frontOnlyIndex = 0; - for (int eventIndex = 0; eventIndex < engine->engineCycleEventCount; eventIndex++) { + for (int eventIndex = 0; eventIndex < length; eventIndex++) { if (eventIndex == 0) { // explicit check for zero to avoid issues where logical zero is not exactly zero due to float nature eventAngles[0] = 0; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 52cbb7f6c8..d52ee26e26 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -251,5 +251,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20170502; + return 20170505; } diff --git a/firmware/util/cli_registry.cpp b/firmware/util/cli_registry.cpp index afd6ea8c2f..222615ebde 100644 --- a/firmware/util/cli_registry.cpp +++ b/firmware/util/cli_registry.cpp @@ -50,7 +50,7 @@ static void doAddAction(const char *token, action_type_e type, Void callback, vo for (int i = 0; i< efiStrlen(token);i++) { char ch = token[i]; if (ch != mytolower(ch)) { - firmwareError(CUSTOM_ERR_6140, "lowerCase expected [%s]", token); + firmwareError(CUSTOM_ERR_COMMAND_LOWER_CASE_EXPECTED, "lowerCase expected [%s]", token); } } current->token = token;