From f296e30fb520a222281edc6e87deb0d5ab10e9ed Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 28 Apr 2023 21:01:08 -0400 Subject: [PATCH] it's going to be painful --- .../boards/cypress/board_configuration.cpp | 6 ++--- .../boards/kinetis/board_configuration.cpp | 6 ++--- .../boards/prometheus/board_configuration.cpp | 6 ++--- .../boards/s105/board_configuration.cpp | 4 +-- .../boards/skeleton/board_configuration.cpp | 4 +-- firmware/config/engines/custom_engine.cpp | 26 +++++++++---------- firmware/config/engines/gm_sbc.cpp | 6 ++--- firmware/config/engines/hyundai.cpp | 6 ++--- firmware/config/engines/m111.cpp | 6 ++--- firmware/config/engines/mazda_miata_1_6.cpp | 10 +++---- firmware/config/engines/mazda_miata_vvt.cpp | 6 ++--- firmware/controllers/bench_test.cpp | 4 +-- .../controllers/engine_cycle/spark_logic.cpp | 18 ++++++------- .../lua/generated/value_lookup_generated.cpp | 8 +++--- firmware/controllers/math/engine_math.cpp | 14 +++++----- firmware/controllers/settings.cpp | 6 ++--- 16 files changed, 68 insertions(+), 68 deletions(-) diff --git a/firmware/config/boards/cypress/board_configuration.cpp b/firmware/config/boards/cypress/board_configuration.cpp index 52694242e5..69f2eaf1ae 100644 --- a/firmware/config/boards/cypress/board_configuration.cpp +++ b/firmware/config/boards/cypress/board_configuration.cpp @@ -17,8 +17,8 @@ void setBoardDefaultConfiguration() { setAlgorithm(LM_SPEED_DENSITY); - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; @@ -26,7 +26,7 @@ void setBoardDefaultConfiguration() { engineConfiguration->globalTriggerAngleOffset = 114; // the end of 19th tooth? - engineConfiguration->specs.displacement = 1.645; + engineConfiguration->displacement = 1.645; engineConfiguration->injector.flow = 200; engineConfiguration->cranking.baseFuel = 25; // ??? diff --git a/firmware/config/boards/kinetis/board_configuration.cpp b/firmware/config/boards/kinetis/board_configuration.cpp index ae08a6619d..88653da1e2 100644 --- a/firmware/config/boards/kinetis/board_configuration.cpp +++ b/firmware/config/boards/kinetis/board_configuration.cpp @@ -19,8 +19,8 @@ void setBoardOverrides() { setAlgorithm(LM_SPEED_DENSITY); - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; @@ -28,7 +28,7 @@ void setBoardOverrides() { engineConfiguration->globalTriggerAngleOffset = 114; // the end of 19th tooth? - engineConfiguration->specs.displacement = 1.645; + engineConfiguration->displacement = 1.645; engineConfiguration->injector.flow = 200; engineConfiguration->cranking.baseFuel = 25; // ??? diff --git a/firmware/config/boards/prometheus/board_configuration.cpp b/firmware/config/boards/prometheus/board_configuration.cpp index 0814d16888..0651099d4d 100644 --- a/firmware/config/boards/prometheus/board_configuration.cpp +++ b/firmware/config/boards/prometheus/board_configuration.cpp @@ -19,8 +19,8 @@ static bool is469 = false; static void setPrometheusDefaults() { engineConfiguration->useCicPidForIdle = true; - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; @@ -28,7 +28,7 @@ static void setPrometheusDefaults() { engineConfiguration->globalTriggerAngleOffset = 114; // the end of 19th tooth? - engineConfiguration->specs.displacement = 1.645; + engineConfiguration->displacement = 1.645; engineConfiguration->injector.flow = 200; engineConfiguration->cranking.baseFuel = 25; diff --git a/firmware/config/boards/s105/board_configuration.cpp b/firmware/config/boards/s105/board_configuration.cpp index 1535a06f16..6bf2ee8c51 100644 --- a/firmware/config/boards/s105/board_configuration.cpp +++ b/firmware/config/boards/s105/board_configuration.cpp @@ -49,8 +49,8 @@ void setBoardDefaultConfiguration() { //engineConfiguration->mainRelayPin = ?; engineConfiguration->mainRelayPinMode = OM_OPENDRAIN; - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_2_4_3; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_2_4_3; engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; diff --git a/firmware/config/boards/skeleton/board_configuration.cpp b/firmware/config/boards/skeleton/board_configuration.cpp index efe0d2527e..a4a5e0a8fd 100644 --- a/firmware/config/boards/skeleton/board_configuration.cpp +++ b/firmware/config/boards/skeleton/board_configuration.cpp @@ -184,8 +184,8 @@ void setBoardDefaultConfiguration() { // The "required" hardware is done - set some reasonable input defaults setupDefaultSensorInputs(); - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; // Ign is IM_ONE_COIL, IM_TWO_COILS, IM_INDIVIDUAL_COILS, IM_WASTED_SPARK engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index f96c0eb831..8281df59aa 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -164,7 +164,7 @@ void setFrankensoConfiguration() { /** * We want to initialize all outputs for test */ - engineConfiguration->specs.cylindersCount = 12; + engineConfiguration->cylindersCount = 12; engineConfiguration->displayMode = DM_NONE; #else /* EFI_PWM_TESTER */ @@ -197,8 +197,8 @@ void setFrankensoBoardTestConfiguration() { engineConfiguration->triggerSimulatorFrequency = 300; engineConfiguration->cranking.rpm = 100; - engineConfiguration->specs.cylindersCount = 12; - engineConfiguration->specs.firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10; + engineConfiguration->cylindersCount = 12; + engineConfiguration->firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10; // set ignition_mode 1 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; @@ -374,8 +374,8 @@ void setL9779TestConfiguration() { // todo: remove this? this was used to play with "secret" red boards prior to MRE reality // set engine_type 59 void setTle8888TestConfiguration() { - engineConfiguration->specs.cylindersCount = 8; - engineConfiguration->specs.firingOrder = FO_1_8_7_2_6_5_4_3; + engineConfiguration->cylindersCount = 8; + engineConfiguration->firingOrder = FO_1_8_7_2_6_5_4_3; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL; @@ -506,8 +506,8 @@ static void mreBoardOldTest() { // TPS tps1_1AdcChannel EFI_ADC_13 - engineConfiguration->specs.cylindersCount = 10; - engineConfiguration->specs.firingOrder = FO_1_10_9_4_3_6_5_8_7_2; + engineConfiguration->cylindersCount = 10; + engineConfiguration->firingOrder = FO_1_10_9_4_3_6_5_8_7_2; // red LED #1 engineConfiguration->ignitionPins[1 - 1] = Gpio::D4; @@ -608,8 +608,8 @@ end * set engine_type 42 */ void proteusBoardTest() { - engineConfiguration->specs.cylindersCount = 12; - engineConfiguration->specs.firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12; + engineConfiguration->cylindersCount = 12; + engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12; engineConfiguration->triggerSimulatorFrequency = 600; engineConfiguration->injector.flow = 4.6; // longer blink @@ -738,8 +738,8 @@ end void mreBoardNewTest() { mreBoardOldTest(); - engineConfiguration->specs.cylindersCount = 12; - engineConfiguration->specs.firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12; + engineConfiguration->cylindersCount = 12; + engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12; engineConfiguration->injector.flow = 5; // longer blink @@ -851,8 +851,8 @@ void setBoschHDEV_5_injectors() { * set engine_type 107 */ void setRotary() { - engineConfiguration->specs.cylindersCount = 2; - engineConfiguration->specs.firingOrder = FO_1_2; + engineConfiguration->cylindersCount = 2; + engineConfiguration->firingOrder = FO_1_2; engineConfiguration->trigger.type = TT_36_2_2_2; // todo: fix UI to make this possible via TS diff --git a/firmware/config/engines/gm_sbc.cpp b/firmware/config/engines/gm_sbc.cpp index b97978e906..a876a0f4b4 100644 --- a/firmware/config/engines/gm_sbc.cpp +++ b/firmware/config/engines/gm_sbc.cpp @@ -30,9 +30,9 @@ void setStepperHw() { } void setSbc() { - engineConfiguration->specs.cylindersCount = 8; - engineConfiguration->specs.firingOrder = FO_1_8_4_3_6_5_7_2; - engineConfiguration->specs.displacement = 5.2; + engineConfiguration->cylindersCount = 8; + engineConfiguration->firingOrder = FO_1_8_4_3_6_5_7_2; + engineConfiguration->displacement = 5.2; engineConfiguration->etbFunctions[0] = DC_None; engineConfiguration->etbFunctions[1] = DC_None; diff --git a/firmware/config/engines/hyundai.cpp b/firmware/config/engines/hyundai.cpp index 239da9a587..51f91c0fce 100644 --- a/firmware/config/engines/hyundai.cpp +++ b/firmware/config/engines/hyundai.cpp @@ -11,9 +11,9 @@ #include "proteus_meta.h" void setHyundaiPb() { - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; - engineConfiguration->specs.displacement = 1.6; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; + engineConfiguration->displacement = 1.6; strcpy(engineConfiguration->engineMake, ENGINE_MAKE_Hyundai); strcpy(engineConfiguration->engineCode, "Gamma"); diff --git a/firmware/config/engines/m111.cpp b/firmware/config/engines/m111.cpp index 281b43c7c2..fa2360a3b2 100644 --- a/firmware/config/engines/m111.cpp +++ b/firmware/config/engines/m111.cpp @@ -19,9 +19,9 @@ #endif // HW_MICRO_RUSEFI void setM111EngineConfiguration() { - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; - engineConfiguration->specs.displacement = 2.295f; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; + engineConfiguration->displacement = 2.295f; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL; diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 6d98f8595b..d44a163d7b 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -153,8 +153,8 @@ static const uint8_t mapBased16IgnitionTable[16][16] = { void miataNAcommonEngineSettings() { engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA; - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->compressionRatio = 9.1; engineConfiguration->cranking.rpm = 400; engineConfiguration->cylinderBore = 78; @@ -230,7 +230,7 @@ void miataNAcommonEngineSettings() { config->crankingFuelCoef[7] = 1.0; config->crankingFuelBins[7] = 90; - engineConfiguration->specs.displacement = 1.6; + engineConfiguration->displacement = 1.6; strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA); strcpy(engineConfiguration->engineCode, "NA6"); @@ -409,7 +409,7 @@ void setMiata94_MAP_MRE() { #endif /* BOARD_TLE8888_COUNT */ engineConfiguration->injectionMode = IM_SEQUENTIAL; - engineConfiguration->specs.displacement = 1.8; + engineConfiguration->displacement = 1.8; strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA); strcpy(engineConfiguration->engineCode, "94"); @@ -426,7 +426,7 @@ void setHellenNA94() { */ engineConfiguration->injector.flow = 254; - engineConfiguration->specs.displacement = 1.8; + engineConfiguration->displacement = 1.8; engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->map.sensor.type = MT_MPX4250; diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index ed7f365da2..c9a53993d2 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -300,7 +300,7 @@ static void setCommonMazdaNB() { engineConfiguration->idleMode = IM_AUTO; engineConfiguration->tachPulsePerRev = 2; - engineConfiguration->specs.displacement = 1.839; + engineConfiguration->displacement = 1.839; engineConfiguration->cylinderBore = 83; strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA); @@ -333,8 +333,8 @@ static void setCommonMazdaNB() { engineConfiguration->targetVBatt = 14.2; engineConfiguration->vehicleWeight = 1070; - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->cylindersCount = 4; + engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->ignitionMode = IM_WASTED_SPARK; diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 408409af4f..22c54a04b3 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -141,7 +141,7 @@ static void pinbench(float startdelay, float p_ontimeMs, float p_offtimeMs, int /*==========================================================================*/ static void doRunFuelInjBench(size_t humanIndex, float delay, float onTimeMs, float offTimeMs, int count) { - if (humanIndex < 1 || humanIndex > engineConfiguration->specs.cylindersCount) { + if (humanIndex < 1 || humanIndex > engineConfiguration->cylindersCount) { efiPrintf("Invalid index: %d", humanIndex); return; } @@ -150,7 +150,7 @@ static void doRunFuelInjBench(size_t humanIndex, float delay, float onTimeMs, fl } static void doRunSparkBench(size_t humanIndex, float delay, float onTime, float offTime, int count) { - if (humanIndex < 1 || humanIndex > engineConfiguration->specs.cylindersCount) { + if (humanIndex < 1 || humanIndex > engineConfiguration->cylindersCount) { efiPrintf("Invalid index: %d", humanIndex); return; } diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 0e6cedc625..2ed39b95d0 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -74,11 +74,11 @@ static int getIgnitionPinForIndex(int cylinderIndex, ignition_mode_e ignitionMod case IM_ONE_COIL: return 0; case IM_WASTED_SPARK: { - if (engineConfiguration->specs.cylindersCount == 1) { + if (engineConfiguration->cylindersCount == 1) { // we do not want to divide by zero return 0; } - return cylinderIndex % (engineConfiguration->specs.cylindersCount / 2); + return cylinderIndex % (engineConfiguration->cylindersCount / 2); } case IM_INDIVIDUAL_COILS: return cylinderIndex; @@ -122,7 +122,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_ // - We are running sequential mode, but we're cranking, so we should run in two wire wasted mode (not one wire wasted) bool isTwoWireWasted = engineConfiguration->twoWireBatchIgnition || (engineConfiguration->ignitionMode == IM_INDIVIDUAL_COILS); if (ignitionMode == IM_WASTED_SPARK && isTwoWireWasted) { - int secondIndex = index + engineConfiguration->specs.cylindersCount / 2; + int secondIndex = index + engineConfiguration->cylindersCount / 2; int secondCoilIndex = ID2INDEX(getCylinderId(secondIndex)); secondOutput = &enginePins.coils[secondCoilIndex]; assertPinAssigned(secondOutput); @@ -415,9 +415,9 @@ void initializeIgnitionActions() { list->isReady = false; return; } - efiAssertVoid(CUSTOM_ERR_6592, engineConfiguration->specs.cylindersCount > 0, "cylindersCount"); + efiAssertVoid(CUSTOM_ERR_6592, engineConfiguration->cylindersCount > 0, "cylindersCount"); - for (size_t cylinderIndex = 0; cylinderIndex < engineConfiguration->specs.cylindersCount; cylinderIndex++) { + for (size_t cylinderIndex = 0; cylinderIndex < engineConfiguration->cylindersCount; cylinderIndex++) { list->elements[cylinderIndex].cylinderIndex = cylinderIndex; prepareCylinderIgnitionSchedule(dwellAngle, sparkDwell, &list->elements[cylinderIndex]); } @@ -438,7 +438,7 @@ static void prepareIgnitionSchedule() { float maxAllowedDwellAngle = (int) (getEngineCycle(operationMode) / 2); // the cast is about making Coverity happy if (getCurrentIgnitionMode() == IM_ONE_COIL) { - maxAllowedDwellAngle = getEngineCycle(operationMode) / engineConfiguration->specs.cylindersCount / 1.1; + maxAllowedDwellAngle = getEngineCycle(operationMode) / engineConfiguration->cylindersCount / 1.1; } if (engine->ignitionState.dwellAngle == 0) { @@ -480,7 +480,7 @@ void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPha // scheduleSimpleMsg(&logger, "eventId spark ", eventIndex); if (engine->ignitionEvents.isReady) { - for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { + for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) { IgnitionEvent *event = &engine->ignitionEvents.elements[i]; if (!isPhaseInRange(event->dwellAngle, currentPhase, nextPhase)) { @@ -529,9 +529,9 @@ void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPha int getNumberOfSparks(ignition_mode_e mode) { switch (mode) { case IM_ONE_COIL: - return engineConfiguration->specs.cylindersCount; + return engineConfiguration->cylindersCount; case IM_TWO_COILS: - return engineConfiguration->specs.cylindersCount / 2; + return engineConfiguration->cylindersCount / 2; case IM_INDIVIDUAL_COILS: return 1; case IM_WASTED_SPARK: diff --git a/firmware/controllers/lua/generated/value_lookup_generated.cpp b/firmware/controllers/lua/generated/value_lookup_generated.cpp index 3fbc3ca672..14f49a3fb3 100644 --- a/firmware/controllers/lua/generated/value_lookup_generated.cpp +++ b/firmware/controllers/lua/generated/value_lookup_generated.cpp @@ -216,10 +216,10 @@ float getConfigValueByName(const char *name) { return engineConfiguration->knockBandCustom; // specs.displacement case -962678774: - return engineConfiguration->specs.displacement; + return engineConfiguration->displacement; // specs.cylindersCount case -601272985: - return engineConfiguration->specs.cylindersCount; + return engineConfiguration->cylindersCount; // cylinderBore case 1425664391: return engineConfiguration->cylinderBore; @@ -1964,12 +1964,12 @@ void setConfigValueByName(const char *name, float value) { } case -962678774: { - engineConfiguration->specs.displacement = value; + engineConfiguration->displacement = value; return; } case -601272985: { - engineConfiguration->specs.cylindersCount = (int)value; + engineConfiguration->cylindersCount = (int)value; return; } case 1425664391: diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index d797965b43..61df15d683 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -166,7 +166,7 @@ static const uint8_t order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10[] = {1, 14, 9, static size_t getFiringOrderLength() { - switch (engineConfiguration->specs.firingOrder) { + switch (engineConfiguration->firingOrder) { case FO_1: return 1; // 2 cylinder @@ -227,14 +227,14 @@ static size_t getFiringOrderLength() { return 16; default: - firmwareError(CUSTOM_OBD_UNKNOWN_FIRING_ORDER, "Invalid firing order: %d", engineConfiguration->specs.firingOrder); + firmwareError(CUSTOM_OBD_UNKNOWN_FIRING_ORDER, "Invalid firing order: %d", engineConfiguration->firingOrder); } return 1; } static const uint8_t* getFiringOrderTable() { - switch (engineConfiguration->specs.firingOrder) { + switch (engineConfiguration->firingOrder) { case FO_1: return order_1; // 2 cylinder @@ -319,7 +319,7 @@ static const uint8_t* getFiringOrderTable() return order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10; default: - firmwareError(CUSTOM_OBD_UNKNOWN_FIRING_ORDER, "Invalid firing order: %d", engineConfiguration->specs.firingOrder); + firmwareError(CUSTOM_OBD_UNKNOWN_FIRING_ORDER, "Invalid firing order: %d", engineConfiguration->firingOrder); } return NULL; @@ -336,7 +336,7 @@ size_t getCylinderId(size_t index) { firmwareError(CUSTOM_FIRING_LENGTH, "fol %d", firingOrderLength); return 1; } - if (engineConfiguration->specs.cylindersCount != firingOrderLength) { + if (engineConfiguration->cylindersCount != firingOrderLength) { // May 2020 this somehow still happens with functional tests, maybe race condition? firmwareError(CUSTOM_OBD_WRONG_FIRING_ORDER, "Wrong cyl count for firing order, expected %d cylinders", firingOrderLength); return 1; @@ -384,7 +384,7 @@ ignition_mode_e getCurrentIgnitionMode() { #if EFI_SHAFT_POSITION_INPUT // In spin-up cranking mode we don't have full phase sync info yet, so wasted spark mode is better // However, only do this on even cylinder count engines: odd cyl count doesn't fire at all - if (ignitionMode == IM_INDIVIDUAL_COILS && (engineConfiguration->specs.cylindersCount % 2 == 0)) { + if (ignitionMode == IM_INDIVIDUAL_COILS && (engineConfiguration->cylindersCount % 2 == 0)) { bool missingPhaseInfoForSequential = !engine->triggerCentral.triggerState.hasSynchronizedPhase(); @@ -421,7 +421,7 @@ void prepareOutputSignals() { angle_t getPerCylinderFiringOrderOffset(uint8_t cylinderIndex, uint8_t cylinderNumber) { // base = position of this cylinder in the firing order. // We get a cylinder every n-th of an engine cycle where N is the number of cylinders - auto firingOrderOffset = engine->engineState.engineCycle * cylinderIndex / engineConfiguration->specs.cylindersCount; + auto firingOrderOffset = engine->engineState.engineCycle * cylinderIndex / engineConfiguration->cylindersCount; assertAngleRange(firingOrderOffset, "getPerCylinderFiringOrderOffset", CUSTOM_ERR_6566); diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 1374aad180..9135be37dd 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -51,13 +51,13 @@ void printSpiState(const engine_configuration_s *engineConfiguration) { static void printOutputs(const engine_configuration_s *engineConfiguration) { efiPrintf("injectionPins: mode %s", getPin_output_mode_e(engineConfiguration->injectionPinMode)); - for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { + for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) { brain_pin_e brainPin = engineConfiguration->injectionPins[i]; efiPrintf("injection #%d @ %s", (1 + i), hwPortname(brainPin)); } efiPrintf("ignitionPins: mode %s", getPin_output_mode_e(engineConfiguration->ignitionPinMode)); - for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { + for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) { brain_pin_e brainPin = engineConfiguration->ignitionPins[i]; efiPrintf("ignition #%d @ %s", (1 + i), hwPortname(brainPin)); } @@ -244,7 +244,7 @@ static void setAlgorithmInt(int value) { } static void setFiringOrder(int value) { - engineConfiguration->specs.firingOrder = (firing_order_e) value; + engineConfiguration->firingOrder = (firing_order_e) value; doPrintConfiguration(); }