From cddb46967827a4041fe1e203593d423924808843 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 26 Jun 2020 06:07:43 -0700 Subject: [PATCH] support 1-3-2 firing order (#1537) * support 1-3-2 * oops * correct TS Co-authored-by: Matthew Kennedy --- firmware/controllers/algo/firing_order.h | 3 ++- firmware/controllers/math/engine_math.cpp | 4 ++++ firmware/integration/rusefi_config.txt | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/algo/firing_order.h b/firmware/controllers/algo/firing_order.h index 136e64809f..51fe262d27 100644 --- a/firmware/controllers/algo/firing_order.h +++ b/firmware/controllers/algo/firing_order.h @@ -19,6 +19,7 @@ typedef enum { // 3 cylinder FO_1_2_3 = 10, + FO_1_3_2 = 24, // 4 cylinder FO_1_3_4_2 = 1, // typical inline 4 @@ -62,7 +63,7 @@ typedef enum { // unfortunately not supported by default firmware because INJECTION_PIN_COUNT=IGNITION_PIN_COUNT=12 by default FO_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10 = 22, // WR16 - // max used = 23 + // max used = 24 Force_4b_firing_order = ENUM_32_BITS, } firing_order_e; diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index 26d52bc49c..de2305add5 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -269,6 +269,7 @@ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { static const int order_1_2[] = {1, 2}; static const int order_1_2_3[] = {1, 2, 3}; +static const int order_1_3_2[] = {1, 3, 2}; // 4 cylinder static const int order_1_THEN_3_THEN_4_THEN2[] = { 1, 3, 4, 2 }; @@ -317,6 +318,7 @@ static int getFiringOrderLength(DECLARE_ENGINE_PARAMETER_SIGNATURE) { return 2; // 3 cylinder case FO_1_2_3: + case FO_1_3_2: return 3; // 4 cylinder case FO_1_3_4_2: @@ -401,6 +403,8 @@ int getCylinderId(int index DECLARE_ENGINE_PARAMETER_SUFFIX) { // 3 cylinder case FO_1_2_3: return order_1_2_3[index]; + case FO_1_3_2: + return order_1_3_2[index]; // 4 cylinder case FO_1_3_4_2: return order_1_THEN_3_THEN_4_THEN2[index]; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 32432a1ccc..88f49722c3 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -451,7 +451,7 @@ cylinders_count_t cylindersCount; ! FO_1_8_4_3_6_5_7_2 = 5 ! FO_1_2_4_5_3 = 6 -custom firing_order_e 4 bits, U32, @OFFSET@, [0:4], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "1-2-4-5-3", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "1-8-7-2-6-5-4-3", "1-5-4-2-6-3-7-8", "1-6-3-2-5-4", "1-10-9-4-3-6-5-8-7_2", "1-7-5-11-3-9-6-12-2-8-4-10", "1-7-4-10-2-8-6-12-3-9-5-11", "1-4-3-2", "1-12-5-8-3-10-6-7-2-11-4-9", "1-2-7-8-4-5-6-3", "1-3-7-2-6-5-4-8", "1-2-3-4-5-6-7-8-9", "fo22", "fo23", "fo24", "fo25", "INVALID" +custom firing_order_e 4 bits, U32, @OFFSET@, [0:4], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "1-2-4-5-3", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "1-8-7-2-6-5-4-3", "1-5-4-2-6-3-7-8", "1-6-3-2-5-4", "1-10-9-4-3-6-5-8-7_2", "1-7-5-11-3-9-6-12-2-8-4-10", "1-7-4-10-2-8-6-12-3-9-5-11", "1-4-3-2", "1-12-5-8-3-10-6-7-2-11-4-9", "1-2-7-8-4-5-6-3", "1-3-7-2-6-5-4-8", "1-2-3-4-5-6-7-8-9", "INVALID", "1-2-3-4-5-6-7-8-9-10-11-12", "1-3-2", "INVALID", "INVALID" firing_order_e firingOrder; end_struct