From e98f331cdab379f139a6f3f34d910afe3c4c7bf6 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 1 May 2022 23:07:12 -0400 Subject: [PATCH] Technical debt: ENUM_32_BITS #3874 --- firmware/controllers/algo/firing_order.h | 3 +-- firmware/controllers/algo/rusefi_enums.h | 32 ++++++------------------ firmware/integration/rusefi_config.txt | 8 +++--- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/firmware/controllers/algo/firing_order.h b/firmware/controllers/algo/firing_order.h index b8c1258872..232d618894 100644 --- a/firmware/controllers/algo/firing_order.h +++ b/firmware/controllers/algo/firing_order.h @@ -14,7 +14,7 @@ /** * thank you https://www.ingenieriaymecanicaautomotriz.com/firing-order-its-purpose-and-order-in-different-numbers-of-cylinders/ */ -typedef enum { +typedef enum __attribute__ ((__packed__)) { FO_1 = 0, // 2 cylinder @@ -80,5 +80,4 @@ typedef enum { // next value to use: 32 - Force_4b_firing_order = ENUM_32_BITS, } firing_order_e; diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 40509d0fb6..c0a2f313cd 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -164,18 +164,6 @@ typedef enum __attribute__ ((__packed__)) { } tle8888_mode_e; - -typedef enum { - LF_NATIVE = 0, - /** - * http://www.efianalytics.com/MegaLogViewer/ - * log example: http://svn.code.sf.net/p/rusefi/code/trunk/misc/ms_logs/ - */ - LM_MLV = 1, - - Force_4_bytes_size_log_format = ENUM_32_BITS, -} log_format_e; - typedef enum __attribute__ ((__packed__)) { /** * In auto mode we currently have some pid-like-but-not really PID logic which is trying @@ -325,17 +313,17 @@ typedef enum __attribute__ ((__packed__)) { SPI_DEVICE_4 = 4, } spi_device_e; -typedef enum { +typedef enum __attribute__ ((__packed__)) { BMW_e46 = 0, W202 = 1, - Force_4_bytes_size_can_vss_nbc_e = ENUM_32_BITS, + } can_vss_nbc_e; /** * inertia measurement unit, yawn accelerometer * By the way both kinds of BOSCH use Housing : TE 1-967640-1, pins 144969-1 seal 967056-1 plug 967067-2 */ -typedef enum __attribute__ ((__packed__)) { +typedef enum __attribute__ ((__packed__)) { IMU_NONE = 0, IMU_VAG = 1, /** @@ -530,30 +518,26 @@ typedef enum { FAILED = 128 } PidAutoTune_AutoTunerState; -typedef enum { +typedef enum __attribute__ ((__packed__)) { INIT = 0, TPS_THRESHOLD = 1, RPM_DEAD_ZONE = 2, PID_VALUE = 4, PID_UPPER = 16, BLIP = 64, - /** - * Live Docs reads 4 byte value so we want 4 byte enum - */ - Force_4bytes_size_idle_state_e = ENUM_32_BITS, + } idle_state_e; -typedef enum { +typedef enum __attribute__ ((__packed__)) { OPEN_LOOP = 0, CLOSED_LOOP = 1, - Force_4bytes_size_boostType_e = ENUM_32_BITS, + } boostType_e; -typedef enum { +typedef enum __attribute__ ((__packed__)) { SWITCH_INPUT_LAUNCH = 0, CLUTCH_INPUT_LAUNCH = 1, ALWAYS_ACTIVE_LAUNCH = 2, - Force_4bytes_size_launchActivationMode_e = ENUM_32_BITS, } launchActivationMode_e; typedef enum __attribute__ ((__packed__)) { diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 2f3bcd9701..71bf00e5b2 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -519,7 +519,7 @@ uint32_t cylindersCount;Number of cylinder the engine has.;"", 1, 0, 1, @@MAX_CY ! 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", "1-6-5-4-3-2", "1-4-5-2-3-6", "fo32", "fo33", "fo34", "fo35", "fo36", "fo37" +custom firing_order_e 1 bits, U08, @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 @@ -952,12 +952,12 @@ bit verboseCan2,"Print all","Do not print";Print incoming and outgoing second bu switch_input_pin_e launchActivatePin; pid_s boostPid; - custom boostType_e 4 bits, U32, @OFFSET@, [0:0], "Open Loop", "Closed Loop" + custom boostType_e 1 bits, U08, @OFFSET@, [0:0], "Open Loop", "Closed Loop" boostType_e boostType; int boostPwmFrequency;;"Hz", 1, 0, 0, 3000, 0 #define launchActivationMode_e_enum "Launch Button", "Clutch Down Switch", "Always Active(Disabled By Speed)", "INVALID" - custom launchActivationMode_e 4 bits, S32, @OFFSET@, [0:1], @@launchActivationMode_e_enum@@ + custom launchActivationMode_e 1 bits, S08, @OFFSET@, [0:1], @@launchActivationMode_e_enum@@ launchActivationMode_e launchActivationMode; #define antiLagActivationMode_e_enum "Always Active", "Switch Input" @@ -1446,7 +1446,7 @@ tChargeMode_e tChargeMode; uint8_t[IAC_PID_MULT_SIZE] iacPidMultLoadBins;;"Load", 1, 0, 0, 500, 2 uint8_t[IAC_PID_MULT_SIZE] autoscale iacPidMultRpmBins;;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 12000, 0 - custom can_vss_nbc_e 4 bits, U32, @OFFSET@, [0:0], "BMW_e46", "W202" + custom can_vss_nbc_e 1 bits, U08, @OFFSET@, [0:0], "BMW_e46", "W202" can_vss_nbc_e canVssNbcType;set can_vss X gppwm_channel[GPPWM_CHANNELS iterate] gppwm;