From c4ff0cd19d9b2dc0ecd29a2bdd3f9b77e598f7df Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 18 Sep 2021 00:18:06 -0400 Subject: [PATCH] more firing orders! --- firmware/controllers/algo/firing_order.h | 21 +++++++++++++++------ firmware/controllers/math/engine_math.cpp | 8 ++++++++ firmware/integration/rusefi_config.txt | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/firmware/controllers/algo/firing_order.h b/firmware/controllers/algo/firing_order.h index 1c837832e4..8cb681fa64 100644 --- a/firmware/controllers/algo/firing_order.h +++ b/firmware/controllers/algo/firing_order.h @@ -11,6 +11,9 @@ #pragma once +/** + * thank you https://www.ingenieriaymecanicaautomotriz.com/firing-order-its-purpose-and-order-in-different-numbers-of-cylinders/ + */ typedef enum { FO_1 = 0, @@ -31,15 +34,18 @@ typedef enum { FO_1_2_4_5_3 = 6, // 6 cylinder - FO_1_5_3_6_2_4 = 4, // VAG VR6 - FO_1_4_2_5_3_6 = 7, - FO_1_2_3_4_5_6 = 9, // all Nissan v6 + FO_1_5_3_6_2_4 = 4, // VAG VR6, Straight-6, Opel Omega A + FO_1_6_5_4_3_2 = 30, // GM 3800 engine + FO_1_4_5_2_3_6 = 31, // Chevrolet Corvair + FO_1_4_2_5_3_6 = 7, // Mercedes-Benz M104 engine + FO_1_2_3_4_5_6 = 9, // all Nissan v6, GM 60-Degree V6 engine FO_1_6_3_2_5_4 = 13, // EG33 FO_1_4_3_6_2_5 = 27, // VAG v6 different from VAG VR6 FO_1_6_2_4_3_5 = 29, // Some 911 // todo: one day we shall support 7 cylinder radial, probably not before one actually approaches us + // 1-3-5-7-2-4-6 7-cylinder single row radial engine // 8 cylinder FO_1_8_4_3_6_5_7_2 = 5, @@ -57,11 +63,14 @@ typedef enum { // 10 cylinder FO_1_10_9_4_3_6_5_8_7_2 = 14, // dodge and viper ram v10 + // 1-6-5-10-2-7-3-8-4-9 BMW S85 // 12 cylinder - FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 & M73 etc - FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // lamborghini, typical rusEfi use-case + FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 & M73, Ferrari 456M GT V12 + FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // Lamborghini Diablo VT, typical rusEfi use-case FO_1_12_5_8_3_10_6_7_2_11_4_9 = 18, // VAG W12 + // 1,12,7,6,3,10,11,2,5,8,9,4 Rolls-Royce Merlin + // 1,12,4,9,2,11,6,7,3,10,5,8 Lamborghini Aventador FO_1_2_3_4_5_6_7_8_9_10_11_12 = 23, // mostly for hardware testing purposes @@ -69,7 +78,7 @@ typedef enum { // unfortunately not supported by default firmware because MAX_CYLINDER_COUNT=12 by default FO_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10 = 22, // WR16 - // next value to use: 30 + // next value to use: 32 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 c1c8425e96..102f085041 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -130,6 +130,8 @@ static const int order_1_THEN_2_THEN_3_THEN_4_THEN_5_THEN_6[] = { 1, 2, 3, 4, 5, static const int order_1_6_3_2_5_4[] = {1, 6, 3, 2, 5, 4}; static const int order_1_4_3_6_2_5[] = {1, 4, 3, 6, 2, 5}; static const int order_1_6_2_4_3_5[] = {1, 6, 2, 4, 3, 5}; +static const int order_1_6_5_4_3_2[] = {1, 6, 5, 4, 3, 2}; +static const int order_1_4_5_2_3_6[] = {1, 4, 5, 2, 3, 6}; // 8 cylinder static const int order_1_8_4_3_6_5_7_2[] = { 1, 8, 4, 3, 6, 5, 7, 2 }; @@ -185,6 +187,8 @@ static int getFiringOrderLength(DECLARE_ENGINE_PARAMETER_SIGNATURE) { case FO_1_6_3_2_5_4: case FO_1_4_3_6_2_5: case FO_1_6_2_4_3_5: + case FO_1_6_5_4_3_2: + case FO_1_4_5_2_3_6: return 6; // 8 cylinder @@ -261,6 +265,10 @@ static const int *getFiringOrderTable(DECLARE_ENGINE_PARAMETER_SIGNATURE) return order_1_4_3_6_2_5; case FO_1_6_2_4_3_5: return order_1_6_2_4_3_5; + case FO_1_6_5_4_3_2: + return order_1_6_5_4_3_2; + case FO_1_4_5_2_3_6: + return order_1_4_5_2_3_6; // 8 cylinder case FO_1_8_4_3_6_5_7_2: diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 3821d2be6a..bcd9c4f422 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -628,7 +628,7 @@ uint32_t cylindersCount;;"", 1, 0, 1, @@MAX_CYLINDER_COUNT@@, 0 ! 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:5], "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", "1-2-3-4-5-6-7-8", "1-5-4-8-6-3-7-2", "1-4-3-6-2-5", "1-8-7-3-6-5-4-2", "1-6-2-4-3-5", "fo30", "fo31", "fo32", "fo33" +custom firing_order_e 4 bits, U32, @OFFSET@, [0:5], "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", "1-2-3-4-5-6-7-8", "1-5-4-8-6-3-7-2", "1-4-3-6-2-5", "1-8-7-3-6-5-4-2", "1-6-2-4-3-5", "1-6-5-4-3-2", "1-4-5-2-3-6", "fo32", "fo33", "fo34", "fo35", "fo36", "fo37" firing_order_e firingOrder; end_struct