trigger and engine types -> enum class (#113)

* trigger type is enum class

* java tooling

* enum class engine_type_e

* enum class engine_type_e
This commit is contained in:
Matthew Kennedy 2023-06-01 13:47:49 -07:00 committed by GitHub
parent f9541aa1d1
commit 06b39dbb07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
128 changed files with 541 additions and 565 deletions

View File

@ -34,7 +34,7 @@ void setGy6139qmbDefaultEngineConfiguration() {
/** /**
* We treat the trigger as 8-1 toothed wheel * We treat the trigger as 8-1 toothed wheel
*/ */
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 8; engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;

View File

@ -102,7 +102,7 @@ void m73engine() {
engineConfiguration->globalTriggerAngleOffset = 90; engineConfiguration->globalTriggerAngleOffset = 90;
setCrankOperationMode(); setCrankOperationMode();
// todo: that's not right, should be 60/2 without VW // todo: that's not right, should be 60/2 without VW
engineConfiguration->trigger.type = TT_60_2_VW; engineConfiguration->trigger.type = trigger_type_e::TT_60_2_VW;
// this large engine seems to crank at around only 150 RPM? And happily idle at 400RPM? // this large engine seems to crank at around only 150 RPM? And happily idle at 400RPM?
engineConfiguration->cranking.rpm = 350; engineConfiguration->cranking.rpm = 350;

View File

@ -102,7 +102,7 @@ void setEngineBMW_M73_microRusEfi() {
// do I have VR wires flipped? // do I have VR wires flipped?
engineConfiguration->trigger.type = TT_60_2_VW; engineConfiguration->trigger.type = trigger_type_e::TT_60_2_VW;
//set tps_min 891 //set tps_min 891
engineConfiguration->tpsMin = 891; engineConfiguration->tpsMin = 891;

View File

@ -33,7 +33,7 @@ void setCamaro4() {
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_GM_24x; engineConfiguration->trigger.type = trigger_type_e::TT_GM_24x;
engineConfiguration->map.sensor.hwChannel = EFI_ADC_0; // PA0 engineConfiguration->map.sensor.hwChannel = EFI_ADC_0; // PA0

View File

@ -19,7 +19,7 @@ void setCitroenBerlingoTU3JPConfiguration() {
* Base engine setting * Base engine setting
*/ */
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->globalTriggerAngleOffset = 114; engineConfiguration->globalTriggerAngleOffset = 114;
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->displacement = 1.360; engineConfiguration->displacement = 1.360;

View File

@ -67,7 +67,7 @@ void setDiscoveryPdm() {
// todo: should this be part of more default configurations? // todo: should this be part of more default configurations?
void setFrankensoConfiguration() { void setFrankensoConfiguration() {
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE; engineConfiguration->trigger.type = trigger_type_e::TT_ONE_PLUS_ONE;
commonFrankensoAnalogInputs(); commonFrankensoAnalogInputs();
@ -229,7 +229,7 @@ void setEtbTestConfiguration() {
engineConfiguration->rpmHardLimit = 30000; engineConfiguration->rpmHardLimit = 30000;
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->ignitionPins[0] = Gpio::Unassigned; engineConfiguration->ignitionPins[0] = Gpio::Unassigned;
@ -786,7 +786,7 @@ void setRotary() {
engineConfiguration->cylindersCount = 2; engineConfiguration->cylindersCount = 2;
engineConfiguration->firingOrder = FO_1_2; engineConfiguration->firingOrder = FO_1_2;
engineConfiguration->trigger.type = TT_36_2_2_2; engineConfiguration->trigger.type = trigger_type_e::TT_36_2_2_2;
// todo: fix UI to make this possible via TS // todo: fix UI to make this possible via TS
setTwoStrokeOperationMode(); setTwoStrokeOperationMode();

View File

@ -19,7 +19,7 @@
#include "custom_engine.h" #include "custom_engine.h"
void setDodgeNeon1995EngineConfiguration() { void setDodgeNeon1995EngineConfiguration() {
engineConfiguration->trigger.type = TT_DODGE_NEON_1995; engineConfiguration->trigger.type = trigger_type_e::TT_DODGE_NEON_1995;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N; engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
@ -103,7 +103,7 @@ void setDodgeNeon1995EngineConfiguration() {
} }
void setDodgeNeonNGCEngineConfiguration() { void setDodgeNeonNGCEngineConfiguration() {
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM; engineConfiguration->trigger.type = trigger_type_e::TT_DODGE_NEON_2003_CAM;
// set global_trigger_offset_angle 38 // set global_trigger_offset_angle 38
engineConfiguration->globalTriggerAngleOffset = 38; engineConfiguration->globalTriggerAngleOffset = 38;

View File

@ -15,7 +15,7 @@
void setDodgeRam1996() { void setDodgeRam1996() {
setFrankensoConfiguration(); setFrankensoConfiguration();
engineConfiguration->trigger.type = TT_DODGE_RAM; engineConfiguration->trigger.type = trigger_type_e::TT_DODGE_RAM;
engineConfiguration->injector.flow = 243.6; // 23.2lb/h engineConfiguration->injector.flow = 243.6; // 23.2lb/h
engineConfiguration->map.sensor.type = MT_DODGE_NEON_2003; engineConfiguration->map.sensor.type = MT_DODGE_NEON_2003;

View File

@ -39,7 +39,7 @@ void setFordInline6() {
* We treat the trigger as 6/0 toothed wheel * We treat the trigger as 6/0 toothed wheel
*/ */
engineConfiguration->skippedWheelOnCam = true; engineConfiguration->skippedWheelOnCam = true;
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 6; engineConfiguration->trigger.customTotalToothCount = 6;
engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customSkippedToothCount = 0;

View File

@ -73,7 +73,7 @@ void setFordAspireEngineConfiguration() {
setSingleCoilDwell(); setSingleCoilDwell();
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
engineConfiguration->trigger.type = TT_FORD_ASPIRE; engineConfiguration->trigger.type = trigger_type_e::TT_FORD_ASPIRE;
engineConfiguration->triggerInputDebugPins[0] = Gpio::C15; engineConfiguration->triggerInputDebugPins[0] = Gpio::C15;

View File

@ -66,7 +66,7 @@ static const uint8_t racingFestivaVeTable[16][16] = {
void setFordEscortGt() { void setFordEscortGt() {
common079721_2351(); common079721_2351();
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4; engineConfiguration->trigger.type = trigger_type_e::TT_MAZDA_DOHC_1_4;
setDensoTODO(config); setDensoTODO(config);

View File

@ -24,7 +24,7 @@ static void setDefaultCustomMaps() {
void setHonda600() { void setHonda600() {
engineConfiguration->trigger.type = TT_HONDA_CBR_600; engineConfiguration->trigger.type = trigger_type_e::TT_HONDA_CBR_600;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N; engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// upside down wiring // upside down wiring

View File

@ -16,7 +16,7 @@ void setHondaK() {
engineConfiguration->displacement = 2.4; engineConfiguration->displacement = 2.4;
engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->firingOrder = FO_1_3_4_2;
engineConfiguration->engineSyncCam = SC_Exhaust_First; engineConfiguration->engineSyncCam = SC_Exhaust_First;
engineConfiguration->trigger.type = TT_HONDA_K_CRANK_12_1; engineConfiguration->trigger.type = trigger_type_e::TT_HONDA_K_CRANK_12_1;
engineConfiguration->globalTriggerAngleOffset = 675; engineConfiguration->globalTriggerAngleOffset = 675;
engineConfiguration->vvtMode[0] = VVT_HONDA_K_INTAKE; engineConfiguration->vvtMode[0] = VVT_HONDA_K_INTAKE;
@ -54,12 +54,12 @@ void setHondaK() {
*/ */
void setProteusHondaElement2003() { void setProteusHondaElement2003() {
setHondaK(); setHondaK();
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; // engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
// engineConfiguration->trigger.customTotalToothCount = 12; // engineConfiguration->trigger.customTotalToothCount = 12;
// engineConfiguration->trigger.customSkippedToothCount = 0; // engineConfiguration->trigger.customSkippedToothCount = 0;
// engineConfiguration->trigger.type = TT_HONDA_K_CAM_4_1; // cam as primary, ignoring crank // engineConfiguration->trigger.type = trigger_type_e::TT_HONDA_K_CAM_4_1; // cam as primary, ignoring crank
// engineConfiguration->globalTriggerAngleOffset = 570; // engineConfiguration->globalTriggerAngleOffset = 570;

View File

@ -73,7 +73,7 @@ static const uint8_t miataNA8_maf_advance_table[16][16] = { {/*0 engineLoad=1.2
#endif #endif
static void commonMiataNa() { static void commonMiataNa() {
engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA; engineConfiguration->trigger.type = trigger_type_e::TT_MAZDA_MIATA_NA;
engineConfiguration->engineChartSize = 100; engineConfiguration->engineChartSize = 100;
engineConfiguration->triggerInputPins[0] = Gpio::C6; // 2G YEL/BLU engineConfiguration->triggerInputPins[0] = Gpio::C6; // 2G YEL/BLU

View File

@ -92,7 +92,7 @@ void miataNAcommonEngineSettings() {
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
// Trigger // Trigger
engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA; engineConfiguration->trigger.type = trigger_type_e::TT_MAZDA_MIATA_NA;
// Cranking // Cranking
engineConfiguration->cranking.rpm = 400; engineConfiguration->cranking.rpm = 400;

View File

@ -22,7 +22,7 @@
* http://rusefi.com/forum/viewtopic.php?f=3&t=1095 * http://rusefi.com/forum/viewtopic.php?f=3&t=1095
* *
* *
* See also TT_MAZDA_MIATA_VVT_TEST for trigger simulation * See also trigger_type_e::TT_MAZDA_MIATA_VVT_TEST for trigger simulation
* *
* Based on http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board#Default_Pinout * Based on http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board#Default_Pinout
* *
@ -251,7 +251,7 @@ static void setCommonMazdaNB() {
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
// Trigger // Trigger
engineConfiguration->trigger.type = TT_MIATA_VVT; engineConfiguration->trigger.type = trigger_type_e::TT_MIATA_VVT;
engineConfiguration->vvtMode[0] = VVT_MIATA_NB; engineConfiguration->vvtMode[0] = VVT_MIATA_NB;
engineConfiguration->vvtOffsets[0] = 98; engineConfiguration->vvtOffsets[0] = 98;
@ -644,7 +644,7 @@ void setMiataNB2_Proteus_TCU() {
strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA); strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA);
strcpy(engineConfiguration->vehicleName, "TCU test"); strcpy(engineConfiguration->vehicleName, "TCU test");
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 10; engineConfiguration->trigger.customTotalToothCount = 10;
engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customSkippedToothCount = 0;
@ -778,7 +778,7 @@ void setMiataNB2_Hellen72() {
void setMiataNB2_Hellen72_36() { void setMiataNB2_Hellen72_36() {
setMiataNB2_Hellen72(); setMiataNB2_Hellen72();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_36_1;
engineConfiguration->globalTriggerAngleOffset = 76; engineConfiguration->globalTriggerAngleOffset = 76;
} }

View File

@ -15,7 +15,7 @@
void setMitsubishiConfiguration() { void setMitsubishiConfiguration() {
engineConfiguration->trigger.type = TT_MITSUBISHI_4G93; // same trigger as 4G63? engineConfiguration->trigger.type = trigger_type_e::TT_MITSUBISHI_4G93; // same trigger as 4G63?
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->displacement = 1.800; engineConfiguration->displacement = 1.800;

View File

@ -13,7 +13,7 @@
#include "nissan_primera.h" #include "nissan_primera.h"
void setNissanPrimeraEngineConfiguration() { void setNissanPrimeraEngineConfiguration() {
engineConfiguration->trigger.type = TT_NISSAN_SR20VE; engineConfiguration->trigger.type = trigger_type_e::TT_NISSAN_SR20VE;
engineConfiguration->auxValves[0] = Gpio::E14; engineConfiguration->auxValves[0] = Gpio::E14;
engineConfiguration->auxValves[1] = Gpio::E12; engineConfiguration->auxValves[1] = Gpio::E12;

View File

@ -13,7 +13,7 @@
#define NISSAN_VQ_VVT_OFFSET 157 #define NISSAN_VQ_VVT_OFFSET 157
void setHellen121nissanQR() { void setHellen121nissanQR() {
engineConfiguration->trigger.type = TT_NISSAN_QR25; engineConfiguration->trigger.type = trigger_type_e::TT_NISSAN_QR25;
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->firingOrder = FO_1_3_4_2; engineConfiguration->firingOrder = FO_1_3_4_2;
@ -34,7 +34,7 @@ void setHellen121nissanQR() {
void setHellen121nissanVQ() { void setHellen121nissanVQ() {
#include "nissan_vq.lua" #include "nissan_vq.lua"
engineConfiguration->trigger.type = TT_NISSAN_VQ35; engineConfiguration->trigger.type = trigger_type_e::TT_NISSAN_VQ35;
setNissanMAF0031(config); setNissanMAF0031(config);

View File

@ -26,7 +26,7 @@ void setSachs() {
/** /**
* 50/2 trigger * 50/2 trigger
*/ */
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 50; engineConfiguration->trigger.customTotalToothCount = 50;
engineConfiguration->trigger.customSkippedToothCount = 2; engineConfiguration->trigger.customSkippedToothCount = 2;

View File

@ -15,7 +15,7 @@
#include "defaults.h" #include "defaults.h"
void setSubaru2003Wrx() { void setSubaru2003Wrx() {
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 5; engineConfiguration->trigger.customTotalToothCount = 5;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;
@ -35,7 +35,7 @@ void setSubaru2003Wrx() {
* set engine_type 37 * set engine_type 37
*/ */
void setSubaruEJ18_MRE() { void setSubaruEJ18_MRE() {
engineConfiguration->trigger.type = TT_SUBARU_7_WITHOUT_6; engineConfiguration->trigger.type = trigger_type_e::TT_SUBARU_7_WITHOUT_6;
// engineConfiguration->isDoubleSolenoidIdle = true; // engineConfiguration->isDoubleSolenoidIdle = true;
@ -65,7 +65,7 @@ void setSubaruEJ18_MRE() {
void setSubaruEG33Defaults() { void setSubaruEG33Defaults() {
setCamOperationMode(); setCamOperationMode();
engineConfiguration->trigger.type = TT_SUBARU_SVX; engineConfiguration->trigger.type = trigger_type_e::TT_SUBARU_SVX;
engineConfiguration->cylindersCount = 6; engineConfiguration->cylindersCount = 6;
setLeftRightBanksNeedBetterName(); setLeftRightBanksNeedBetterName();

View File

@ -16,10 +16,10 @@
// TEST_ENGINE // TEST_ENGINE
void setTestCamEngineConfiguration() { void setTestCamEngineConfiguration() {
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE; engineConfiguration->trigger.type = trigger_type_e::TT_ONE_PLUS_ONE;
setCamOperationMode(); setCamOperationMode();
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; // engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
// trigger_config_s *triggerConfig = &engineConfiguration->trigger; // trigger_config_s *triggerConfig = &engineConfiguration->trigger;
// triggerConfig->customTotalToothCount = 60; // triggerConfig->customTotalToothCount = 60;
// triggerConfig->customSkippedToothCount = 0; // triggerConfig->customSkippedToothCount = 0;
@ -50,7 +50,7 @@ void setTestCamEngineConfiguration() {
void setTestCrankEngineConfiguration() { void setTestCrankEngineConfiguration() {
setTestCamEngineConfiguration(); setTestCamEngineConfiguration();
engineConfiguration->trigger.type = TT_ONE; engineConfiguration->trigger.type = trigger_type_e::TT_ONE;
setCrankOperationMode(); setCrankOperationMode();
// this is related to 'setDefaultBaseEngine' having 'skippedWheelOnCam = true' which is a weird fact by itself // this is related to 'setDefaultBaseEngine' having 'skippedWheelOnCam = true' which is a weird fact by itself
@ -76,7 +76,7 @@ void setTestDcWastegateConfiguration() {
void setTestVVTEngineConfiguration() { void setTestVVTEngineConfiguration() {
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 3; engineConfiguration->trigger.customTotalToothCount = 3;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;
@ -99,7 +99,7 @@ void setTestEngineIssue366both() {
engineConfiguration->trigger.customTotalToothCount = 2; engineConfiguration->trigger.customTotalToothCount = 2;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
} }
void setTestEngineIssue366rise() { void setTestEngineIssue366rise() {
@ -110,7 +110,7 @@ void setTestEngineIssue366rise() {
#ifdef HARDWARE_CI #ifdef HARDWARE_CI
void setProteusAnalogPwmTest() { void setProteusAnalogPwmTest() {
// lowest cpu trigger possible // lowest cpu trigger possible
engineConfiguration->trigger.type = TT_ONE; engineConfiguration->trigger.type = trigger_type_e::TT_ONE;
// Disable trigger stim // Disable trigger stim
engineConfiguration->triggerSimulatorPins[0] = Gpio::Unassigned; engineConfiguration->triggerSimulatorPins[0] = Gpio::Unassigned;

View File

@ -73,7 +73,7 @@ void setToyota_2jz_vics() {
common2jz(); common2jz();
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_36_2;
engineConfiguration->triggerInputPins[0] = Gpio::A5; // crank sensor engineConfiguration->triggerInputPins[0] = Gpio::A5; // crank sensor
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned; // cam sensor will he handled by custom vtti code engineConfiguration->triggerInputPins[1] = Gpio::Unassigned; // cam sensor will he handled by custom vtti code

View File

@ -26,7 +26,7 @@ void setVwAba() {
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->mafAdcChannel = EFI_ADC_1; engineConfiguration->mafAdcChannel = EFI_ADC_1;

View File

@ -16,7 +16,7 @@
static void commonPassatB6() { static void commonPassatB6() {
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START; engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
engineConfiguration->map.sensor.type = MT_BOSCH_2_5; engineConfiguration->map.sensor.type = MT_BOSCH_2_5;

View File

@ -53,7 +53,7 @@ void setDefaultBaseEngine() {
engineConfiguration->ALSMaxTPS = 5; engineConfiguration->ALSMaxTPS = 5;
// Trigger // Trigger
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->globalTriggerAngleOffset = 0; engineConfiguration->globalTriggerAngleOffset = 0;

View File

@ -66,42 +66,42 @@ void Engine::resetEngineSnifferIfInTestMode() {
trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
switch (vvtMode) { switch (vvtMode) {
case VVT_INACTIVE: case VVT_INACTIVE:
return TT_ONE; return trigger_type_e::TT_ONE;
case VVT_2JZ: case VVT_2JZ:
return TT_VVT_JZ; return trigger_type_e::TT_VVT_JZ;
case VVT_MIATA_NB: case VVT_MIATA_NB:
return TT_VVT_MIATA_NB; return trigger_type_e::TT_VVT_MIATA_NB;
case VVT_BOSCH_QUICK_START: case VVT_BOSCH_QUICK_START:
return TT_VVT_BOSCH_QUICK_START; return trigger_type_e::TT_VVT_BOSCH_QUICK_START;
case VVT_HONDA_K_EXHAUST: case VVT_HONDA_K_EXHAUST:
return TT_HONDA_K_CAM_4_1; return trigger_type_e::TT_HONDA_K_CAM_4_1;
case VVT_HONDA_K_INTAKE: case VVT_HONDA_K_INTAKE:
case VVT_FIRST_HALF: case VVT_FIRST_HALF:
case VVT_SECOND_HALF: case VVT_SECOND_HALF:
case VVT_MAP_V_TWIN: case VVT_MAP_V_TWIN:
return TT_ONE; return trigger_type_e::TT_ONE;
case VVT_FORD_ST170: case VVT_FORD_ST170:
return TT_FORD_ST170; return trigger_type_e::TT_FORD_ST170;
case VVT_BARRA_3_PLUS_1: case VVT_BARRA_3_PLUS_1:
return TT_VVT_BARRA_3_PLUS_1; return trigger_type_e::TT_VVT_BARRA_3_PLUS_1;
case VVT_MAZDA_SKYACTIV: case VVT_MAZDA_SKYACTIV:
return TT_VVT_MAZDA_SKYACTIV; return trigger_type_e::TT_VVT_MAZDA_SKYACTIV;
case VVT_NISSAN_VQ: case VVT_NISSAN_VQ:
return TT_VVT_NISSAN_VQ35; return trigger_type_e::TT_VVT_NISSAN_VQ35;
case VVT_TOYOTA_4_1: case VVT_TOYOTA_4_1:
return TT_VVT_TOYOTA_4_1; return trigger_type_e::TT_VVT_TOYOTA_4_1;
case VVT_MITSUBISHI_3A92: case VVT_MITSUBISHI_3A92:
return TT_VVT_MITSUBISHI_3A92; return trigger_type_e::TT_VVT_MITSUBISHI_3A92;
case VVT_MITSUBISHI_6G75: case VVT_MITSUBISHI_6G75:
case VVT_NISSAN_MR: case VVT_NISSAN_MR:
return TT_NISSAN_MR18_CAM_VVT; return trigger_type_e::TT_NISSAN_MR18_CAM_VVT;
case VVT_MITSUBISHI_4G9x: case VVT_MITSUBISHI_4G9x:
return TT_MITSU_4G9x_CAM; return trigger_type_e::TT_MITSU_4G9x_CAM;
case VVT_MITSUBISHI_4G63: case VVT_MITSUBISHI_4G63:
return TT_MITSU_4G63_CAM; return trigger_type_e::TT_MITSU_4G63_CAM;
default: default:
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "getVvtTriggerType for %s", getVvt_mode_e(vvtMode)); firmwareError(ObdCode::OBD_PCM_Processor_Fault, "getVvtTriggerType for %s", getVvt_mode_e(vvtMode));
return TT_ONE; // we have to return something for the sake of -Werror=return-type return trigger_type_e::TT_ONE; // we have to return something for the sake of -Werror=return-type
} }
} }

View File

@ -650,7 +650,7 @@ void loadConfiguration() {
#if EFI_INTERNAL_FLASH #if EFI_INTERNAL_FLASH
if (SHOULD_IGNORE_FLASH() || IGNORE_FLASH_CONFIGURATION) { if (SHOULD_IGNORE_FLASH() || IGNORE_FLASH_CONFIGURATION) {
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE; engineConfiguration->engineType = engine_type_e::DEFAULT_ENGINE_TYPE;
resetConfigurationExt(engineConfiguration->engineType); resetConfigurationExt(engineConfiguration->engineType);
writeToFlashNow(); writeToFlashNow();
} else { } else {
@ -660,7 +660,7 @@ void loadConfiguration() {
} }
#else // not EFI_INTERNAL_FLASH #else // not EFI_INTERNAL_FLASH
// This board doesn't load configuration, initialize the default // This board doesn't load configuration, initialize the default
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE; engineConfiguration->engineType = engine_type_e::DEFAULT_ENGINE_TYPE;
resetConfigurationExt(engineConfiguration->engineType); resetConfigurationExt(engineConfiguration->engineType);
#endif /* EFI_INTERNAL_FLASH */ #endif /* EFI_INTERNAL_FLASH */
@ -694,268 +694,268 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e
* And override them with engine-specific defaults * And override them with engine-specific defaults
*/ */
switch (engineType) { switch (engineType) {
case MINIMAL_PINS: case engine_type_e::MINIMAL_PINS:
// all basic settings are already set in prepareVoidConfiguration(), no need to set anything here // all basic settings are already set in prepareVoidConfiguration(), no need to set anything here
// nothing to do - we do it all in setBoardDefaultConfiguration // nothing to do - we do it all in setBoardDefaultConfiguration
break; break;
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
case TEST_ISSUE_366_BOTH: case engine_type_e::TEST_ISSUE_366_BOTH:
setTestEngineIssue366both(); setTestEngineIssue366both();
break; break;
case TEST_ISSUE_366_RISE: case engine_type_e::TEST_ISSUE_366_RISE:
setTestEngineIssue366rise(); setTestEngineIssue366rise();
break; break;
#endif // EFI_UNIT_TEST #endif // EFI_UNIT_TEST
#if HW_MICRO_RUSEFI #if HW_MICRO_RUSEFI
case MRE_VW_B6: case engine_type_e::MRE_VW_B6:
setMreVwPassatB6(); setMreVwPassatB6();
break; break;
case MRE_M111: case engine_type_e::MRE_M111:
setM111EngineConfiguration(); setM111EngineConfiguration();
break; break;
case MRE_SUBARU_EJ18: case engine_type_e::MRE_SUBARU_EJ18:
setSubaruEJ18_MRE(); setSubaruEJ18_MRE();
break; break;
case MRE_BOARD_NEW_TEST: case engine_type_e::MRE_BOARD_NEW_TEST:
mreBoardNewTest(); mreBoardNewTest();
break; break;
case BMW_M73_MRE: case engine_type_e::BMW_M73_MRE:
case BMW_M73_MRE_SLAVE: case engine_type_e::BMW_M73_MRE_SLAVE:
setEngineBMW_M73_microRusEfi(); setEngineBMW_M73_microRusEfi();
break; break;
case MRE_MIATA_94_MAP: case engine_type_e::MRE_MIATA_94_MAP:
setMiata94_MAP_MRE(); setMiata94_MAP_MRE();
break; break;
case MRE_MIATA_NA6_MAP: case engine_type_e::MRE_MIATA_NA6_MAP:
setMiataNA6_MAP_MRE(); setMiataNA6_MAP_MRE();
break; break;
case MRE_BODY_CONTROL: case engine_type_e::MRE_BODY_CONTROL:
mreBCM(); mreBCM();
break; break;
#endif // HW_MICRO_RUSEFI #endif // HW_MICRO_RUSEFI
#if HW_PROTEUS #if HW_PROTEUS
case WASTEGATE_PROTEUS_TEST: case engine_type_e::WASTEGATE_PROTEUS_TEST:
proteusDcWastegateTest(); proteusDcWastegateTest();
break; break;
case PROTEUS_GM_LS_4: case engine_type_e::PROTEUS_GM_LS_4:
setProteusGmLs4(); setProteusGmLs4();
break; break;
case PROTEUS_VW_B6: case engine_type_e::PROTEUS_VW_B6:
setProteusVwPassatB6(); setProteusVwPassatB6();
break; break;
case PROTEUS_QC_TEST_BOARD: case engine_type_e::PROTEUS_QC_TEST_BOARD:
proteusBoardTest(); proteusBoardTest();
break; break;
case PROTEUS_LUA_DEMO: case engine_type_e::PROTEUS_LUA_DEMO:
proteusLuaDemo(); proteusLuaDemo();
break; break;
case PROTEUS_HARLEY: case engine_type_e::PROTEUS_HARLEY:
proteusHarley(); proteusHarley();
break; break;
case PROTEUS_BMW_M73: case engine_type_e::PROTEUS_BMW_M73:
setEngineBMW_M73_Proteus(); setEngineBMW_M73_Proteus();
break; break;
case MIATA_PROTEUS_TCU: case engine_type_e::MIATA_PROTEUS_TCU:
setMiataNB2_Proteus_TCU(); setMiataNB2_Proteus_TCU();
break; break;
case PROTEUS_HONDA_K: case engine_type_e::PROTEUS_HONDA_K:
setProteusHondaElement2003(); setProteusHondaElement2003();
break; break;
case PROTEUS_HONDA_OBD2A: case engine_type_e::PROTEUS_HONDA_OBD2A:
setProteusHondaOBD2A(); setProteusHondaOBD2A();
break; break;
case PROTEUS_E65_6H_MAN_IN_THE_MIDDLE: case engine_type_e::PROTEUS_E65_6H_MAN_IN_THE_MIDDLE:
setEngineProteusGearboxManInTheMiddle(); setEngineProteusGearboxManInTheMiddle();
break; break;
case PROTEUS_MIATA_NA6: case engine_type_e::PROTEUS_MIATA_NA6:
setMiataNa6_Proteus(); setMiataNa6_Proteus();
break; break;
case PROTEUS_MIATA_NB2: case engine_type_e::PROTEUS_MIATA_NB2:
setMiataNB2_Proteus(); setMiataNB2_Proteus();
break; break;
#ifdef HARDWARE_CI #ifdef HARDWARE_CI
case PROTEUS_ANALOG_PWM_TEST: case engine_type_e::PROTEUS_ANALOG_PWM_TEST:
setProteusAnalogPwmTest(); setProteusAnalogPwmTest();
break; break;
#endif // HARDWARE_CI #endif // HARDWARE_CI
#endif // HW_PROTEUS #endif // HW_PROTEUS
#if HW_HELLEN #if HW_HELLEN
case HELLEN_128_MERCEDES_4_CYL: case engine_type_e::HELLEN_128_MERCEDES_4_CYL:
setHellenMercedes128_4_cyl(); setHellenMercedes128_4_cyl();
break; break;
case HELLEN_128_MERCEDES_6_CYL: case engine_type_e::HELLEN_128_MERCEDES_6_CYL:
setHellenMercedes128_6_cyl(); setHellenMercedes128_6_cyl();
break; break;
case HELLEN_128_MERCEDES_8_CYL: case engine_type_e::HELLEN_128_MERCEDES_8_CYL:
setHellenMercedes128_8_cyl(); setHellenMercedes128_8_cyl();
break; break;
case HELLEN_NB2: case engine_type_e::HELLEN_NB2:
setMiataNB2_Hellen72(); setMiataNB2_Hellen72();
break; break;
case HELLEN_NB2_36: case engine_type_e::HELLEN_NB2_36:
setMiataNB2_Hellen72_36(); setMiataNB2_Hellen72_36();
break; break;
case HELLEN_NA8_96: case engine_type_e::HELLEN_NA8_96:
setHellenMiata96(); setHellenMiata96();
break; break;
case HELLEN_NB1: case engine_type_e::HELLEN_NB1:
setHellenNB1(); setHellenNB1();
break; break;
case HELLEN_121_NISSAN_4_CYL: case engine_type_e::HELLEN_121_NISSAN_4_CYL:
setHellen121nissanQR(); setHellen121nissanQR();
break; break;
case HELLEN_121_NISSAN_6_CYL: case engine_type_e::HELLEN_121_NISSAN_6_CYL:
setHellen121nissanVQ(); setHellen121nissanVQ();
break; break;
case HELLEN_121_VAG_5_CYL: case engine_type_e::HELLEN_121_VAG_5_CYL:
setHellen121Vag_5_cyl(); setHellen121Vag_5_cyl();
break; break;
case HELLEN_121_VAG_V6_CYL: case engine_type_e::HELLEN_121_VAG_V6_CYL:
setHellen121Vag_v6_cyl(); setHellen121Vag_v6_cyl();
break; break;
case HELLEN_121_VAG_VR6_CYL: case engine_type_e::HELLEN_121_VAG_VR6_CYL:
setHellen121Vag_vr6_cyl(); setHellen121Vag_vr6_cyl();
break; break;
case HELLEN_121_VAG_8_CYL: case engine_type_e::HELLEN_121_VAG_8_CYL:
setHellen121Vag_8_cyl(); setHellen121Vag_8_cyl();
break; break;
case HELLEN_121_VAG_4_CYL: case engine_type_e::HELLEN_121_VAG_4_CYL:
case HELLEN_55_BMW: case engine_type_e::HELLEN_55_BMW:
case HELLEN_88_BMW: case engine_type_e::HELLEN_88_BMW:
case HELLEN_134_BMW: case engine_type_e::HELLEN_134_BMW:
case HELLEN_154_VAG: case engine_type_e::HELLEN_154_VAG:
break; break;
case HELLEN_154_HYUNDAI_COUPE_BK1: case engine_type_e::HELLEN_154_HYUNDAI_COUPE_BK1:
setGenesisCoupeBK1(); setGenesisCoupeBK1();
break; break;
case HELLEN_154_HYUNDAI_COUPE_BK2: case engine_type_e::HELLEN_154_HYUNDAI_COUPE_BK2:
setGenesisCoupeBK2(); setGenesisCoupeBK2();
break; break;
case HELLEN_NA6: case engine_type_e::HELLEN_NA6:
setHellenNA6(); setHellenNA6();
break; break;
case HELLEN_NA94: case engine_type_e::HELLEN_NA94:
setHellenNA94(); setHellenNA94();
break; break;
#endif // HW_HELLEN #endif // HW_HELLEN
#if HW_FRANKENSO #if HW_FRANKENSO
case DEFAULT_FRANKENSO: case engine_type_e::DEFAULT_FRANKENSO:
setFrankensoConfiguration(); setFrankensoConfiguration();
break; break;
case DISCOVERY_PDM: case engine_type_e::DISCOVERY_PDM:
case TEST_ENGINE: case engine_type_e::TEST_ENGINE:
setTestCamEngineConfiguration(); setTestCamEngineConfiguration();
break; break;
case TEST_CRANK_ENGINE: case engine_type_e::TEST_CRANK_ENGINE:
setTestCrankEngineConfiguration(); setTestCrankEngineConfiguration();
break; break;
case FRANKENSO_QA_ENGINE: case engine_type_e::FRANKENSO_QA_ENGINE:
setFrankensoBoardTestConfiguration(); setFrankensoBoardTestConfiguration();
break; break;
case FRANKENSO_BMW_M73_F: case engine_type_e::FRANKENSO_BMW_M73_F:
setBMW_M73_TwoCoilUnitTest(); setBMW_M73_TwoCoilUnitTest();
break; break;
case BMW_M73_M: case engine_type_e::BMW_M73_M:
setEngineBMW_M73_Manhattan(); setEngineBMW_M73_Manhattan();
break; break;
case DODGE_NEON_1995: case engine_type_e::DODGE_NEON_1995:
setDodgeNeon1995EngineConfiguration(); setDodgeNeon1995EngineConfiguration();
break; break;
case DODGE_NEON_2003_CRANK: case engine_type_e::DODGE_NEON_2003_CRANK:
setDodgeNeonNGCEngineConfiguration(); setDodgeNeonNGCEngineConfiguration();
break; break;
case FORD_ASPIRE_1996: case engine_type_e::FORD_ASPIRE_1996:
setFordAspireEngineConfiguration(); setFordAspireEngineConfiguration();
break; break;
case NISSAN_PRIMERA: case engine_type_e::NISSAN_PRIMERA:
setNissanPrimeraEngineConfiguration(); setNissanPrimeraEngineConfiguration();
break; break;
case FRANKENSO_MIATA_NA6_MAP: case engine_type_e::FRANKENSO_MIATA_NA6_MAP:
setMiataNA6_MAP_Frankenso(); setMiataNA6_MAP_Frankenso();
break; break;
case ETB_BENCH_ENGINE: case engine_type_e::ETB_BENCH_ENGINE:
setEtbTestConfiguration(); setEtbTestConfiguration();
break; break;
case L9779_BENCH_ENGINE: case engine_type_e::L9779_BENCH_ENGINE:
setL9779TestConfiguration(); setL9779TestConfiguration();
break; break;
case EEPROM_BENCH_ENGINE: case engine_type_e::EEPROM_BENCH_ENGINE:
#if EFI_PROD_CODE #if EFI_PROD_CODE
setEepromTestConfiguration(); setEepromTestConfiguration();
#endif #endif
break; break;
case TLE8888_BENCH_ENGINE: case engine_type_e::TLE8888_BENCH_ENGINE:
setTle8888TestConfiguration(); setTle8888TestConfiguration();
break; break;
case FRANKENSO_MAZDA_MIATA_NA8: case engine_type_e::FRANKENSO_MAZDA_MIATA_NA8:
setFrankensoMazdaMiataNA8Configuration(); setFrankensoMazdaMiataNA8Configuration();
break; break;
case MITSU_4G93: case engine_type_e::MITSU_4G93:
setMitsubishiConfiguration(); setMitsubishiConfiguration();
break; break;
case FORD_INLINE_6_1995: case engine_type_e::FORD_INLINE_6_1995:
setFordInline6(); setFordInline6();
break; break;
case GY6_139QMB: case engine_type_e::GY6_139QMB:
setGy6139qmbDefaultEngineConfiguration(); setGy6139qmbDefaultEngineConfiguration();
break; break;
case HONDA_600: case engine_type_e::HONDA_600:
setHonda600(); setHonda600();
break; break;
case FORD_ESCORT_GT: case engine_type_e::FORD_ESCORT_GT:
setFordEscortGt(); setFordEscortGt();
break; break;
case MIATA_1996: case engine_type_e::MIATA_1996:
setFrankensteinMiata1996(); setFrankensteinMiata1996();
break; break;
case CITROEN_TU3JP: case engine_type_e::CITROEN_TU3JP:
setCitroenBerlingoTU3JPConfiguration(); setCitroenBerlingoTU3JPConfiguration();
break; break;
case SUBARU_2003_WRX: case engine_type_e::SUBARU_2003_WRX:
setSubaru2003Wrx(); setSubaru2003Wrx();
break; break;
case DODGE_RAM: case engine_type_e::DODGE_RAM:
setDodgeRam1996(); setDodgeRam1996();
break; break;
case VW_ABA: case engine_type_e::VW_ABA:
setVwAba(); setVwAba();
break; break;
case FRANKENSO_MAZDA_MIATA_2003: case engine_type_e::FRANKENSO_MAZDA_MIATA_2003:
setMazdaMiata2003EngineConfiguration(); setMazdaMiata2003EngineConfiguration();
break; break;
case MAZDA_MIATA_2003_NA_RAIL: case engine_type_e::MAZDA_MIATA_2003_NA_RAIL:
setMazdaMiata2003EngineConfigurationNaFuelRail(); setMazdaMiata2003EngineConfigurationNaFuelRail();
break; break;
case MAZDA_MIATA_2003_BOARD_TEST: case engine_type_e::MAZDA_MIATA_2003_BOARD_TEST:
setMazdaMiata2003EngineConfigurationBoardTest(); setMazdaMiata2003EngineConfigurationBoardTest();
break; break;
case TEST_ENGINE_VVT: case engine_type_e::TEST_ENGINE_VVT:
setTestVVTEngineConfiguration(); setTestVVTEngineConfiguration();
break; break;
case TEST_DC_WASTEGATE_DISCOVERY: case engine_type_e::TEST_DC_WASTEGATE_DISCOVERY:
setTestDcWastegateConfiguration(); setTestDcWastegateConfiguration();
break; break;
case SACHS: case engine_type_e::SACHS:
setSachs(); setSachs();
break; break;
case CAMARO_4: case engine_type_e::CAMARO_4:
setCamaro4(); setCamaro4();
break; break;
case TOYOTA_2JZ_GTE_VVTi: case engine_type_e::TOYOTA_2JZ_GTE_VVTi:
setToyota_2jz_vics(); setToyota_2jz_vics();
break; break;
case TEST_33816: case engine_type_e::TEST_33816:
setTest33816EngineConfiguration(); setTest33816EngineConfiguration();
break; break;
case TEST_100: case engine_type_e::TEST_100:
case TEST_101: case engine_type_e::TEST_101:
case TEST_102: case engine_type_e::TEST_102:
case TEST_ROTARY: case engine_type_e::TEST_ROTARY:
setRotary(); setRotary();
break; break;
#endif // HW_FRANKENSO #endif // HW_FRANKENSO
#ifdef HW_SUBARU_EG33 #ifdef HW_SUBARU_EG33
case SUBARUEG33_DEFAULTS: case engine_type_e::SUBARUEG33_DEFAULTS:
setSubaruEG33Defaults(); setSubaruEG33Defaults();
break; break;
#endif //HW_SUBARU_EG33 #endif //HW_SUBARU_EG33

View File

@ -16,7 +16,7 @@
/** /**
* http://rusefi.com/wiki/index.php?title=Manual:Engine_Type * http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
*/ */
typedef enum __attribute__ ((__packed__)) { enum class engine_type_e : uint32_t {
DEFAULT_FRANKENSO = 0, DEFAULT_FRANKENSO = 0,
MIATA_PROTEUS_TCU = 1, MIATA_PROTEUS_TCU = 1,
@ -219,11 +219,7 @@ typedef enum __attribute__ ((__packed__)) {
TEST_100 = 100, TEST_100 = 100,
TEST_101 = 101, TEST_101 = 101,
TEST_102 = 102, TEST_102 = 102,
};
// java code generator handles this value in a special way
// also looks like 2 enums are either 1 byte or 4 bytes
Force_4_bytes_size_engine_type = 70000,
} engine_type_e;
/** /**
* https://rusefi.com//wiki/index.php?title=Manual:Debug_fields * https://rusefi.com//wiki/index.php?title=Manual:Debug_fields
@ -298,8 +294,7 @@ typedef enum __attribute__ ((__packed__)) {
/** /**
* @see http://rusefi.com/wiki/index.php?title=Manual:Software:Trigger * @see http://rusefi.com/wiki/index.php?title=Manual:Software:Trigger
*/ */
typedef enum { enum class trigger_type_e : uint32_t {
TT_TOOTHED_WHEEL = 0, TT_TOOTHED_WHEEL = 0,
TT_FORD_ASPIRE = 1, TT_FORD_ASPIRE = 1,
TT_DODGE_NEON_1995 = 2, TT_DODGE_NEON_1995 = 2,
@ -509,12 +504,7 @@ typedef enum {
// Another point: once you add a new trigger, run get_trigger_images.bat which would run fome_test.exe from unit_tests // Another point: once you add a new trigger, run get_trigger_images.bat which would run fome_test.exe from unit_tests
// //
TT_UNUSED = 75, // this is used if we want to iterate over all trigger types TT_UNUSED = 75, // this is used if we want to iterate over all trigger types
};
// java code generator handles this value in a special way
// also looks like 2 enums are either 1 byte or 4 bytes
Force_4_bytes_size_trigger_type = 70000,
} trigger_type_e; // TriggerProcessor.java has this "trigger_type_e" name hard-coded!
typedef enum { typedef enum {
TS_DEBUG_MODE = 0, TS_DEBUG_MODE = 0,

View File

@ -492,7 +492,7 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
case TS_SET_DEFAULT_ENGINE: case TS_SET_DEFAULT_ENGINE:
fatalErrorForPresetApply(); fatalErrorForPresetApply();
setEngineType(DEFAULT_ENGINE_TYPE); setEngineType(engine_type_e::DEFAULT_ENGINE_TYPE);
break; break;
case 0x79: case 0x79:

View File

@ -70,12 +70,12 @@ operation_mode_e lookupOperationMode() {
// this is related to 'knownOperationMode' flag // this is related to 'knownOperationMode' flag
static bool doesTriggerImplyOperationMode(trigger_type_e type) { static bool doesTriggerImplyOperationMode(trigger_type_e type) {
switch (type) { switch (type) {
case TT_TOOTHED_WHEEL: case trigger_type_e::TT_TOOTHED_WHEEL:
case TT_ONE: case trigger_type_e::TT_ONE:
case TT_3_1_CAM: case trigger_type_e::TT_3_1_CAM:
case TT_36_2_2_2: // TODO: should this one be in this list? case trigger_type_e::TT_36_2_2_2: // TODO: should this one be in this list?
case TT_TOOTHED_WHEEL_60_2: case trigger_type_e::TT_TOOTHED_WHEEL_60_2:
case TT_TOOTHED_WHEEL_36_1: case trigger_type_e::TT_TOOTHED_WHEEL_36_1:
// These modes could be either cam or crank speed // These modes could be either cam or crank speed
return false; return false;
default: default:

View File

@ -302,7 +302,7 @@ void readFromFlash() {
efiPrintf("Need to reset flash to default due to CRC mismatch"); efiPrintf("Need to reset flash to default due to CRC mismatch");
[[fallthrough]]; [[fallthrough]];
case FlashState::BlankChip: case FlashState::BlankChip:
resetConfigurationExt(DEFAULT_ENGINE_TYPE); resetConfigurationExt(engine_type_e::DEFAULT_ENGINE_TYPE);
break; break;
case FlashState::IncompatibleVersion: case FlashState::IncompatibleVersion:
// Preserve engine type from old config // Preserve engine type from old config

View File

@ -698,19 +698,24 @@ void setDateTime(const char * const isoDateTime) {
#endif // ! EFI_UNIT_TEST #endif // ! EFI_UNIT_TEST
void setEngineType(int value) { void setEngineType(int value) {
setEngineType((engine_type_e)value);
}
void setEngineType(engine_type_e value) {
{ {
#if EFI_PROD_CODE #if EFI_PROD_CODE
chibios_rt::CriticalSectionLocker csl; chibios_rt::CriticalSectionLocker csl;
#endif // EFI_PROD_CODE #endif // EFI_PROD_CODE
engineConfiguration->engineType = (engine_type_e)value; engineConfiguration->engineType = value;
resetConfigurationExt((engine_type_e)value); resetConfigurationExt(value);
engine->resetEngineSnifferIfInTestMode(); engine->resetEngineSnifferIfInTestMode();
#if EFI_INTERNAL_FLASH #if EFI_INTERNAL_FLASH
writeToFlashNow(); writeToFlashNow();
#endif // EFI_INTERNAL_FLASH #endif // EFI_INTERNAL_FLASH
} }
incrementGlobalConfigurationVersion(); incrementGlobalConfigurationVersion();
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
#endif // ! EFI_UNIT_TEST #endif // ! EFI_UNIT_TEST

View File

@ -15,6 +15,7 @@ void printConfiguration(const engine_configuration_s *engineConfiguration);
void scheduleStopEngine(void); void scheduleStopEngine(void);
void setEngineType(int value); void setEngineType(int value);
void setEngineType(engine_type_e value);
void readPin(const char *pinName); void readPin(const char *pinName);
void printDateTime(); void printDateTime();

View File

@ -503,7 +503,7 @@ static void add4cylblock(int off, TriggerWaveform *s) {
s->addEvent720(174 + off + 2, false, TriggerWheel::T_SECONDARY); s->addEvent720(174 + off + 2, false, TriggerWheel::T_SECONDARY);
} }
// TT_JEEP_4_CYL // trigger_type_e::TT_JEEP_4_CYL
void initJeep_XJ_4cyl_2500(TriggerWaveform *s) { void initJeep_XJ_4cyl_2500(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly); s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
s->isSynchronizationNeeded = false; s->isSynchronizationNeeded = false;

View File

@ -101,7 +101,7 @@ static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerWaveform* s,
} }
/** /**
* TT_GM_24x and TT_GM_24x_2 * trigger_type_e::TT_GM_24x and trigger_type_e::TT_GM_24x_2
* https://www.mediafire.com/?40mfgeoe4ctti * https://www.mediafire.com/?40mfgeoe4ctti
* http://www.ls1gto.com/forums/archive/index.php/t-190549.htm * http://www.ls1gto.com/forums/archive/index.php/t-190549.htm
* http://www.ls2.com/forums/showthread.php/834483-LS-Timing-Reluctor-Wheels-Explained * http://www.ls2.com/forums/showthread.php/834483-LS-Timing-Reluctor-Wheels-Explained
@ -153,7 +153,7 @@ static void initGmLS24(TriggerWaveform *s, float shortToothWidth) {
} }
} }
// TT_GM_24x // trigger_type_e::TT_GM_24x
void initGmLS24_5deg(TriggerWaveform *s) { void initGmLS24_5deg(TriggerWaveform *s) {
initGmLS24(s, 5); initGmLS24(s, 5);
@ -165,7 +165,7 @@ void initGmLS24_5deg(TriggerWaveform *s) {
s->tdcPosition = 50; s->tdcPosition = 50;
} }
// TT_GM_24x_2 // trigger_type_e::TT_GM_24x_2
void initGmLS24_3deg(TriggerWaveform *s) { void initGmLS24_3deg(TriggerWaveform *s) {
initGmLS24(s, 3); initGmLS24(s, 3);

View File

@ -75,7 +75,7 @@ static void kseriesTooth(TriggerWaveform* s, float end) {
s->addEvent360(end , false, TriggerWheel::T_PRIMARY); s->addEvent360(end , false, TriggerWheel::T_PRIMARY);
} }
// TT_HONDA_K_CRANK_12_1 // trigger_type_e::TT_HONDA_K_CRANK_12_1
void configureHondaK_12_1(TriggerWaveform *s) { void configureHondaK_12_1(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly); s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);

View File

@ -56,7 +56,7 @@ void initializeMazdaMiataNaShape(TriggerWaveform *s) {
s->useOnlyPrimaryForSync = true; s->useOnlyPrimaryForSync = true;
} }
// TT_MIATA_VVT // trigger_type_e::TT_MIATA_VVT
void initializeMazdaMiataNb2Crank(TriggerWaveform *s) { void initializeMazdaMiataNb2Crank(TriggerWaveform *s) {
/** /**
* Note how we use 0..180 range while defining FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR trigger * Note how we use 0..180 range while defining FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR trigger

View File

@ -10,7 +10,7 @@
#include "trigger_misc.h" #include "trigger_misc.h"
#include "trigger_universal.h" #include "trigger_universal.h"
// TT_FIAT_IAW_P8 // trigger_type_e::TT_FIAT_IAW_P8
void configureFiatIAQ_P8(TriggerWaveform * s) { void configureFiatIAQ_P8(TriggerWaveform * s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Rise); s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Rise);
@ -25,7 +25,7 @@ void configureFiatIAQ_P8(TriggerWaveform * s) {
s->setTriggerSynchronizationGap(3); s->setTriggerSynchronizationGap(3);
} }
// TT_TRI_TACH // trigger_type_e::TT_TRI_TACH
void configureTriTach(TriggerWaveform * s) { void configureTriTach(TriggerWaveform * s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly); s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);

View File

@ -64,7 +64,7 @@ static void addMitsu93(TriggerWaveform *s, bool addSecondary) {
} }
/** /**
* TT_MITSUBISHI_4G93 = 11 * trigger_type_e::TT_MITSUBISHI_4G93 = 11
*/ */
void initializeMitsubishi4G93(TriggerWaveform *s) { void initializeMitsubishi4G93(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Fall); s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Fall);

View File

@ -30,13 +30,13 @@ static void commonRenix(TriggerWaveform *s) {
s->addEventAngle(s->getCycleDuration(), false); s->addEventAngle(s->getCycleDuration(), false);
} }
// TT_RENIX_44_2_2 // trigger_type_e::TT_RENIX_44_2_2
void initializeRenix44_2_2(TriggerWaveform *s) { void initializeRenix44_2_2(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, SyncEdge::RiseOnly); s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, SyncEdge::RiseOnly);
commonRenix(s); commonRenix(s);
} }
// TT_RENIX_66_2_2_2 // trigger_type_e::TT_RENIX_66_2_2_2
void initializeRenix66_2_2(TriggerWaveform *s) { void initializeRenix66_2_2(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR, SyncEdge::RiseOnly); s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR, SyncEdge::RiseOnly);
commonRenix(s); commonRenix(s);

View File

@ -401,165 +401,165 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio
shapeDefinitionError = false; shapeDefinitionError = false;
switch (triggerConfig.TriggerType.type) { switch (triggerConfig.TriggerType.type) {
case TT_TOOTHED_WHEEL: case trigger_type_e::TT_TOOTHED_WHEEL:
initializeSkippedToothTrigger(this, triggerConfig.TriggerType.customTotalToothCount, initializeSkippedToothTrigger(this, triggerConfig.TriggerType.customTotalToothCount,
triggerConfig.TriggerType.customSkippedToothCount, triggerOperationMode, SyncEdge::RiseOnly); triggerConfig.TriggerType.customSkippedToothCount, triggerOperationMode, SyncEdge::RiseOnly);
break; break;
case TT_MAZDA_MIATA_NA: case trigger_type_e::TT_MAZDA_MIATA_NA:
initializeMazdaMiataNaShape(this); initializeMazdaMiataNaShape(this);
break; break;
case TT_MITSUBISHI_MESS: case trigger_type_e::TT_MITSUBISHI_MESS:
initializeMitsubishi4gMess(this); initializeMitsubishi4gMess(this);
break; break;
case TT_MAZDA_MIATA_VVT_TEST: case trigger_type_e::TT_MAZDA_MIATA_VVT_TEST:
initializeMazdaMiataVVtTestShape(this); initializeMazdaMiataVVtTestShape(this);
break; break;
case TT_SUZUKI_G13B: case trigger_type_e::TT_SUZUKI_G13B:
initializeSuzukiG13B(this); initializeSuzukiG13B(this);
break; break;
case TT_FORD_TFI_PIP: case trigger_type_e::TT_FORD_TFI_PIP:
configureFordPip(this); configureFordPip(this);
break; break;
case TT_FORD_ST170: case trigger_type_e::TT_FORD_ST170:
configureFordST170(this); configureFordST170(this);
break; break;
case TT_VVT_MIATA_NB: case trigger_type_e::TT_VVT_MIATA_NB:
initializeMazdaMiataVVtCamShape(this); initializeMazdaMiataVVtCamShape(this);
break; break;
case TT_RENIX_66_2_2_2: case trigger_type_e::TT_RENIX_66_2_2_2:
initializeRenix66_2_2(this); initializeRenix66_2_2(this);
break; break;
case TT_RENIX_44_2_2: case trigger_type_e::TT_RENIX_44_2_2:
initializeRenix44_2_2(this); initializeRenix44_2_2(this);
break; break;
case TT_MIATA_VVT: case trigger_type_e::TT_MIATA_VVT:
initializeMazdaMiataNb2Crank(this); initializeMazdaMiataNb2Crank(this);
break; break;
case TT_DODGE_NEON_1995: case trigger_type_e::TT_DODGE_NEON_1995:
case TT_DODGE_NEON_1995_ONLY_CRANK: case trigger_type_e::TT_DODGE_NEON_1995_ONLY_CRANK:
configureNeon1995TriggerWaveformOnlyCrank(this); configureNeon1995TriggerWaveformOnlyCrank(this);
break; break;
case TT_DODGE_STRATUS: case trigger_type_e::TT_DODGE_STRATUS:
configureDodgeStratusTriggerWaveform(this); configureDodgeStratusTriggerWaveform(this);
break; break;
case TT_DODGE_NEON_2003_CAM: case trigger_type_e::TT_DODGE_NEON_2003_CAM:
configureNeon2003TriggerWaveformCam(this); configureNeon2003TriggerWaveformCam(this);
break; break;
case TT_DODGE_NEON_2003_CRANK: case trigger_type_e::TT_DODGE_NEON_2003_CRANK:
configureNeon2003TriggerWaveformCam(this); configureNeon2003TriggerWaveformCam(this);
// configureNeon2003TriggerWaveformCrank(triggerShape); // configureNeon2003TriggerWaveformCrank(triggerShape);
break; break;
case TT_FORD_ASPIRE: case trigger_type_e::TT_FORD_ASPIRE:
configureFordAspireTriggerWaveform(this); configureFordAspireTriggerWaveform(this);
break; break;
case TT_VVT_NISSAN_VQ35: case trigger_type_e::TT_VVT_NISSAN_VQ35:
initializeNissanVQvvt(this); initializeNissanVQvvt(this);
break; break;
case TT_VVT_MITSUBISHI_3A92: case trigger_type_e::TT_VVT_MITSUBISHI_3A92:
initializeVvt3A92(this); initializeVvt3A92(this);
break; break;
case TT_VVT_TOYOTA_4_1: case trigger_type_e::TT_VVT_TOYOTA_4_1:
initializeSkippedToothTrigger(this, 4, 1, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 4, 1, triggerOperationMode, SyncEdge::RiseOnly);
setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.60, 2.40); setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.60, 2.40);
setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.75, 1.25); setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.75, 1.25);
break; break;
case TT_VVT_MITSUBISHI_6G75: case trigger_type_e::TT_VVT_MITSUBISHI_6G75:
case TT_NISSAN_QR25: case trigger_type_e::TT_NISSAN_QR25:
initializeNissanQR25crank(this); initializeNissanQR25crank(this);
break; break;
case TT_NISSAN_VQ30: case trigger_type_e::TT_NISSAN_VQ30:
initializeNissanVQ30cam(this); initializeNissanVQ30cam(this);
break; break;
case TT_NISSAN_VQ35: case trigger_type_e::TT_NISSAN_VQ35:
initializeNissanVQ35crank(this); initializeNissanVQ35crank(this);
break; break;
case TT_NISSAN_MR18_CRANK: case trigger_type_e::TT_NISSAN_MR18_CRANK:
initializeNissanMR18crank(this); initializeNissanMR18crank(this);
break; break;
case TT_NISSAN_MR18_CAM_VVT: case trigger_type_e::TT_NISSAN_MR18_CAM_VVT:
initializeNissanMRvvt(this); initializeNissanMRvvt(this);
break; break;
case TT_KAWA_KX450F: case trigger_type_e::TT_KAWA_KX450F:
configureKawaKX450F(this); configureKawaKX450F(this);
break; break;
case TT_SKODA_FAVORIT: case trigger_type_e::TT_SKODA_FAVORIT:
setSkodaFavorit(this); setSkodaFavorit(this);
break; break;
case TT_GM_60_2_2_2: case trigger_type_e::TT_GM_60_2_2_2:
configureGm60_2_2_2(this); configureGm60_2_2_2(this);
break; break;
case TT_GM_7X: case trigger_type_e::TT_GM_7X:
configureGmTriggerWaveform(this); configureGmTriggerWaveform(this);
break; break;
case TT_MAZDA_DOHC_1_4: case trigger_type_e::TT_MAZDA_DOHC_1_4:
configureMazdaProtegeLx(this); configureMazdaProtegeLx(this);
break; break;
case TT_ONE_PLUS_ONE: case trigger_type_e::TT_ONE_PLUS_ONE:
configureOnePlusOne(this); configureOnePlusOne(this);
break; break;
case TT_3_1_CAM: case trigger_type_e::TT_3_1_CAM:
configure3_1_cam(this); configure3_1_cam(this);
break; break;
case TT_MERCEDES_2_SEGMENT: case trigger_type_e::TT_MERCEDES_2_SEGMENT:
setMercedesTwoSegment(this); setMercedesTwoSegment(this);
break; break;
case TT_ONE: case trigger_type_e::TT_ONE:
initializeSkippedToothTrigger(this, 1, 0, triggerOperationMode, SyncEdge::Rise); initializeSkippedToothTrigger(this, 1, 0, triggerOperationMode, SyncEdge::Rise);
break; break;
case TT_MAZDA_SOHC_4: case trigger_type_e::TT_MAZDA_SOHC_4:
configureMazdaProtegeSOHC(this); configureMazdaProtegeSOHC(this);
break; break;
case TT_DAIHATSU: case trigger_type_e::TT_DAIHATSU:
configureDaihatsu4(this); configureDaihatsu4(this);
break; break;
case TT_VVT_JZ: case trigger_type_e::TT_VVT_JZ:
initializeSkippedToothTrigger(this, 3, 0, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 3, 0, triggerOperationMode, SyncEdge::RiseOnly);
break; break;
case TT_36_2_1_1: case trigger_type_e::TT_36_2_1_1:
initialize36_2_1_1(this); initialize36_2_1_1(this);
break; break;
case TT_36_2_1: case trigger_type_e::TT_36_2_1:
initialize36_2_1(this); initialize36_2_1(this);
break; break;
case TT_TOOTHED_WHEEL_32_2: case trigger_type_e::TT_TOOTHED_WHEEL_32_2:
initializeSkippedToothTrigger(this, 32, 2, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 32, 2, triggerOperationMode, SyncEdge::RiseOnly);
// todo: why is this 32/2 asking for third gap while 60/2 is happy with just two gaps? // todo: why is this 32/2 asking for third gap while 60/2 is happy with just two gaps?
// method above sets second gap, here we add third // method above sets second gap, here we add third
@ -567,139 +567,139 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio
setThirdTriggerSynchronizationGap(1); setThirdTriggerSynchronizationGap(1);
break; break;
case TT_TOOTHED_WHEEL_60_2: case trigger_type_e::TT_TOOTHED_WHEEL_60_2:
initializeSkippedToothTrigger(this, 60, 2, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 60, 2, triggerOperationMode, SyncEdge::RiseOnly);
break; break;
case TT_TOOTHED_WHEEL_36_2: case trigger_type_e::TT_TOOTHED_WHEEL_36_2:
initializeSkippedToothTrigger(this, 36, 2, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 36, 2, triggerOperationMode, SyncEdge::RiseOnly);
setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.6, 3.5); setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.6, 3.5);
setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.7, 1.3); // second gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.7, 1.3); // second gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise
break; break;
case TT_60_2_VW: case trigger_type_e::TT_60_2_VW:
setVwConfiguration(this); setVwConfiguration(this);
break; break;
case TT_TOOTHED_WHEEL_36_1: case trigger_type_e::TT_TOOTHED_WHEEL_36_1:
initializeSkippedToothTrigger(this, 36, 1, triggerOperationMode, SyncEdge::RiseOnly); initializeSkippedToothTrigger(this, 36, 1, triggerOperationMode, SyncEdge::RiseOnly);
break; break;
case TT_VVT_BOSCH_QUICK_START: case trigger_type_e::TT_VVT_BOSCH_QUICK_START:
configureQuickStartSenderWheel(this); configureQuickStartSenderWheel(this);
break; break;
case TT_VVT_BARRA_3_PLUS_1: case trigger_type_e::TT_VVT_BARRA_3_PLUS_1:
configureBarra3plus1cam(this); configureBarra3plus1cam(this);
break; break;
case TT_HONDA_K_CAM_4_1: case trigger_type_e::TT_HONDA_K_CAM_4_1:
configureHondaK_4_1(this); configureHondaK_4_1(this);
break; break;
case TT_HONDA_K_CRANK_12_1: case trigger_type_e::TT_HONDA_K_CRANK_12_1:
configureHondaK_12_1(this); configureHondaK_12_1(this);
break; break;
case TT_SUBARU_EZ30: case trigger_type_e::TT_SUBARU_EZ30:
initializeSubaruEZ30(this); initializeSubaruEZ30(this);
break; break;
case TT_VVT_MAZDA_SKYACTIV: case trigger_type_e::TT_VVT_MAZDA_SKYACTIV:
initializeMazdaSkyactivCam(this); initializeMazdaSkyactivCam(this);
break; break;
case TT_BENELLI_TRE: case trigger_type_e::TT_BENELLI_TRE:
configureBenelli(this); configureBenelli(this);
break; break;
case TT_MITSU_4G63_CAM: case trigger_type_e::TT_MITSU_4G63_CAM:
initializeMitsubishi4g63Cam(this); initializeMitsubishi4g63Cam(this);
break; break;
case TT_MITSU_4G9x_CAM: case trigger_type_e::TT_MITSU_4G9x_CAM:
initializeMitsubishi4g9xCam(this); initializeMitsubishi4g9xCam(this);
break; break;
case TT_1_16: case trigger_type_e::TT_1_16:
configureOnePlus16(this); configureOnePlus16(this);
break; break;
case TT_HONDA_CBR_600: case trigger_type_e::TT_HONDA_CBR_600:
configureHondaCbr600(this); configureHondaCbr600(this);
break; break;
case TT_CHRYSLER_NGC_36_2_2: case trigger_type_e::TT_CHRYSLER_NGC_36_2_2:
configureChryslerNGC_36_2_2(this); configureChryslerNGC_36_2_2(this);
break; break;
case TT_MITSUBISHI_4G93: case trigger_type_e::TT_MITSUBISHI_4G93:
initializeMitsubishi4G93(this); initializeMitsubishi4G93(this);
break; break;
case TT_DODGE_RAM: case trigger_type_e::TT_DODGE_RAM:
initDodgeRam(this); initDodgeRam(this);
break; break;
case TT_JEEP_4_CYL: case trigger_type_e::TT_JEEP_4_CYL:
initJeep_XJ_4cyl_2500(this); initJeep_XJ_4cyl_2500(this);
break; break;
case TT_JEEP_18_2_2_2: case trigger_type_e::TT_JEEP_18_2_2_2:
initJeep18_2_2_2(this); initJeep18_2_2_2(this);
break; break;
case TT_SUBARU_7_6: case trigger_type_e::TT_SUBARU_7_6:
initializeSubaru7_6(this); initializeSubaru7_6(this);
break; break;
case TT_36_2_2_2: case trigger_type_e::TT_36_2_2_2:
initialize36_2_2_2(this); initialize36_2_2_2(this);
break; break;
case TT_2JZ_3_34: case trigger_type_e::TT_2JZ_3_34:
initialize2jzGE3_34_simulation_shape(this); initialize2jzGE3_34_simulation_shape(this);
break; break;
case TT_12_TOOTH_CRANK: case trigger_type_e::TT_12_TOOTH_CRANK:
configure12ToothCrank(this); configure12ToothCrank(this);
break; break;
case TT_NISSAN_SR20VE: case trigger_type_e::TT_NISSAN_SR20VE:
initializeNissanSR20VE_4(this); initializeNissanSR20VE_4(this);
break; break;
case TT_ROVER_K: case trigger_type_e::TT_ROVER_K:
initializeRoverK(this); initializeRoverK(this);
break; break;
case TT_FIAT_IAW_P8: case trigger_type_e::TT_FIAT_IAW_P8:
configureFiatIAQ_P8(this); configureFiatIAQ_P8(this);
break; break;
case TT_TRI_TACH: case trigger_type_e::TT_TRI_TACH:
configureTriTach(this); configureTriTach(this);
break; break;
case TT_GM_24x: case trigger_type_e::TT_GM_24x:
initGmLS24_5deg(this); initGmLS24_5deg(this);
break; break;
case TT_GM_24x_2: case trigger_type_e::TT_GM_24x_2:
initGmLS24_3deg(this); initGmLS24_3deg(this);
break; break;
case TT_SUBARU_7_WITHOUT_6: case trigger_type_e::TT_SUBARU_7_WITHOUT_6:
initializeSubaruOnly7(this); initializeSubaruOnly7(this);
break; break;
case TT_SUBARU_SVX: case trigger_type_e::TT_SUBARU_SVX:
initializeSubaru_SVX(this); initializeSubaru_SVX(this);
break; break;
case TT_SUBARU_SVX_CRANK_1: case trigger_type_e::TT_SUBARU_SVX_CRANK_1:
initializeSubaru_SVX(this); initializeSubaru_SVX(this);
break; break;
case TT_SUBARU_SVX_CAM_VVT: case trigger_type_e::TT_SUBARU_SVX_CAM_VVT:
initializeSubaru_SVX(this); initializeSubaru_SVX(this);
break; break;

View File

@ -708,7 +708,7 @@ void triggerInfo(void) {
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type, getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
getSyncEdge(TRIGGER_WAVEFORM(syncEdge)), TRIGGER_WAVEFORM(tdcPosition)); getSyncEdge(TRIGGER_WAVEFORM(syncEdge)), TRIGGER_WAVEFORM(tdcPosition));
if (engineConfiguration->trigger.type == TT_TOOTHED_WHEEL) { if (engineConfiguration->trigger.type == trigger_type_e::TT_TOOTHED_WHEEL) {
efiPrintf("total %d/skipped %d", engineConfiguration->trigger.customTotalToothCount, efiPrintf("total %d/skipped %d", engineConfiguration->trigger.customTotalToothCount,
engineConfiguration->trigger.customSkippedToothCount); engineConfiguration->trigger.customSkippedToothCount);
} }

View File

@ -639,7 +639,7 @@ bool TriggerDecoderBase::isSyncPoint(const TriggerWaveform& triggerShape, trigge
// Instead of detecting short/long, this logic first checks for "maybe short" and "maybe long", // Instead of detecting short/long, this logic first checks for "maybe short" and "maybe long",
// then simply tests longer vs. shorter instead of absolute value. // then simply tests longer vs. shorter instead of absolute value.
if (triggerType == TT_MIATA_VVT) { if (triggerType == trigger_type_e::TT_MIATA_VVT) {
auto secondGap = (float)toothDurations[1] / toothDurations[2]; auto secondGap = (float)toothDurations[1] / toothDurations[2];
bool currentGapOk = isInRange(triggerShape.syncronizationRatioFrom[0], (float)triggerSyncGapRatio, triggerShape.syncronizationRatioTo[0]); bool currentGapOk = isInRange(triggerShape.syncronizationRatioFrom[0], (float)triggerSyncGapRatio, triggerShape.syncronizationRatioTo[0]);

Binary file not shown.

View File

@ -83,9 +83,6 @@ public class ParseState implements DefinitionsState {
if (stringValueMap == null) if (stringValueMap == null)
return null; return null;
for (Value value : stringValueMap.values()) { for (Value value : stringValueMap.values()) {
if (value.isForceSize())
continue;
if (isNumeric(value.getValue())) { if (isNumeric(value.getValue())) {
valueNameById.put(value.getIntValue(), value.getName()); valueNameById.put(value.getIntValue(), value.getName());
} else { } else {

Binary file not shown.

View File

@ -12,10 +12,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class ToJavaEnum { public class ToJavaEnum {
public static final String FORCE_2_BYTES_SIZE = "Force_2_bytes_size";
public static final String FORCE_4_BYTES_SIZE = "Force_4_bytes_size";
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
InvokeReader invokeReader = new InvokeReader(args).invoke(); InvokeReader invokeReader = new InvokeReader(args).invoke();
String outputPath = invokeReader.getOutputPath(); String outputPath = invokeReader.getOutputPath();
@ -61,9 +57,7 @@ public class ToJavaEnum {
int index = 0; int index = 0;
for (Value value : sorted) { for (Value value : sorted) {
int numericValue = value.getIntValueMaybeResolve(registry); int numericValue = value.getIntValueMaybeResolve(registry);
if (index != numericValue if (index != numericValue)
&& !value.getName().startsWith(FORCE_2_BYTES_SIZE)
&& !value.getName().startsWith(FORCE_4_BYTES_SIZE))
throw new IllegalStateException("Got explicit ordinal " + numericValue + " instead of ordinal " + index + " in " + value); throw new IllegalStateException("Got explicit ordinal " + numericValue + " instead of ordinal " + index + " in " + value);
sb.append("\t" + value.getName() + ",\n"); sb.append("\t" + value.getName() + ",\n");
index++; index++;

View File

@ -110,9 +110,6 @@ public class VariableRegistry {
TreeMap<Integer, String> valueNameById = new TreeMap<>(); TreeMap<Integer, String> valueNameById = new TreeMap<>();
for (Value value : stringValueMap.values()) { for (Value value : stringValueMap.values()) {
if (value.isForceSize())
continue;
if (isNumeric(value.getValue())) { if (isNumeric(value.getValue())) {
valueNameById.put(value.getIntValue(), value.getName()); valueNameById.put(value.getIntValue(), value.getName());
} else { } else {

View File

@ -4,9 +4,6 @@ import com.rusefi.VariableRegistry;
import java.util.Objects; import java.util.Objects;
import static com.rusefi.ToJavaEnum.FORCE_2_BYTES_SIZE;
import static com.rusefi.ToJavaEnum.FORCE_4_BYTES_SIZE;
public class Value implements Comparable<Value> { public class Value implements Comparable<Value> {
private final String name; private final String name;
private final String value; private final String value;
@ -16,10 +13,6 @@ public class Value implements Comparable<Value> {
this.value = value; this.value = value;
} }
public boolean isForceSize() {
return getName().startsWith(FORCE_2_BYTES_SIZE) || getName().startsWith(FORCE_4_BYTES_SIZE);
}
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -26,7 +26,6 @@ public class EnumToStringTest {
assertTrue(isKeyValueLine("MIN")); assertTrue(isKeyValueLine("MIN"));
assertTrue(isKeyValueLine("MIN = 2,")); assertTrue(isKeyValueLine("MIN = 2,"));
assertTrue(isKeyValueLine("MIN = -3,")); assertTrue(isKeyValueLine("MIN = -3,"));
assertTrue(isKeyValueLine("Force_4_bytes_size_operation_mode_e = ENUM_32_BITS,"));
assertTrue(isKeyValueLine("MIN = 0x02,")); assertTrue(isKeyValueLine("MIN = 0x02,"));
assertTrue(isKeyValueLine("MIN = 0xa2,")); assertTrue(isKeyValueLine("MIN = 0xa2,"));
assertTrue(isKeyValueLine("MIN = 0xB2,")); assertTrue(isKeyValueLine("MIN = 0xB2,"));

View File

@ -206,7 +206,7 @@ void EngineTestHelper::fireTriggerEventsWithDuration(float durationMs) {
/** /**
* Sends specified number of rise/fall trigger events, with specified amount of time between those. * Sends specified number of rise/fall trigger events, with specified amount of time between those.
* *
* This is helpful for TT_ONE trigger wheel decoder and probably other decoders as well. * This is helpful for trigger_type_e::TT_ONE trigger wheel decoder and probably other decoders as well.
*/ */
void EngineTestHelper::fireTriggerEvents2(int count, float durationMs) { void EngineTestHelper::fireTriggerEvents2(int count, float durationMs) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@ -388,7 +388,7 @@ void EngineTestHelper::executeUntil(int timeUs) {
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injectionMode) { void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injectionMode) {
setCamOperationMode(); setCamOperationMode();
setupSimpleTestEngineWithMaf(eth, injectionMode, TT_ONE); setupSimpleTestEngineWithMaf(eth, injectionMode, trigger_type_e::TT_ONE);
} }
void setVerboseTrigger(bool isEnabled) { void setVerboseTrigger(bool isEnabled) {

View File

@ -2,7 +2,7 @@
#include "fuel_math.h" #include "fuel_math.h"
TEST(Actuators, AntiLag) { TEST(Actuators, AntiLag) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->antiLagEnabled = true; engineConfiguration->antiLagEnabled = true;

View File

@ -12,7 +12,7 @@ TEST(BoostControl, Setpoint) {
EXPECT_CALL(targetMap, getValue(_, _)) EXPECT_CALL(targetMap, getValue(_, _))
.WillRepeatedly([](float xRpm, float tps) { return tps; }); .WillRepeatedly([](float xRpm, float tps) { return tps; });
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->boostType = CLOSED_LOOP; engineConfiguration->boostType = CLOSED_LOOP;
BoostController bc; BoostController bc;
@ -32,7 +32,7 @@ TEST(BoostControl, Setpoint) {
} }
TEST(BoostControl, ObservePlant) { TEST(BoostControl, ObservePlant) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
BoostController bc; BoostController bc;
@ -53,7 +53,7 @@ TEST(BoostControl, OpenLoop) {
EXPECT_CALL(openMap, getValue(_, _)) EXPECT_CALL(openMap, getValue(_, _))
.WillRepeatedly([](float xRpm, float tps) { return tps; }); .WillRepeatedly([](float xRpm, float tps) { return tps; });
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
BoostController bc; BoostController bc;
@ -68,7 +68,7 @@ TEST(BoostControl, OpenLoop) {
} }
TEST(BoostControl, TestClosedLoop) { TEST(BoostControl, TestClosedLoop) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
BoostController bc; BoostController bc;
@ -107,7 +107,7 @@ TEST(BoostControl, TestClosedLoop) {
} }
TEST(BoostControl, SetOutput) { TEST(BoostControl, SetOutput) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->isBoostControlEnabled = true; engineConfiguration->isBoostControlEnabled = true;

View File

@ -21,7 +21,7 @@ using ::testing::StrictMock;
TEST(etb, initializationNoPedal) { TEST(etb, initializationNoPedal) {
StrictMock<MockEtb> mocks[ETB_COUNT]; StrictMock<MockEtb> mocks[ETB_COUNT];
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) { for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &mocks[i]; engine->etbControllers[i] = &mocks[i];
@ -37,7 +37,7 @@ TEST(etb, initializationNoPedal) {
TEST(etb, initializationMissingThrottle) { TEST(etb, initializationMissingThrottle) {
StrictMock<MockEtb> mocks[ETB_COUNT]; StrictMock<MockEtb> mocks[ETB_COUNT];
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) { EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = DC_None; engineConfiguration->etbFunctions[0] = DC_None;
engineConfiguration->etbFunctions[1] = DC_None; engineConfiguration->etbFunctions[1] = DC_None;
}); });
@ -63,7 +63,7 @@ TEST(etb, initializationSingleThrottle) {
EXPECT_CALL(mocks[0], isEtbMode()) EXPECT_CALL(mocks[0], isEtbMode())
.WillOnce(Return(TRUE)); .WillOnce(Return(TRUE));
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) { EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = DC_Throttle1; engineConfiguration->etbFunctions[0] = DC_Throttle1;
engineConfiguration->etbFunctions[1] = DC_None; engineConfiguration->etbFunctions[1] = DC_None;
}); });
@ -91,7 +91,7 @@ TEST(etb, initializationSingleThrottleInSecondSlot) {
EXPECT_CALL(mocks[1], isEtbMode()) EXPECT_CALL(mocks[1], isEtbMode())
.WillOnce(Return(TRUE)); .WillOnce(Return(TRUE));
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) { EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = DC_None; engineConfiguration->etbFunctions[0] = DC_None;
engineConfiguration->etbFunctions[1] = DC_Throttle1; engineConfiguration->etbFunctions[1] = DC_Throttle1;
}); });
@ -121,7 +121,7 @@ TEST(etb, initializationDualThrottle) {
EXPECT_CALL(mocks[1], isEtbMode()) EXPECT_CALL(mocks[1], isEtbMode())
.WillOnce(Return(TRUE)); .WillOnce(Return(TRUE));
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) { for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &mocks[i]; engine->etbControllers[i] = &mocks[i];
@ -152,7 +152,7 @@ TEST(etb, initializationWastegate) {
EXPECT_CALL(mocks[0], isEtbMode()) EXPECT_CALL(mocks[0], isEtbMode())
.WillOnce(Return(false)); .WillOnce(Return(false));
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) { EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = DC_Wastegate; engineConfiguration->etbFunctions[0] = DC_Wastegate;
engineConfiguration->etbFunctions[1] = DC_None; engineConfiguration->etbFunctions[1] = DC_None;
}); });
@ -234,7 +234,7 @@ TEST(etb, initializationNoThrottles) {
// This tests the case where you don't want an ETB, and expect everything to go fine // This tests the case where you don't want an ETB, and expect everything to go fine
EtbController duts[2]; EtbController duts[2];
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) { for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &duts[i]; engine->etbControllers[i] = &duts[i];
@ -257,7 +257,7 @@ TEST(etb, initializationNoThrottles) {
TEST(etb, idlePlumbing) { TEST(etb, idlePlumbing) {
StrictMock<MockEtb> mocks[ETB_COUNT]; StrictMock<MockEtb> mocks[ETB_COUNT];
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true); Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
@ -271,7 +271,7 @@ TEST(etb, idlePlumbing) {
} }
TEST(etb, testSetpointOnlyPedal) { TEST(etb, testSetpointOnlyPedal) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
EtbController etb; EtbController etb;
@ -330,7 +330,7 @@ TEST(etb, testSetpointOnlyPedal) {
} }
TEST(etb, setpointSecondThrottleTrim) { TEST(etb, setpointSecondThrottleTrim) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Mock pedal map that's just passthru pedal -> target // Mock pedal map that's just passthru pedal -> target
StrictMock<MockVp3d> pedalMap; StrictMock<MockVp3d> pedalMap;
@ -357,7 +357,7 @@ TEST(etb, setpointSecondThrottleTrim) {
} }
TEST(etb, setpointIdle) { TEST(etb, setpointIdle) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Use ETB for idle, but don't give it any range (yet) // Use ETB for idle, but don't give it any range (yet)
engineConfiguration->etbIdleThrottleRange = 0; engineConfiguration->etbIdleThrottleRange = 0;
@ -413,7 +413,7 @@ TEST(etb, setpointIdle) {
} }
TEST(etb, setpointRevLimit) { TEST(etb, setpointRevLimit) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Configure 5000 limit start, with 750 rpm taper // Configure 5000 limit start, with 750 rpm taper
engineConfiguration->etbRevLimitStart = 5000; engineConfiguration->etbRevLimitStart = 5000;
@ -488,7 +488,7 @@ TEST(etb, setpointWastegateController) {
} }
TEST(etb, setpointLuaAdder) { TEST(etb, setpointLuaAdder) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
Sensor::setMockValue(SensorType::Tps1Primary, 0); Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -570,7 +570,7 @@ TEST(etb, etbTpsSensor) {
} }
TEST(etb, setOutputInvalid) { TEST(etb, setOutputInvalid) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init // Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0); Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -589,7 +589,7 @@ TEST(etb, setOutputInvalid) {
} }
TEST(etb, setOutputValid) { TEST(etb, setOutputValid) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -609,7 +609,7 @@ TEST(etb, setOutputValid) {
} }
TEST(etb, setOutputValid2) { TEST(etb, setOutputValid2) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -629,7 +629,7 @@ TEST(etb, setOutputValid2) {
} }
TEST(etb, setOutputOutOfRangeHigh) { TEST(etb, setOutputOutOfRangeHigh) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -649,7 +649,7 @@ TEST(etb, setOutputOutOfRangeHigh) {
} }
TEST(etb, setOutputOutOfRangeLow) { TEST(etb, setOutputOutOfRangeLow) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -669,7 +669,7 @@ TEST(etb, setOutputOutOfRangeLow) {
} }
TEST(etb, setOutputPauseControl) { TEST(etb, setOutputPauseControl) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -690,7 +690,7 @@ TEST(etb, setOutputPauseControl) {
} }
TEST(etb, setOutputLimpHome) { TEST(etb, setOutputLimpHome) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockMotor> motor; StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup // Must have TPS & PPS initialized for ETB setup
@ -742,7 +742,7 @@ TEST(etb, closedLoopPid) {
extern int timeNowUs; extern int timeNowUs;
TEST(etb, jamDetection) { TEST(etb, jamDetection) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
pid_s pid = {}; pid_s pid = {};
@ -793,7 +793,7 @@ TEST(etb, jamDetection) {
} }
TEST(etb, openLoopThrottle) { TEST(etb, openLoopThrottle) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init // Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0); Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -815,7 +815,7 @@ TEST(etb, openLoopThrottle) {
} }
TEST(etb, openLoopNonThrottle) { TEST(etb, openLoopNonThrottle) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init // Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0); Sensor::setMockValue(SensorType::Tps1Primary, 0);

View File

@ -24,7 +24,7 @@ static EtbController * initEtbIntegratedTest() {
} }
TEST(etb, integrated) { TEST(etb, integrated) {
EngineTestHelper eth(TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method EngineTestHelper eth(engine_type_e::TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method
EtbController *etb = initEtbIntegratedTest(); EtbController *etb = initEtbIntegratedTest();
Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 40); Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 40);
@ -50,7 +50,7 @@ TEST(etb, integrated) {
extern int timeNowUs; extern int timeNowUs;
TEST(etb, intermittentTps) { TEST(etb, intermittentTps) {
EngineTestHelper eth(TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method EngineTestHelper eth(engine_type_e::TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method
EtbController *etb = initEtbIntegratedTest(); EtbController *etb = initEtbIntegratedTest();
// Tell the sensor checker that the ignition is on // Tell the sensor checker that the ignition is on
@ -94,7 +94,7 @@ TEST(etb, intermittentTps) {
} }
TEST(etb, intermittentPps) { TEST(etb, intermittentPps) {
EngineTestHelper eth(TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method EngineTestHelper eth(engine_type_e::TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method
Sensor::setMockValue(SensorType::AcceleratorPedal, 10, true); Sensor::setMockValue(SensorType::AcceleratorPedal, 10, true);
EtbController *etb = initEtbIntegratedTest(); EtbController *etb = initEtbIntegratedTest();

View File

@ -3,7 +3,7 @@
#include "fan_control.h" #include "fan_control.h"
TEST(Actuators, Fan) { TEST(Actuators, Fan) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->fanOnTemperature = 90; engineConfiguration->fanOnTemperature = 90;
engineConfiguration->fanOffTemperature = 80; engineConfiguration->fanOffTemperature = 80;

View File

@ -12,7 +12,7 @@
extern int timeNowUs; extern int timeNowUs;
TEST(Actuators, FuelPump) { TEST(Actuators, FuelPump) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
FuelPumpController dut; FuelPumpController dut;

View File

@ -74,7 +74,7 @@ TEST(GpPwm, OutputOnOff) {
} }
TEST(GpPwm, TestGetOutput) { TEST(GpPwm, TestGetOutput) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
GppwmChannel ch; GppwmChannel ch;
gppwm_channel cfg; gppwm_channel cfg;

View File

@ -3,7 +3,7 @@
#include "main_relay.h" #include "main_relay.h"
TEST(Actuators, MainRelay) { TEST(Actuators, MainRelay) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
MainRelayController dut; MainRelayController dut;

View File

@ -5,7 +5,7 @@ extern float getTachDuty(void);
TEST(Actuators, Tachometer) { TEST(Actuators, Tachometer) {
// This engine has a tach pin set - we need that // This engine has a tach pin set - we need that
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003); EngineTestHelper eth(engine_type_e::FRANKENSO_MAZDA_MIATA_2003);
// We don't actually care about ign/inj at all, just tach // We don't actually care about ign/inj at all, just tach
engineConfiguration->isInjectionEnabled = false; engineConfiguration->isInjectionEnabled = false;
@ -18,7 +18,7 @@ TEST(Actuators, Tachometer) {
engineConfiguration->tachPulseDurationAsDutyCycle = true; engineConfiguration->tachPulseDurationAsDutyCycle = true;
// Set predictable trigger settings // Set predictable trigger settings
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 8; engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customSkippedToothCount = 0;
setCamOperationMode(); setCamOperationMode();

View File

@ -6,7 +6,7 @@ using ::testing::StrictMock;
using ::testing::Return; using ::testing::Return;
TEST(Vvt, TestSetPoint) { TEST(Vvt, TestSetPoint) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Set up a mock target map // Set up a mock target map
StrictMock<MockVp3d> targetMap; StrictMock<MockVp3d> targetMap;
@ -25,7 +25,7 @@ TEST(Vvt, TestSetPoint) {
} }
TEST(Vvt, observePlant) { TEST(Vvt, observePlant) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engine->triggerCentral.vvtPosition[0][0] = 23; engine->triggerCentral.vvtPosition[0][0] = 23;
@ -43,7 +43,7 @@ TEST(Vvt, openLoop) {
} }
TEST(Vvt, ClosedLoopNotInverted) { TEST(Vvt, ClosedLoopNotInverted) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
VvtController dut; VvtController dut;
dut.init(0, 0, 0, nullptr); dut.init(0, 0, 0, nullptr);
@ -58,7 +58,7 @@ TEST(Vvt, ClosedLoopNotInverted) {
} }
TEST(Vvt, ClosedLoopInverted) { TEST(Vvt, ClosedLoopInverted) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
VvtController dut; VvtController dut;
dut.init(0, 0, 0, nullptr); dut.init(0, 0, 0, nullptr);

View File

@ -30,7 +30,7 @@ static void doRevolution(EngineTestHelper& eth, int periodMs) {
// https://github.com/rusefi/rusefi/issues/1592 // https://github.com/rusefi/rusefi/issues/1592
TEST(fuelControl, transitionIssue1592) { TEST(fuelControl, transitionIssue1592) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
@ -40,7 +40,7 @@ TEST(fuelControl, transitionIssue1592) {
// This is easiest to trip on a wheel that requires sync // This is easiest to trip on a wheel that requires sync
engineConfiguration->trigger.customTotalToothCount = 6; engineConfiguration->trigger.customTotalToothCount = 6;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;
eth.setTriggerType(TT_TOOTHED_WHEEL); eth.setTriggerType(trigger_type_e::TT_TOOTHED_WHEEL);
setCamOperationMode(); setCamOperationMode();
engineConfiguration->isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;

View File

@ -9,7 +9,7 @@
TEST(scheduler, dwellIssue796) { TEST(scheduler, dwellIssue796) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */); eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);

View File

@ -16,7 +16,7 @@ using ::testing::_;
#define EXPECT_CUT() EXPECT_FLOAT_EQ(0, engine->engineState.injectionDuration) #define EXPECT_CUT() EXPECT_FLOAT_EQ(0, engine->engineState.injectionDuration)
TEST(fuelCut, coasting) { TEST(fuelCut, coasting) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _))
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));
@ -131,7 +131,7 @@ TEST(fuelCut, coasting) {
} }
TEST(fuelCut, delay) { TEST(fuelCut, delay) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _))
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));

View File

@ -14,7 +14,7 @@ public:
}; };
TEST(FuelComputer, getCycleFuel) { TEST(FuelComputer, getCycleFuel) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
MockFuelComputer dut; MockFuelComputer dut;
@ -30,7 +30,7 @@ TEST(FuelComputer, getCycleFuel) {
} }
TEST(FuelComputer, FlexFuel) { TEST(FuelComputer, FlexFuel) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
FuelComputer dut; FuelComputer dut;

View File

@ -16,7 +16,7 @@ using ::testing::FloatNear;
TEST(misc, testFuelMap) { TEST(misc, testFuelMap) {
printf("Setting up FORD_ASPIRE_1996\r\n"); printf("Setting up FORD_ASPIRE_1996\r\n");
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) { for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
engineConfiguration->injector.battLagCorrBins[i] = i; engineConfiguration->injector.battLagCorrBins[i] = i;
@ -129,7 +129,7 @@ static void configureFordAspireTriggerWaveform(TriggerWaveform * s) {
TEST(misc, testAngleResolver) { TEST(misc, testAngleResolver) {
printf("*************************************************** testAngleResolver\r\n"); printf("*************************************************** testAngleResolver\r\n");
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
engineConfiguration->globalTriggerAngleOffset = 175; engineConfiguration->globalTriggerAngleOffset = 175;

View File

@ -10,7 +10,7 @@ using ::testing::InSequence;
using ::testing::_; using ::testing::_;
TEST(FuelMath, getStandardAirCharge) { TEST(FuelMath, getStandardAirCharge) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Miata 1839cc 4cyl // Miata 1839cc 4cyl
engineConfiguration->displacement = 1.839f; engineConfiguration->displacement = 1.839f;
@ -37,7 +37,7 @@ TEST(FuelMath, getStandardAirCharge) {
} }
TEST(AirmassModes, AlphaNNormal) { TEST(AirmassModes, AlphaNNormal) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// 4 cylinder 4 liter = easy math // 4 cylinder 4 liter = easy math
engineConfiguration->displacement = 4.0f; engineConfiguration->displacement = 4.0f;
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
@ -61,7 +61,7 @@ TEST(AirmassModes, AlphaNNormal) {
} }
TEST(AirmassModes, AlphaNFailedTps) { TEST(AirmassModes, AlphaNFailedTps) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Shouldn't get called // Shouldn't get called
StrictMock<MockVp3d> veTable; StrictMock<MockVp3d> veTable;
@ -78,7 +78,7 @@ TEST(AirmassModes, AlphaNFailedTps) {
} }
TEST(AirmassModes, MafNormal) { TEST(AirmassModes, MafNormal) {
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
engineConfiguration->fuelAlgorithm = LM_REAL_MAF; engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
engineConfiguration->injector.flow = 200; engineConfiguration->injector.flow = 200;
@ -119,7 +119,7 @@ TEST(AirmassModes, VeOverride) {
} }
}; };
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
DummyAirmassModel dut(veTable); DummyAirmassModel dut(veTable);
// Use default mode - will call with 10 // Use default mode - will call with 10
@ -148,7 +148,7 @@ TEST(AirmassModes, FallbackMap) {
EXPECT_CALL(mapFallback, getValue(5678, 20)).WillOnce(Return(75)); EXPECT_CALL(mapFallback, getValue(5678, 20)).WillOnce(Return(75));
} }
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
SpeedDensityAirmass dut(veTable, mapFallback); SpeedDensityAirmass dut(veTable, mapFallback);
@ -167,7 +167,7 @@ TEST(AirmassModes, FallbackMap) {
void setInjectionMode(int value); void setInjectionMode(int value);
TEST(FuelMath, testDifferentInjectionModes) { TEST(FuelMath, testDifferentInjectionModes) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _))
@ -192,7 +192,7 @@ TEST(FuelMath, testDifferentInjectionModes) {
} }
TEST(FuelMath, deadtime) { TEST(FuelMath, deadtime) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
@ -212,7 +212,7 @@ TEST(FuelMath, deadtime) {
} }
TEST(FuelMath, CylinderFuelTrim) { TEST(FuelMath, CylinderFuelTrim) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_, _))
.WillRepeatedly(Return(AirmassResult{1, 50.0f})); .WillRepeatedly(Return(AirmassResult{1, 50.0f}));
@ -242,7 +242,7 @@ struct MockIdle : public MockIdleController {
}; };
TEST(FuelMath, IdleVeTable) { TEST(FuelMath, IdleVeTable) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
MockAirmass dut; MockAirmass dut;

View File

@ -16,7 +16,7 @@ struct MockWallController : public IWallFuelController {
}; };
TEST(fuel, testWallWettingEnrichmentMath) { TEST(fuel, testWallWettingEnrichmentMath) {
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
MockWallController wallController; MockWallController wallController;
@ -62,12 +62,12 @@ TEST(fuel, testWallWettingEnrichmentMath) {
TEST(fuel, testWallWettingEnrichmentScheduling) { TEST(fuel, testWallWettingEnrichmentScheduling) {
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
setCrankOperationMode(); setCrankOperationMode();
eth.setTriggerType(TT_ONE); eth.setTriggerType(trigger_type_e::TT_ONE);
eth.fireTriggerEvents2(/* count */ 4, 25 /* ms */); eth.fireTriggerEvents2(/* count */ 4, 25 /* ms */);

View File

@ -11,7 +11,7 @@
using ::testing::_; using ::testing::_;
TEST(ignition, twoCoils) { TEST(ignition, twoCoils) {
EngineTestHelper eth(FRANKENSO_BMW_M73_F); EngineTestHelper eth(engine_type_e::FRANKENSO_BMW_M73_F);
// let's recalculate with zero timing so that we can focus on relation advance between cylinders // let's recalculate with zero timing so that we can focus on relation advance between cylinders
setArrayValues(engine->engineState.timingAdvance, 0.0f); setArrayValues(engine->engineState.timingAdvance, 0.0f);
@ -43,7 +43,7 @@ TEST(ignition, twoCoils) {
} }
TEST(ignition, trailingSpark) { TEST(ignition, trailingSpark) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
/** /**
@ -127,7 +127,7 @@ TEST(ignition, trailingSpark) {
} }
TEST(ignition, CylinderTimingTrim) { TEST(ignition, CylinderTimingTrim) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Base timing 15 degrees // Base timing 15 degrees
setTable(config->ignitionTable, 15); setTable(config->ignitionTable, 15);

View File

@ -106,7 +106,7 @@ TEST(InjectorModel, nonLinearFordMode) {
} }
TEST(InjectorModel, nonlinearPolynomial) { TEST(InjectorModel, nonlinearPolynomial) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
InjectorModel dut; InjectorModel dut;
engineConfiguration->applyNonlinearBelowPulse = 10; engineConfiguration->applyNonlinearBelowPulse = 10;
@ -130,7 +130,7 @@ TEST(InjectorModel, nonlinearPolynomial) {
} }
TEST(InjectorModel, Deadtime) { TEST(InjectorModel, Deadtime) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Some test data in the injector correction table // Some test data in the injector correction table
for (size_t i = 0; i < efi::size(engineConfiguration->injector.battLagCorr); i++) { for (size_t i = 0; i < efi::size(engineConfiguration->injector.battLagCorr); i++) {
@ -172,7 +172,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
StrictMock<TesterGetRailPressure> dut; StrictMock<TesterGetRailPressure> dut;
EXPECT_CALL(dut, getFuelDifferentialPressure()).WillOnce(Return(400 * pressureRatio)); EXPECT_CALL(dut, getFuelDifferentialPressure()).WillOnce(Return(400 * pressureRatio));
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Use injector compensation // Use injector compensation
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -187,7 +187,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
TEST(InjectorModel, NegativePressureDelta) { TEST(InjectorModel, NegativePressureDelta) {
StrictMock<TesterGetRailPressure> dut; StrictMock<TesterGetRailPressure> dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Use injector compensation // Use injector compensation
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -204,7 +204,7 @@ TEST(InjectorModel, NegativePressureDelta) {
TEST(InjectorModel, VariableInjectorFlowModeNone) { TEST(InjectorModel, VariableInjectorFlowModeNone) {
StrictMock<TesterGetRailPressure> dut; StrictMock<TesterGetRailPressure> dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->injectorCompensationMode = ICM_None; engineConfiguration->injectorCompensationMode = ICM_None;
@ -215,7 +215,7 @@ TEST(InjectorModel, VariableInjectorFlowModeNone) {
TEST(InjectorModel, RailPressureFixed) { TEST(InjectorModel, RailPressureFixed) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->fuelReferencePressure = 350; engineConfiguration->fuelReferencePressure = 350;
@ -234,7 +234,7 @@ TEST(InjectorModel, RailPressureFixed) {
TEST(InjectorModel, RailPressureSensedAbsolute) { TEST(InjectorModel, RailPressureSensedAbsolute) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -254,7 +254,7 @@ TEST(InjectorModel, RailPressureSensedAbsolute) {
TEST(InjectorModel, RailPressureSensedGauge) { TEST(InjectorModel, RailPressureSensedGauge) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -275,7 +275,7 @@ TEST(InjectorModel, RailPressureSensedGauge) {
TEST(InjectorModel, RailPressureSensedDifferential) { TEST(InjectorModel, RailPressureSensedDifferential) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -293,7 +293,7 @@ TEST(InjectorModel, RailPressureSensedDifferential) {
TEST(InjectorModel, FailedPressureSensor) { TEST(InjectorModel, FailedPressureSensor) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -311,7 +311,7 @@ TEST(InjectorModel, FailedPressureSensor) {
TEST(InjectorModel, MissingPressureSensor) { TEST(InjectorModel, MissingPressureSensor) {
InjectorModel dut; InjectorModel dut;
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Reference pressure is 350kpa // Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure; engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;

View File

@ -9,7 +9,7 @@
#include "advance_map.h" #include "advance_map.h"
TEST(Multispark, DefaultConfiguration) { TEST(Multispark, DefaultConfiguration) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
EXPECT_EQ(0, getMultiSparkCount(0 )); EXPECT_EQ(0, getMultiSparkCount(0 ));
EXPECT_EQ(0, getMultiSparkCount(100 )); EXPECT_EQ(0, getMultiSparkCount(100 ));
@ -37,7 +37,7 @@ static void multisparkCfg() {
} }
TEST(Multispark, EnabledNoMaxRpm) { TEST(Multispark, EnabledNoMaxRpm) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
multisparkCfg(); multisparkCfg();
@ -62,7 +62,7 @@ TEST(Multispark, EnabledNoMaxRpm) {
} }
TEST(Multispark, RpmLimit) { TEST(Multispark, RpmLimit) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
multisparkCfg(); multisparkCfg();

View File

@ -7,7 +7,7 @@
#include "spark_logic.h" #include "spark_logic.h"
TEST(issues, issueOneCylinderSpecialCase968) { TEST(issues, issueOneCylinderSpecialCase968) {
EngineTestHelper eth(GY6_139QMB); EngineTestHelper eth(engine_type_e::GY6_139QMB);
setTable(config->injectionPhase, -180.0f); setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
@ -16,7 +16,7 @@ TEST(issues, issueOneCylinderSpecialCase968) {
setCrankOperationMode(); setCrankOperationMode();
eth.setTriggerType(TT_ONE); eth.setTriggerType(trigger_type_e::TT_ONE);
ASSERT_EQ( 0, engine->executor.size()) << "start"; ASSERT_EQ( 0, engine->executor.size()) << "start";

View File

@ -8,7 +8,7 @@
#include "pch.h" #include "pch.h"
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) { TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
setTable(config->injectionPhase, -180.0f); setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
@ -34,7 +34,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
TEST(priming, startScheduling) { TEST(priming, startScheduling) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
ASSERT_EQ( 0, Sensor::getOrZero(SensorType::Rpm)) << "RPM=0"; ASSERT_EQ( 0, Sensor::getOrZero(SensorType::Rpm)) << "RPM=0";
@ -45,7 +45,7 @@ TEST(priming, startScheduling) {
} }
TEST(priming, duration) { TEST(priming, duration) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
MockInjectorModel2 injectorModel; MockInjectorModel2 injectorModel;
engine->module<InjectorModel>().set(&injectorModel); engine->module<InjectorModel>().set(&injectorModel);

View File

@ -2,7 +2,7 @@
#include "value_lookup.h" #include "value_lookup.h"
TEST(LuaBasic, configLookup) { TEST(LuaBasic, configLookup) {
EngineTestHelper eth(FORD_ESCORT_GT); EngineTestHelper eth(engine_type_e::FORD_ESCORT_GT);
{ {
const char * name = "ignitionDwellForCrankingMs"; const char * name = "ignitionDwellForCrankingMs";
setConfigValueByName(name, 1.6); setConfigValueByName(name, 1.6);

View File

@ -23,7 +23,7 @@ TEST(LuaHooks, TestCrc8) {
} }
TEST(LuaHooks, TestGetCalibration) { TEST(LuaHooks, TestGetCalibration) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
const char* sourceCode = R"( const char* sourceCode = R"(
function testFunc() function testFunc()
@ -35,7 +35,7 @@ TEST(LuaHooks, TestGetCalibration) {
} }
TEST(LuaHooks, TestSetCalibration) { TEST(LuaHooks, TestSetCalibration) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
const char* sourceCode = R"( const char* sourceCode = R"(
function testFunc() function testFunc()
@ -92,7 +92,7 @@ TEST(LuaHooks, Table3d) {
end end
)"; )";
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
setTable(config->scriptTable2, (uint8_t)33); setTable(config->scriptTable2, (uint8_t)33);
EXPECT_EQ(testLuaReturnsNumber(tableTest), 33); EXPECT_EQ(testLuaReturnsNumber(tableTest), 33);

View File

@ -9,7 +9,7 @@
TEST(LuaVin, Test) { TEST(LuaVin, Test) {
EngineTestHelper eth(TEST_CRANK_ENGINE); EngineTestHelper eth(engine_type_e::TEST_CRANK_ENGINE);
strcpy(engineConfiguration->vinNumber, "GM123"); strcpy(engineConfiguration->vinNumber, "GM123");

View File

@ -19,7 +19,7 @@ end
)"; )";
TEST(LuaHooks, TestCurve) { TEST(LuaHooks, TestCurve) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
strcpy(engineConfiguration->scriptCurveName[3], "hello"); strcpy(engineConfiguration->scriptCurveName[3], "hello");
setLinearCurve(config->scriptCurve4, 500, 600, 1); setLinearCurve(config->scriptCurve4, 500, 600, 1);

View File

@ -50,7 +50,7 @@ public:
*/ */
TEST_F(FrequencySensorTest, testValidWithPwm) { TEST_F(FrequencySensorTest, testValidWithPwm) {
ASSERT_TRUE(dut.Register()); ASSERT_TRUE(dut.Register());
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Should be invalid - not set yet // Should be invalid - not set yet
{ {

View File

@ -24,7 +24,7 @@ static void postToFuncSensor(Sensor* s, float value) {
} }
TEST(SensorInit, Tps) { TEST(SensorInit, Tps) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->tpsMin = 200; // 1 volt engineConfiguration->tpsMin = 200; // 1 volt
engineConfiguration->tpsMax = 800; // 4 volts engineConfiguration->tpsMax = 800; // 4 volts
@ -50,7 +50,7 @@ TEST(SensorInit, Tps) {
} }
TEST(SensorInit, TpsValuesTooClose) { TEST(SensorInit, TpsValuesTooClose) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Should fail, 0.49 volts apart // Should fail, 0.49 volts apart
engineConfiguration->tpsMin = 200; // 1.00 volt engineConfiguration->tpsMin = 200; // 1.00 volt
@ -97,7 +97,7 @@ TEST(SensorInit, TpsValuesTooClose) {
} }
TEST(SensorInit, Pedal) { TEST(SensorInit, Pedal) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_0; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_0;
engineConfiguration->throttlePedalUpVoltage = 1; engineConfiguration->throttlePedalUpVoltage = 1;
@ -124,7 +124,7 @@ TEST(SensorInit, Pedal) {
} }
TEST(SensorInit, DriverIntentNoPedal) { TEST(SensorInit, DriverIntentNoPedal) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// We have no pedal - so we should get the TPS // We have no pedal - so we should get the TPS
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
@ -145,7 +145,7 @@ TEST(SensorInit, DriverIntentNoPedal) {
TEST(SensorInit, DriverIntentWithPedal) { TEST(SensorInit, DriverIntentWithPedal) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// We have a pedal, so we should get it // We have a pedal, so we should get it
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_0; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_0;
@ -164,7 +164,7 @@ TEST(SensorInit, DriverIntentWithPedal) {
} }
TEST(SensorInit, OilPressure) { TEST(SensorInit, OilPressure) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->oilPressure.hwChannel = EFI_ADC_0; engineConfiguration->oilPressure.hwChannel = EFI_ADC_0;
engineConfiguration->oilPressure.v1 = 1; engineConfiguration->oilPressure.v1 = 1;
@ -189,7 +189,7 @@ TEST(SensorInit, OilPressure) {
} }
TEST(SensorInit, Clt) { TEST(SensorInit, Clt) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// 2003 neon sensor // 2003 neon sensor
engineConfiguration->clt.config = {0, 30, 100, 32500, 7550, 700, 2700}; engineConfiguration->clt.config = {0, 30, 100, 32500, 7550, 700, 2700};
@ -212,7 +212,7 @@ TEST(SensorInit, Clt) {
} }
TEST(SensorInit, Lambda) { TEST(SensorInit, Lambda) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// No channel -> no sensor // No channel -> no sensor
initLambda(); initLambda();
@ -233,7 +233,7 @@ TEST(SensorInit, Lambda) {
} }
TEST(SensorInit, Map) { TEST(SensorInit, Map) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4; engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
initMap(); initMap();

View File

@ -1,7 +1,7 @@
#include "pch.h" #include "pch.h"
#include "turbocharger_speed_converter.h" #include "turbocharger_speed_converter.h"
static constexpr engine_type_e ENGINE_TEST_HELPER = TEST_ENGINE; static constexpr engine_type_e ENGINE_TEST_HELPER = engine_type_e::TEST_ENGINE;
class TurbochargerSpeedConverterTest : public ::testing::Test { class TurbochargerSpeedConverterTest : public ::testing::Test {

View File

@ -3,7 +3,7 @@
float GetVssFor(float revPerKm, float axle, float teeth, float hz) { float GetVssFor(float revPerKm, float axle, float teeth, float hz) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
VehicleSpeedConverter dut; VehicleSpeedConverter dut;

View File

@ -15,7 +15,7 @@
TEST(fuel, testTpsAccelEnrichmentMath) { TEST(fuel, testTpsAccelEnrichmentMath) {
printf("====================================================================================== testAccelEnrichment\r\n"); printf("====================================================================================== testAccelEnrichment\r\n");
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
engine->rpmCalculator.setRpmValue(600); engine->rpmCalculator.setRpmValue(600);
engine->periodicFastCallback(); engine->periodicFastCallback();
@ -40,14 +40,14 @@ TEST(fuel, testTpsAccelEnrichmentMath) {
} }
TEST(fuel, testTpsAccelEnrichmentScheduling) { TEST(fuel, testTpsAccelEnrichmentScheduling) {
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->tpsAccelEnrichmentThreshold = 5; engineConfiguration->tpsAccelEnrichmentThreshold = 5;
engineConfiguration->tpsAccelLookback = 2; engineConfiguration->tpsAccelLookback = 2;
eth.setTriggerType(TT_ONE); eth.setTriggerType(trigger_type_e::TT_ONE);
Sensor::setMockValue(SensorType::Tps1, 0); Sensor::setMockValue(SensorType::Tps1, 0);
@ -97,7 +97,7 @@ static void doFractionalTpsIteration(int period, int divisor, int numCycles, std
TEST(fuel, testAccelEnrichmentFractionalTps) { TEST(fuel, testAccelEnrichmentFractionalTps) {
printf("====================================================================================== testAccelEnrichmentFractionalTps\r\n"); printf("====================================================================================== testAccelEnrichmentFractionalTps\r\n");
EngineTestHelper eth(FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
// setup // setup
engineConfiguration->tpsAccelEnrichmentThreshold = 5; engineConfiguration->tpsAccelEnrichmentThreshold = 5;

View File

@ -55,7 +55,7 @@ public:
TestCanStreamerState() : CanStreamerState(&streamer) {} TestCanStreamerState() : CanStreamerState(&streamer) {}
void test(const std::vector<std::string> & dataList, const std::vector<std::string> & frames, int fifoLeftoverSize, const std::vector<size_t> & receiveChunks) { void test(const std::vector<std::string> & dataList, const std::vector<std::string> & frames, int fifoLeftoverSize, const std::vector<size_t> & receiveChunks) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
size_t totalSize = 0; size_t totalSize = 0;
std::string totalData; std::string totalData;

View File

@ -99,7 +99,7 @@ TEST(CanWideband, DecodeValidAemFormat) {
TEST(CanWideband, DecodeRusefiStandard) TEST(CanWideband, DecodeRusefiStandard)
{ {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
AemXSeriesWideband dut(0, SensorType::Lambda1); AemXSeriesWideband dut(0, SensorType::Lambda1);
dut.Register(); dut.Register();
@ -139,7 +139,7 @@ TEST(CanWideband, DecodeRusefiStandard)
TEST(CanWideband, DecodeRusefiStandardWrongVersion) TEST(CanWideband, DecodeRusefiStandardWrongVersion)
{ {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
AemXSeriesWideband dut(0, SensorType::Lambda1); AemXSeriesWideband dut(0, SensorType::Lambda1);
dut.Register(); dut.Register();

View File

@ -13,7 +13,7 @@ TEST(misc, changeEngineType) {
/** /**
* this configuration has triggerInputDebugPins defined * this configuration has triggerInputDebugPins defined
*/ */
EngineTestHelper eth (FORD_ASPIRE_1996); EngineTestHelper eth(engine_type_e::FORD_ASPIRE_1996);
brain_pin_e brainPin = engineConfiguration->triggerInputDebugPins[0]; brain_pin_e brainPin = engineConfiguration->triggerInputDebugPins[0];
ASSERT_TRUE(brainPin != Gpio::Unassigned); ASSERT_TRUE(brainPin != Gpio::Unassigned);
@ -25,7 +25,7 @@ TEST(misc, changeEngineType) {
// above we have asserted that triggerInputDebugPins is in fact used // above we have asserted that triggerInputDebugPins is in fact used
// now let's change into engine type without triggerInputDebugPins and assert shut down // now let's change into engine type without triggerInputDebugPins and assert shut down
setEngineType((int)CITROEN_TU3JP); setEngineType(engine_type_e::CITROEN_TU3JP);
ASSERT_TRUE(activeConfiguration.triggerInputDebugPins[0] == Gpio::Unassigned); ASSERT_TRUE(activeConfiguration.triggerInputDebugPins[0] == Gpio::Unassigned);
ASSERT_TRUE(engineConfiguration->triggerInputDebugPins[0] == Gpio::Unassigned); ASSERT_TRUE(engineConfiguration->triggerInputDebugPins[0] == Gpio::Unassigned);

View File

@ -17,7 +17,7 @@ void printResults(DynoView *dut) {
TEST(DynoView, VSS_T1) { TEST(DynoView, VSS_T1) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
DynoView dut; DynoView dut;
@ -36,7 +36,7 @@ TEST(DynoView, VSS_T1) {
} }
TEST(DynoView, algo) { TEST(DynoView, algo) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
DynoView dut; DynoView dut;
@ -60,7 +60,7 @@ TEST(DynoView, algo) {
} }
TEST(DynoView, VSS_fast) { TEST(DynoView, VSS_fast) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
DynoView dut; DynoView dut;
@ -83,7 +83,7 @@ TEST(DynoView, VSS_fast) {
TEST(DynoView, VSS_Torque) { TEST(DynoView, VSS_Torque) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
DynoView dut; DynoView dut;

View File

@ -13,7 +13,7 @@
TEST(misc, testIgnitionPlanning) { TEST(misc, testIgnitionPlanning) {
printf("*************************************************** testIgnitionPlanning\r\n"); printf("*************************************************** testIgnitionPlanning\r\n");
EngineTestHelper eth(FORD_ESCORT_GT); EngineTestHelper eth(engine_type_e::FORD_ESCORT_GT);
engine->periodicFastCallback(); engine->periodicFastCallback();
assertEqualsM("testIgnitionPlanning_AFR", 13.5, engine->fuelComputer.targetAFR); assertEqualsM("testIgnitionPlanning_AFR", 13.5, engine->fuelComputer.targetAFR);
@ -25,7 +25,7 @@ TEST(misc, testEngineMath) {
printf("*************************************************** testEngineMath\r\n"); printf("*************************************************** testEngineMath\r\n");
// todo: let's see if we can make 'engine' unneeded in this test? // todo: let's see if we can make 'engine' unneeded in this test?
EngineTestHelper eth(FORD_ESCORT_GT); EngineTestHelper eth(engine_type_e::FORD_ESCORT_GT);
setCamOperationMode(); setCamOperationMode();
engineConfiguration->fuelAlgorithm = LM_SPEED_DENSITY; engineConfiguration->fuelAlgorithm = LM_SPEED_DENSITY;

View File

@ -1,7 +1,7 @@
#include "pch.h" #include "pch.h"
float GetGearRatioFor(float revPerKm, float axle, float kph, float rpm) { float GetGearRatioFor(float revPerKm, float axle, float kph, float rpm) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->driveWheelRevPerKm = revPerKm; engineConfiguration->driveWheelRevPerKm = revPerKm;
engineConfiguration->finalGearRatio = axle; engineConfiguration->finalGearRatio = axle;
@ -29,7 +29,7 @@ TEST(GearDetector, ComputeGearRatio) {
TEST(GearDetector, GetRpmInGear) { TEST(GearDetector, GetRpmInGear) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->driveWheelRevPerKm = 507; engineConfiguration->driveWheelRevPerKm = 507;
engineConfiguration->finalGearRatio = 4.10f; engineConfiguration->finalGearRatio = 4.10f;
@ -68,7 +68,7 @@ TEST(GearDetector, GetRpmInGear) {
} }
TEST(GearDetector, DetermineGearSingleSpeed) { TEST(GearDetector, DetermineGearSingleSpeed) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
auto& dut = engine->module<GearDetector>().unmock(); auto& dut = engine->module<GearDetector>().unmock();
engineConfiguration->totalGearsCount = 1; engineConfiguration->totalGearsCount = 1;
@ -92,7 +92,7 @@ TEST(GearDetector, DetermineGearSingleSpeed) {
} }
TEST(GearDetector, DetermineGear5Speed) { TEST(GearDetector, DetermineGear5Speed) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
auto& dut = engine->module<GearDetector>().unmock(); auto& dut = engine->module<GearDetector>().unmock();
engineConfiguration->totalGearsCount = 5; engineConfiguration->totalGearsCount = 5;
@ -136,7 +136,7 @@ TEST(GearDetector, DetermineGear5Speed) {
} }
TEST(GearDetector, MiataNb6Speed) { TEST(GearDetector, MiataNb6Speed) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
auto& dut = engine->module<GearDetector>().unmock(); auto& dut = engine->module<GearDetector>().unmock();
engineConfiguration->totalGearsCount = 6; engineConfiguration->totalGearsCount = 6;
@ -164,7 +164,7 @@ TEST(GearDetector, MiataNb6Speed) {
} }
TEST(GearDetector, DetermineGear8Speed) { TEST(GearDetector, DetermineGear8Speed) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
auto& dut = engine->module<GearDetector>().unmock(); auto& dut = engine->module<GearDetector>().unmock();
// ZF 8HP 70 // ZF 8HP 70
@ -203,7 +203,7 @@ TEST(GearDetector, DetermineGear8Speed) {
} }
TEST(GearDetector, ParameterValidation) { TEST(GearDetector, ParameterValidation) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
auto& dut = engine->module<GearDetector>().unmock(); auto& dut = engine->module<GearDetector>().unmock();
// Defaults should work // Defaults should work

View File

@ -1,7 +1,7 @@
#include "pch.h" #include "pch.h"
TEST(gpio, testPinInitNonInverted) { TEST(gpio, testPinInitNonInverted) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
OutputPin dut; OutputPin dut;
@ -16,7 +16,7 @@ TEST(gpio, testPinInitNonInverted) {
} }
TEST(gpio, testPinInitInverted) { TEST(gpio, testPinInitInverted) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
OutputPin dut; OutputPin dut;

View File

@ -1,7 +1,7 @@
#include "pch.h" #include "pch.h"
TEST(hardware, reinit) { TEST(hardware, reinit) {
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP); EngineTestHelper eth(engine_type_e::FRANKENSO_MIATA_NA6_MAP);
ButtonDebounce::stopConfigurationList(); ButtonDebounce::stopConfigurationList();
ButtonDebounce::startConfigurationList(); ButtonDebounce::startConfigurationList();
@ -10,6 +10,6 @@ TEST(hardware, reinit) {
ButtonDebounce::startConfigurationList(); ButtonDebounce::startConfigurationList();
resetConfigurationExt(nullptr, DODGE_NEON_1995); resetConfigurationExt(nullptr, engine_type_e::DODGE_NEON_1995);
resetConfigurationExt(nullptr, FRANKENSO_MIATA_NA6_MAP); resetConfigurationExt(nullptr, engine_type_e::FRANKENSO_MIATA_NA6_MAP);
} }

View File

@ -7,7 +7,7 @@ using ::testing::_;
using ::testing::StrictMock; using ::testing::StrictMock;
TEST(HPFP, Lobe) { TEST(HPFP, Lobe) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->hpfpCam = HPFP_CAM_NONE; engineConfiguration->hpfpCam = HPFP_CAM_NONE;
engineConfiguration->hpfpPeakPos = 123; engineConfiguration->hpfpPeakPos = 123;
@ -51,7 +51,7 @@ TEST(HPFP, Lobe) {
} }
TEST(HPFP, InjectionReplacementFuel) { TEST(HPFP, InjectionReplacementFuel) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->hpfpCamLobes = 4; engineConfiguration->hpfpCamLobes = 4;
@ -104,7 +104,7 @@ TEST(HPFP, InjectionReplacementFuel) {
} }
TEST(HPFP, PI) { TEST(HPFP, PI) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->hpfpCamLobes = 4; engineConfiguration->hpfpCamLobes = 4;
@ -161,7 +161,7 @@ TEST(HPFP, PI) {
} }
TEST(HPFP, Angle) { TEST(HPFP, Angle) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->hpfpCamLobes = 4; engineConfiguration->hpfpCamLobes = 4;
@ -207,7 +207,7 @@ TEST(HPFP, Angle) {
} }
TEST(HPFP, Schedule) { TEST(HPFP, Schedule) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->cylindersCount = 4; engineConfiguration->cylindersCount = 4;
engineConfiguration->hpfpCamLobes = 4; engineConfiguration->hpfpCamLobes = 4;

View File

@ -8,7 +8,7 @@
#include "pch.h" #include "pch.h"
TEST(HPFP, IntegratedSchedule) { TEST(HPFP, IntegratedSchedule) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) { EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->hpfpValvePin = Gpio::A2; // arbitrary engineConfiguration->hpfpValvePin = Gpio::A2; // arbitrary
}); });
@ -19,7 +19,7 @@ TEST(HPFP, IntegratedSchedule) {
engineConfiguration->trigger.customTotalToothCount = 16; engineConfiguration->trigger.customTotalToothCount = 16;
engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customSkippedToothCount = 0;
eth.setTriggerType(TT_TOOTHED_WHEEL); eth.setTriggerType(trigger_type_e::TT_TOOTHED_WHEEL);
setCamOperationMode(); setCamOperationMode();
engineConfiguration->isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;

View File

@ -18,7 +18,7 @@ using ::testing::_;
using ICP = IIdleController::Phase; using ICP = IIdleController::Phase;
TEST(idle_v2, timingPid) { TEST(idle_v2, timingPid) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
engineConfiguration->useIdleTimingPidControl = true; engineConfiguration->useIdleTimingPidControl = true;
@ -50,7 +50,7 @@ TEST(idle_v2, timingPid) {
} }
TEST(idle_v2, testTargetRpm) { TEST(idle_v2, testTargetRpm) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
for (size_t i = 0; i < efi::size(config->cltIdleRpmBins); i++) { for (size_t i = 0; i < efi::size(config->cltIdleRpmBins); i++) {
@ -63,7 +63,7 @@ TEST(idle_v2, testTargetRpm) {
} }
TEST(idle_v2, testDeterminePhase) { TEST(idle_v2, testDeterminePhase) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
// TPS threshold 5% for easy test // TPS threshold 5% for easy test
@ -108,7 +108,7 @@ TEST(idle_v2, testDeterminePhase) {
} }
TEST(idle_v2, crankingOpenLoop) { TEST(idle_v2, crankingOpenLoop) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
engineConfiguration->crankingIACposition = 50; engineConfiguration->crankingIACposition = 50;
@ -133,7 +133,7 @@ TEST(idle_v2, crankingOpenLoop) {
} }
TEST(idle_v2, runningOpenLoopBasic) { TEST(idle_v2, runningOpenLoopBasic) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
engineConfiguration->manIdlePosition = 50; engineConfiguration->manIdlePosition = 50;
@ -148,7 +148,7 @@ TEST(idle_v2, runningOpenLoopBasic) {
} }
TEST(idle_v2, runningFanAcBump) { TEST(idle_v2, runningFanAcBump) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
engineConfiguration->manIdlePosition = 50; engineConfiguration->manIdlePosition = 50;
@ -186,7 +186,7 @@ TEST(idle_v2, runningFanAcBump) {
} }
TEST(idle_v2, runningOpenLoopTpsTaper) { TEST(idle_v2, runningOpenLoopTpsTaper) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
// Zero out base tempco table // Zero out base tempco table
@ -208,7 +208,7 @@ TEST(idle_v2, runningOpenLoopTpsTaper) {
} }
TEST(idle_v2, runningOpenLoopRpmTaper) { TEST(idle_v2, runningOpenLoopRpmTaper) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
// Zero out base tempco table // Zero out base tempco table
@ -236,7 +236,7 @@ struct MockOpenLoopIdler : public IdleController {
}; };
TEST(idle_v2, testOpenLoopCranking) { TEST(idle_v2, testOpenLoopCranking) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut; StrictMock<MockOpenLoopIdler> dut;
engineConfiguration->overrideCrankingIacSetting = true; engineConfiguration->overrideCrankingIacSetting = true;
@ -248,7 +248,7 @@ TEST(idle_v2, testOpenLoopCranking) {
} }
TEST(idle_v2, openLoopRunningTaper) { TEST(idle_v2, openLoopRunningTaper) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut; StrictMock<MockOpenLoopIdler> dut;
EXPECT_CALL(dut, getRunningOpenLoop(0, 30, SensorResult(0))).WillRepeatedly(Return(25)); EXPECT_CALL(dut, getRunningOpenLoop(0, 30, SensorResult(0))).WillRepeatedly(Return(25));
@ -272,7 +272,7 @@ TEST(idle_v2, openLoopRunningTaper) {
} }
TEST(idle_v2, getCrankingTaperFraction) { TEST(idle_v2, getCrankingTaperFraction) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut; StrictMock<MockOpenLoopIdler> dut;
engineConfiguration->afterCrankingIACtaperDuration = 500; engineConfiguration->afterCrankingIACtaperDuration = 500;
@ -300,7 +300,7 @@ TEST(idle_v2, getCrankingTaperFraction) {
} }
TEST(idle_v2, openLoopCoastingTable) { TEST(idle_v2, openLoopCoastingTable) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
// enable & configure feature // enable & configure feature
@ -317,7 +317,7 @@ TEST(idle_v2, openLoopCoastingTable) {
extern int timeNowUs; extern int timeNowUs;
TEST(idle_v2, closedLoopBasic) { TEST(idle_v2, closedLoopBasic) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
dut.init(); dut.init();
@ -344,7 +344,7 @@ TEST(idle_v2, closedLoopBasic) {
} }
TEST(idle_v2, closedLoopDeadzone) { TEST(idle_v2, closedLoopDeadzone) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
IdleController dut; IdleController dut;
dut.init(); dut.init();
@ -380,7 +380,7 @@ struct IntegrationIdleMock : public IdleController {
}; };
TEST(idle_v2, IntegrationManual) { TEST(idle_v2, IntegrationManual) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut; StrictMock<IntegrationIdleMock> dut;
SensorResult expectedTps = 1; SensorResult expectedTps = 1;
@ -411,7 +411,7 @@ TEST(idle_v2, IntegrationManual) {
} }
TEST(idle_v2, IntegrationAutomatic) { TEST(idle_v2, IntegrationAutomatic) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut; StrictMock<IntegrationIdleMock> dut;
engineConfiguration->idleMode = IM_AUTO; engineConfiguration->idleMode = IM_AUTO;
@ -447,7 +447,7 @@ TEST(idle_v2, IntegrationAutomatic) {
} }
TEST(idle_v2, IntegrationClamping) { TEST(idle_v2, IntegrationClamping) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut; StrictMock<IntegrationIdleMock> dut;
engineConfiguration->idleMode = IM_AUTO; engineConfiguration->idleMode = IM_AUTO;

View File

@ -15,7 +15,7 @@ struct MockKnockController : public KnockControllerBase {
}; };
TEST(Knock, Retards) { TEST(Knock, Retards) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Aggression of 10% // Aggression of 10%
engineConfiguration->knockRetardAggression = 10; engineConfiguration->knockRetardAggression = 10;
@ -48,7 +48,7 @@ TEST(Knock, Retards) {
} }
TEST(Knock, Reapply) { TEST(Knock, Reapply) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
MockKnockController dut; MockKnockController dut;
dut.onFastCallback(); dut.onFastCallback();

View File

@ -3,7 +3,7 @@
#include "launch_control.h" #include "launch_control.h"
TEST(LaunchControl, TpsCondition) { TEST(LaunchControl, TpsCondition) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
LaunchControlBase dut; LaunchControlBase dut;
@ -24,7 +24,7 @@ TEST(LaunchControl, TpsCondition) {
TEST(LaunchControl, VSSCondition) { TEST(LaunchControl, VSSCondition) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
LaunchControlBase dut; LaunchControlBase dut;
@ -41,7 +41,7 @@ TEST(LaunchControl, VSSCondition) {
} }
TEST(LaunchControl, RPMCondition) { TEST(LaunchControl, RPMCondition) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
LaunchControlBase dut; LaunchControlBase dut;
@ -53,7 +53,7 @@ TEST(LaunchControl, RPMCondition) {
} }
TEST(LaunchControl, SwitchInputCondition) { TEST(LaunchControl, SwitchInputCondition) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
LaunchControlBase dut; LaunchControlBase dut;
@ -95,7 +95,7 @@ TEST(LaunchControl, SwitchInputCondition) {
} }
TEST(LaunchControl, CombinedCondition) { TEST(LaunchControl, CombinedCondition) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
LaunchControlBase dut; LaunchControlBase dut;
@ -138,7 +138,7 @@ static void setDefaultLaunchParameters() {
} }
TEST(LaunchControl, CompleteRun) { TEST(LaunchControl, CompleteRun) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
initLaunchControl(); initLaunchControl();

View File

@ -21,7 +21,7 @@ TEST(limp, testFatalError) {
} }
TEST(limp, revLimit) { TEST(limp, revLimit) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->rpmHardLimit = 2500; engineConfiguration->rpmHardLimit = 2500;
@ -44,7 +44,7 @@ TEST(limp, revLimit) {
} }
TEST(limp, revLimitCltBased) { TEST(limp, revLimitCltBased) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->rpmHardLimit = 2500; engineConfiguration->rpmHardLimit = 2500;
@ -94,7 +94,7 @@ TEST(limp, revLimitCltBased) {
} }
TEST(limp, boostCut) { TEST(limp, boostCut) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
// Cut above 100kPa // Cut above 100kPa
engineConfiguration->boostCutPressure = 100; engineConfiguration->boostCutPressure = 100;
@ -131,7 +131,7 @@ TEST(limp, boostCut) {
extern int timeNowUs; extern int timeNowUs;
TEST(limp, oilPressureFailureCase) { TEST(limp, oilPressureFailureCase) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->minOilPressureAfterStart = 200; engineConfiguration->minOilPressureAfterStart = 200;
LimpManager dut; LimpManager dut;
@ -164,7 +164,7 @@ TEST(limp, oilPressureFailureCase) {
} }
TEST(limp, oilPressureSuccessCase) { TEST(limp, oilPressureSuccessCase) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->minOilPressureAfterStart = 200; engineConfiguration->minOilPressureAfterStart = 200;
LimpManager dut; LimpManager dut;

View File

@ -9,7 +9,7 @@
TEST(start, startStop) { TEST(start, startStop) {
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }}; std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
EngineTestHelper eth(PROTEUS_BMW_M73, sensorVals); EngineTestHelper eth(engine_type_e::PROTEUS_BMW_M73, sensorVals);
eth.moveTimeForwardAndInvokeEventsSec(1); // '0' time has special meaning for implementation so let's move forward eth.moveTimeForwardAndInvokeEventsSec(1); // '0' time has special meaning for implementation so let's move forward
// this is a pull-up, so 'true' on start-up // this is a pull-up, so 'true' on start-up

View File

@ -77,7 +77,7 @@ TEST(ClosedLoopFuel, CellSelection) {
} }
TEST(ClosedLoopFuel, afrLimits) { TEST(ClosedLoopFuel, afrLimits) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
engineConfiguration->stft.minAfr = 10; // 10.0 AFR engineConfiguration->stft.minAfr = 10; // 10.0 AFR
engineConfiguration->stft.maxAfr = 18; // 18.0 AFR engineConfiguration->stft.maxAfr = 18; // 18.0 AFR

View File

@ -68,7 +68,7 @@ TEST(binary, testWriteCrc) {
} }
TEST(TunerstudioCommands, writeChunkEngineConfig) { TEST(TunerstudioCommands, writeChunkEngineConfig) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(engine_type_e::TEST_ENGINE);
::testing::NiceMock<MockTsChannel> channel; ::testing::NiceMock<MockTsChannel> channel;
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config); uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);

Some files were not shown because too many files have changed in this diff Show More