simplify cam input single tooth modes (#178)

This commit is contained in:
Matthew Kennedy 2023-08-03 00:52:19 -07:00 committed by GitHub
parent 38a2bbd1ce
commit 94c29d4cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 25 additions and 28 deletions

View File

@ -13,6 +13,7 @@ echo "HW CI build [$HW_FOLDER][$HW_TARGET]"
cd firmware cd firmware
./gen_live_documentation.sh ./gen_live_documentation.sh
./gen_enum_to_string.sh
./gen_config_board.sh $HW_FOLDER $HW_TARGET ./gen_config_board.sh $HW_FOLDER $HW_TARGET
echo "We aren't guaranteed a clean machine every time, so manually clean the output." echo "We aren't guaranteed a clean machine every time, so manually clean the output."

View File

@ -28,6 +28,9 @@ Release template (copy/paste this for new release):
## Unreleased ## Unreleased
### Breaking Changes
- Simplified VVT single tooth cam modes. "Single tooth second half" and "single tooth first half" have been replaced by simply "single tooth". This may require re-setting your trigger and VVT timing offsets if you used "single tooth first half" prior to this change. #178
### Added ### Added
- Log per-cylinder true ignition timing (includes trim, knock retard, etc) #76 - Log per-cylinder true ignition timing (includes trim, knock retard, etc) #76
- Add mode for CLT/IAT sensors that are installed "high side" instead of typical "low side" #116 - Add mode for CLT/IAT sensors that are installed "high side" instead of typical "low side" #116

View File

@ -43,8 +43,8 @@ static void setupVbatt() {
} }
static void setupDefaultSensorInputs() { static void setupDefaultSensorInputs() {
engineConfiguration->vvtMode[0] = VVT_SECOND_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
engineConfiguration->vvtMode[1] = VVT_SECOND_HALF; engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS; engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;

View File

@ -97,7 +97,7 @@ void m73engine() {
engineConfiguration->fuelAlgorithm = LM_ALPHA_N; engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
engineConfiguration->canNbcType = CAN_BUS_NBC_NONE; engineConfiguration->canNbcType = CAN_BUS_NBC_NONE;
engineConfiguration->vvtMode[0] = VVT_FIRST_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
engineConfiguration->globalTriggerAngleOffset = 90; engineConfiguration->globalTriggerAngleOffset = 90;
setCrankOperationMode(); setCrankOperationMode();

View File

@ -89,7 +89,7 @@ void setTestVVTEngineConfiguration() {
// set global_trigger_offset_angle 0 // set global_trigger_offset_angle 0
engineConfiguration->globalTriggerAngleOffset = 0; engineConfiguration->globalTriggerAngleOffset = 0;
engineConfiguration->vvtMode[0] = VVT_SECOND_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
} }
#if EFI_UNIT_TEST #if EFI_UNIT_TEST

View File

@ -76,8 +76,7 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
case VVT_HONDA_K_EXHAUST: case VVT_HONDA_K_EXHAUST:
return trigger_type_e::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_SINGLE_TOOTH:
case VVT_SECOND_HALF:
case VVT_MAP_V_TWIN: case VVT_MAP_V_TWIN:
return trigger_type_e::TT_ONE; return trigger_type_e::TT_ONE;
case VVT_FORD_ST170: case VVT_FORD_ST170:

View File

@ -46,9 +46,9 @@ typedef enum __attribute__ ((__packed__)) {
VVT_INACTIVE = 0, VVT_INACTIVE = 0,
/** /**
* Single-tooth cam sensor mode where TDC and cam signal happen in opposite 360 degree of 720 degree engine cycle * Single tooth on the camshaft anywhere in the 720 degree cycle
*/ */
VVT_SECOND_HALF = 1, VVT_SINGLE_TOOTH = 1,
/** /**
* Toyota 2JZ has three cam tooth. We pick one of these three tooth to synchronize based on the expected angle position of the event * Toyota 2JZ has three cam tooth. We pick one of these three tooth to synchronize based on the expected angle position of the event
*/ */
@ -59,10 +59,6 @@ typedef enum __attribute__ ((__packed__)) {
*/ */
VVT_MIATA_NB = 3, VVT_MIATA_NB = 3,
/**
* Single-tooth cam sensor mode where TDC and cam signal happen in the same 360 degree of 720 degree engine cycle
*/
VVT_FIRST_HALF = 4,
/** /**
* @see TT_VVT_BOSCH_QUICK_START * @see TT_VVT_BOSCH_QUICK_START
*/ */

View File

@ -112,8 +112,7 @@ static bool vvtWithRealDecoder(vvt_mode_e vvtMode) {
&& vvtMode != VVT_2JZ && vvtMode != VVT_2JZ
&& vvtMode != VVT_HONDA_K_INTAKE && vvtMode != VVT_HONDA_K_INTAKE
&& vvtMode != VVT_MAP_V_TWIN && vvtMode != VVT_MAP_V_TWIN
&& vvtMode != VVT_SECOND_HALF && vvtMode != VVT_SINGLE_TOOTH;
&& vvtMode != VVT_FIRST_HALF;
} }
angle_t TriggerCentral::syncAndReport(int divider, int remainder) { angle_t TriggerCentral::syncAndReport(int divider, int remainder) {
@ -165,12 +164,11 @@ static angle_t adjustCrankPhase(int camIndex) {
vvt_mode_e vvtMode = engineConfiguration->vvtMode[camIndex]; vvt_mode_e vvtMode = engineConfiguration->vvtMode[camIndex];
switch (vvtMode) { switch (vvtMode) {
case VVT_FIRST_HALF:
case VVT_MAP_V_TWIN: case VVT_MAP_V_TWIN:
case VVT_MITSUBISHI_4G63: case VVT_MITSUBISHI_4G63:
case VVT_MITSUBISHI_4G9x: case VVT_MITSUBISHI_4G9x:
return tc->syncAndReport(crankDivider, 1); return tc->syncAndReport(crankDivider, 1);
case VVT_SECOND_HALF: case VVT_SINGLE_TOOTH:
case VVT_NISSAN_VQ: case VVT_NISSAN_VQ:
case VVT_BOSCH_QUICK_START: case VVT_BOSCH_QUICK_START:
case VVT_MIATA_NB: case VVT_MIATA_NB:

View File

@ -270,7 +270,7 @@ end_struct
#define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "INVALID", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua" #define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "INVALID", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua"
custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@ custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@
#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2JZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63" #define vvt_mode_e_enum "Inactive", "Single Tooth", "2JZ", "Miata NB2", "INVALID", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63"
custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:5], @@vvt_mode_e_enum@@ custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:5], @@vvt_mode_e_enum@@
! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU ! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU

View File

@ -84,7 +84,7 @@ TEST(trigger, testCamInput) {
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT // changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
setCrankOperationMode(); setCrankOperationMode();
engineConfiguration->vvtMode[0] = VVT_FIRST_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
engineConfiguration->vvtOffsets[0] = 360; engineConfiguration->vvtOffsets[0] = 360;
eth.setTriggerType(trigger_type_e::TT_ONE); eth.setTriggerType(trigger_type_e::TT_ONE);
engineConfiguration->camInputs[0] = Gpio::A10; // we just need to indicate that we have CAM engineConfiguration->camInputs[0] = Gpio::A10; // we just need to indicate that we have CAM
@ -110,11 +110,6 @@ TEST(trigger, testCamInput) {
unitTestWarningCodeState.recentWarnings.clear(); unitTestWarningCodeState.recentWarnings.clear();
for (int i = 0; i < 600;i++) { for (int i = 0; i < 600;i++) {
eth.moveTimeForwardUs(MS2US(25));
eth.firePrimaryTriggerRise();
EXPECT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm)));
eth.moveTimeForwardUs(MS2US(10)); eth.moveTimeForwardUs(MS2US(10));
// cam comes every other crank rev // cam comes every other crank rev
@ -123,12 +118,17 @@ TEST(trigger, testCamInput) {
} }
eth.moveTimeForwardUs(MS2US(15)); eth.moveTimeForwardUs(MS2US(15));
eth.firePrimaryTriggerRise();
EXPECT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm)));
eth.moveTimeForwardUs(MS2US(25));
eth.firePrimaryTriggerFall(); eth.firePrimaryTriggerFall();
} }
// asserting that error code has cleared // asserting that error code has cleared
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3"; ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
EXPECT_NEAR_M3(-109, engine->triggerCentral.getVVTPosition(0, 0)); EXPECT_NEAR_M3(71, engine->triggerCentral.getVVTPosition(0, 0));
} }
TEST(trigger, testNB2CamInput) { TEST(trigger, testNB2CamInput) {

View File

@ -14,8 +14,8 @@ TEST(trigger, testQuadCam) {
setCrankOperationMode(); setCrankOperationMode();
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT // changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
engineConfiguration->vvtMode[0] = VVT_FIRST_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
engineConfiguration->vvtMode[1] = VVT_FIRST_HALF; engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
engineConfiguration->camInputs[0] = Gpio::A10; // we just need to indicate that we have CAM engineConfiguration->camInputs[0] = Gpio::A10; // we just need to indicate that we have CAM
@ -68,7 +68,7 @@ TEST(trigger, testQuadCam) {
float basePos = -80.2f; float basePos = -80.2f;
// All four cams should now have the same position // All four cams should now have the same position
EXPECT_NEAR_M3(360 + basePos, engine->triggerCentral.getVVTPosition(firstBank, firstCam)); EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(firstBank, firstCam));
EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(firstBank, secondCam)); EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(firstBank, secondCam));
EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(secondBank, firstCam)); EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(secondBank, firstCam));
EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(secondBank, secondCam)); EXPECT_NEAR_M3(basePos, engine->triggerCentral.getVVTPosition(secondBank, secondCam));

View File

@ -19,7 +19,7 @@ TEST(realCas24Plus1, spinningOnBench) {
// 24 teeth at cam speed + 1 tooth // 24 teeth at cam speed + 1 tooth
// AKA 12 teeth at crank speed + 1 cam tooth // AKA 12 teeth at crank speed + 1 cam tooth
engineConfiguration->vvtMode[0] = VVT_SECOND_HALF; engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
eth.setTriggerType(trigger_type_e::TT_12_TOOTH_CRANK); eth.setTriggerType(trigger_type_e::TT_12_TOOTH_CRANK);
int eventCount = 0; int eventCount = 0;