nissan MR18DE VVT cam pattern (#3466)

* refactoring nissan trigger

* comments

* plumbing

* b

* enums

* image

* image

* implement decoder

* reshuffle

* don't case unused

* dead trigger enums
This commit is contained in:
Matthew Kennedy 2021-11-05 12:33:22 -07:00 committed by GitHub
parent 267e631f42
commit 2b9696442e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 7 deletions

View File

@ -94,6 +94,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
return TT_VVT_BARRA_3_PLUS_1;
case VVT_NISSAN_VQ:
return TT_VVT_NISSAN_VQ35;
case VVT_NISSAN_MR:
return TT_NISSAN_MR18_CAM_VVT;
default:
firmwareError(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

View File

@ -478,7 +478,7 @@ typedef enum {
// todo: remove this trigger once we have https://github.com/rusefi/rusefi/issues/2073
TT_SUBARU_7_WITHOUT_6 = 51,
TT_52 = 52,
TT_NISSAN_MR18_CAM_VVT = 52,
// https://rusefi.com/forum/viewtopic.php?f=5&t=1912
TT_TRI_TACH = 53,
@ -503,7 +503,7 @@ typedef enum {
TT_NISSAN_QR25 = 61,
TT_TEMP_62 = 62,
TT_UNUSED_62 = 62,
TT_SUBARU_SVX_CRANK_1 = 63,

View File

@ -106,6 +106,8 @@ typedef enum __attribute__ ((__packed__)) {
* 4 plus one
*/
VVT_HONDA_K = 10,
VVT_NISSAN_MR = 11,
} vvt_mode_e;
/**

View File

@ -221,3 +221,36 @@ void initializeNissanVQ30cam(TriggerWaveform *s) {
s->setTriggerSynchronizationGap3(/*gapIndex*/1, 0.38 * TRIGGER_GAP_DEVIATION_LOW, 0.38 * TRIGGER_GAP_DEVIATION_HIGH);
s->setTriggerSynchronizationGap3(/*gapIndex*/2, 2.67 * TRIGGER_GAP_DEVIATION_LOW, 2.67 * TRIGGER_GAP_DEVIATION_HIGH);
}
void initializeNissanMRvvt(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR);
s->tdcPosition = 0;
int x = 74;
// All "groups" start every 90 degrees of cam rotation
// The groups have 1, 3, 4, 2 teeth each (which is the firing order?)
// Teeth within a group are spaced 16 cam degrees apart
int toothSpacing = 16;
// "1"
addvq30tooth(s, x + 0);
// "3"
addvq30tooth(s, x + 90 + 0 * toothSpacing);
addvq30tooth(s, x + 90 + 1 * toothSpacing);
addvq30tooth(s, x + 90 + 2 * toothSpacing);
// "4"
addvq30tooth(s, x + 180 + 0 * toothSpacing);
addvq30tooth(s, x + 180 + 1 * toothSpacing);
addvq30tooth(s, x + 180 + 2 * toothSpacing);
addvq30tooth(s, x + 180 + 3 * toothSpacing);
// "2"
addvq30tooth(s, x + 270 + 0 * toothSpacing);
addvq30tooth(s, x + 270 + 1 * toothSpacing);
s->setTriggerSynchronizationGap(5.4);
}

View File

@ -13,6 +13,7 @@ void initializeNissanSR20VE_4(TriggerWaveform *s);
void initializeNissanSR20VE_4_360(TriggerWaveform *s);
void initializeNissanVQvvt(TriggerWaveform *s);
void initializeNissanMRvvt(TriggerWaveform *s);
void initializeNissanVQ35crank(TriggerWaveform *s);
void initializeNissanMR18crank(TriggerWaveform *s);
void initializeNissanQR25crank(TriggerWaveform *s);

View File

@ -566,7 +566,6 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
break;
case TT_NISSAN_QR25:
case TT_TEMP_62:
initializeNissanQR25crank(this);
break;
@ -582,6 +581,10 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
initializeNissanMR18crank(this);
break;
case TT_NISSAN_MR18_CAM_VVT:
initializeNissanMRvvt(this);
break;
case TT_KAWA_KX450F:
configureKawaKX450F(this);
break;
@ -661,7 +664,6 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
configureHondaK_12_1(this);
break;
case TT_UNUSED_10:
case TT_HONDA_4_24:
configureHonda_1_4_24(this, false, true, T_NONE, T_PRIMARY, 0);
shapeWithoutTdc = true;
@ -748,7 +750,6 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
break;
case TT_SUBARU_7_WITHOUT_6:
case TT_52:
initializeSubaruOnly7(this);
break;

View File

@ -309,7 +309,7 @@ custom debug_mode_e 4 bits, U32, @OFFSET@, [0:5], @@debug_mode_e_enum@@
#define VM_VVT_INACTIVE 0
#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2GZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K 4+1", "vvt11", "vvt12", "vvt13"
#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2GZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K 4+1", "Nissan MR18", "vvt12", "vvt13"
custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:3], @@vvt_mode_e_enum@@
! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU
@ -583,7 +583,7 @@ adc_channel_e fuelLevelSensor;+This is the processor pin that your fuel level se
struct trigger_config_s @brief Trigger wheel(s) configuration
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "trg47", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "trg52", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "trg59", "Nissan VQ30", "Nissan QR25", "trg62", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "Nissan MR18 Crank", "trg69"
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "INVALID", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "INVALID", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "INVALID", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "INVALID", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "INVALID", "Nissan VQ30", "Nissan QR25", "INVALID", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "Nissan MR18 Crank", "INVALID"
custom trigger_type_e 4 bits, U32, @OFFSET@, [0:6], @@trigger_type_e_enum@@
trigger_type_e type;+https://github.com/rusefi/rusefi/wiki/All-Supported-Triggers\nset trigger_type X