TT_NISSAN_HR_CAM_IN #6898

only:intake
This commit is contained in:
Andrey 2024-09-08 00:27:05 -04:00
parent 40e0eff0dd
commit b75bb8d3cd
11 changed files with 258 additions and 4 deletions

View File

@ -113,6 +113,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
return trigger_type_e::TT_MITSU_4G9x_CAM;
case VVT_MITSUBISHI_4G63:
return trigger_type_e::TT_MITSU_4G63_CAM;
case VVT_HR12DDR_IN:
return trigger_type_e::TT_NISSAN_HR_CAM_IN;
default:
criticalError("Broken VVT mode maybe corrupted calibration %d: %s", vvtMode, getVvt_mode_e(vvtMode));
return trigger_type_e::TT_HALF_MOON; // we have to return something for the sake of -Werror=return-type

View File

@ -424,13 +424,15 @@ enum class trigger_type_e : uint32_t {
TT_ARCTIC_CAT = 85,
TT_NISSAN_HR_CAM_IN = 86,
// do not forget to edit "#define trigger_type_e_enum" line in integration/rusefi_config.txt file to propogate new value to rusefi.ini TS project
// do not forget to invoke "gen_config.bat" once you make changes to integration/rusefi_config.txt
// todo: one day a hero would integrate some of these things into Makefile in order to reduce manual magic
//
// Another point: once you add a new trigger, run get_trigger_images.bat which would run rusefi_test.exe from unit_tests
//
TT_UNUSED = 86, // this is used if we want to iterate over all trigger types
TT_UNUSED = 87, // this is used if we want to iterate over all trigger types
};
typedef enum {

View File

@ -121,6 +121,8 @@ typedef enum __attribute__ ((__packed__)) {
VVT_DEV = 23,
VVT_HR12DDR_IN = 24,
} vvt_mode_e;
/**

View File

@ -209,7 +209,7 @@ void initialize_one_of_36_2_2(TriggerWaveform *s, int firstCount, int secondCoun
s->addToothFallRise(base + narrow, narrow / 2);
base += narrow;
}
s->addToothFallRise(360, narrow/2);
}
@ -227,3 +227,14 @@ void initializeNissanHRcrank(TriggerWaveform *s) {
s->setTriggerSynchronizationGap3(/*gapIndex*/count, 0.1, 0.5);
}
void initializeNissanHRvvtIn(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
s->addToothRiseFall(120);
s->addToothRiseFall(120 + 22);
s->addToothRiseFall(240);
s->addToothRiseFall(360);
s->setTriggerSynchronizationGap(0.18);
}

View File

@ -21,3 +21,4 @@ void initializeNissanVQ30cam(TriggerWaveform *s);
// not vq35hr but https://en.wikipedia.org/wiki/Nissan_HR_engine
void initializeNissanHRcrank(TriggerWaveform *s);
void initializeNissanHRvvtIn(TriggerWaveform *s);

View File

@ -745,6 +745,9 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio
configureArcticCat(this);
break;
case trigger_type_e::TT_NISSAN_HR_CAM_IN:
initializeNissanHRvvtIn(this);
break;
case trigger_type_e::TT_NISSAN_HR:
initializeNissanHRcrank(this);
break;

View File

@ -195,6 +195,7 @@ static angle_t adjustCrankPhase(int camIndex) {
case VVT_FORD_ST170:
case VVT_BARRA_3_PLUS_1:
case VVT_NISSAN_MR:
case VVT_HR12DDR_IN:
case VVT_MAZDA_SKYACTIV:
case VVT_MAZDA_L:
case VVT_MITSUBISHI_4G69:

View File

@ -318,7 +318,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"
custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@
#define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "Mitsu 4G69", "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", "Ford Coyote", "Mitsu 6G72", "Honda 600", "Mazda L", "Dev", "vvt24", "vvt25", "vvt26"
#define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "Mitsu 4G69", "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", "Ford Coyote", "Mitsu 6G72", "Honda 600", "Mazda L", "Dev", "HR12DDR In", "vvt25", "vvt26"
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
@ -634,7 +634,7 @@ adc_channel_e fuelLevelSensor;This is the processor pin that your fuel level sen
struct trigger_config_s
! 'INVALID' for TT_VVT_* wheels
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "INVALID", "GM_7X", "Daihatsu 3 cylinder", "Mazda SOHC 4", "60-2", "36-1", "Mercedes Two Segment", "Single Tooth", "EZ30", "INVALID", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Half Moon", "Dodge Ram 1+16", "60-2 Wrong Polarity", "Benelli Tre", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM 24x 5 degree", "Honda CBR 600 Cam", "INVALID", "Honda CBR 600 custom", "3-1 skipped", "Dodge Neon 2003 crank", "Miata NB", "INVALID", "INVALID", "Subaru 7+6", "Jeep 18-2-2-2", "12crank/24cam", "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", "Suzuki K6A", "Subaru 7 without 6", "INVALID", "INVALID", "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", "32-2", "36-2-1", "36-2-1-1", "3-0", "INVALID", "GM 24x 3 degree", "60-2-2 F3R", "Mitsu 4G63 Crank", "x2 30 Deg camshaft BTDC", "INVALID", "Mitsu 6G72 Cam", "6-0", "Daihatsu 4 cylinder", "INVALID", "dev", "Nissan HR", "Arctic Cat", "trg86", "trg87", "trg88"
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "INVALID", "GM_7X", "Daihatsu 3 cylinder", "Mazda SOHC 4", "60-2", "36-1", "Mercedes Two Segment", "Single Tooth", "EZ30", "INVALID", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Half Moon", "Dodge Ram 1+16", "60-2 Wrong Polarity", "Benelli Tre", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM 24x 5 degree", "Honda CBR 600 Cam", "INVALID", "Honda CBR 600 custom", "3-1 skipped", "Dodge Neon 2003 crank", "Miata NB", "INVALID", "INVALID", "Subaru 7+6", "Jeep 18-2-2-2", "12crank/24cam", "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", "Suzuki K6A", "Subaru 7 without 6", "INVALID", "INVALID", "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", "32-2", "36-2-1", "36-2-1-1", "3-0", "INVALID", "GM 24x 3 degree", "60-2-2 F3R", "Mitsu 4G63 Crank", "x2 30 Deg camshaft BTDC", "INVALID", "Mitsu 6G72 Cam", "6-0", "Daihatsu 4 cylinder", "INVALID", "dev", "Nissan HR", "Arctic Cat", "HR12 in", "HR12 ex", "trg88"
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

View File

@ -26,6 +26,7 @@ TESTS_SRC_CPP = \
tests/trigger/test_real_nb2_cranking.cpp \
tests/trigger/test_real_gm_24x.cpp \
tests/trigger/test_real_nissan_hr.cpp \
tests/trigger/test_real_nissan_hr_vvt.cpp \
tests/trigger/test_real_k24a2.cpp \
tests/trigger/test_real_k20.cpp \
tests/trigger/test_toyota_3_tooth_cam.cpp \

View File

@ -0,0 +1,211 @@
Time[s], Channel 0
0.000000000000000, 1
0.264084375000000, 0
0.279566250000000, 1
0.481238250000000, 0
0.494669750000000, 1
0.511190875000000, 0
0.524379875000000, 1
0.686984250000000, 0
0.700691125000000, 1
0.890604000000000, 0
0.904307875000000, 1
1.092735375000000, 0
1.105740750000000, 1
1.121713500000000, 0
1.134568875000000, 1
1.294476250000000, 0
1.308144000000000, 1
1.497430500000000, 0
1.511106625000000, 1
1.699997000000000, 0
1.713021250000000, 1
1.729018625000000, 0
1.741925125000000, 1
1.902268500000000, 0
1.915974750000000, 1
2.105497500000000, 0
2.119163000000000, 1
2.307894500000000, 0
2.320885875000000, 1
2.336949750000000, 0
2.349813000000000, 1
2.510422125000000, 0
2.524162000000000, 1
2.714012875000000, 0
2.727742000000000, 1
2.916892000000000, 0
2.929882875000000, 1
2.945957250000000, 0
2.958817500000000, 1
3.119793375000000, 0
3.133512875000000, 1
3.323694625000000, 0
3.337466125000000, 1
3.527006000000000, 0
3.540053250000000, 1
3.556150625000000, 0
3.569019000000000, 1
3.729982750000000, 0
3.743721625000000, 1
3.933991750000000, 0
3.947743000000000, 1
4.137247250000000, 0
4.150312374999999, 1
4.166406750000000, 0
4.179277750000000, 1
4.340192750000000, 0
4.353944875000000, 1
4.544234250000000, 0
4.557976375000000, 1
4.747689250000000, 0
4.760726875000000, 1
4.776827625000000, 0
4.789635750000000, 1
4.950789125000000, 0
4.964605375000000, 1
5.155235250000000, 0
5.169020875000000, 1
5.359055500000000, 0
5.372093375000000, 1
5.388240124999999, 0
5.401016625000000, 1
5.562542875000000, 0
5.576271875000000, 1
5.766988875000000, 0
5.780803875000000, 1
5.970863625000000, 0
5.983926500000000, 1
6.000054500000000, 0
6.012743625000000, 1
6.174015000000000, 0
6.187711500000000, 1
6.377958749999999, 0
6.391741375000000, 1
6.581075500000000, 0
6.594134500000000, 1
6.610192124999999, 0
6.622822875000000, 1
6.783915875000000, 0
6.797596875000000, 1
6.987990874999999, 0
7.001740125000000, 1
7.191222124999999, 0
7.204291124999999, 1
7.220328125000000, 0
7.232995250000000, 1
7.393770624999999, 0
7.407460500000000, 1
7.597040499999999, 0
7.610697249999999, 1
7.799446000000000, 0
7.812430750000000, 1
7.828400374999999, 0
7.841015000000000, 1
8.001562125000000, 0
8.015244875000000, 1
8.204672750000000, 0
8.218344249999999, 1
8.406994375000000, 0
8.419949125000000, 1
8.435946000000000, 0
8.448535249999999, 1
8.608982500000000, 0
8.622637124999999, 1
8.811728750000000, 0
8.825425375000000, 1
9.013702875000000, 0
9.026638125000000, 1
9.042598000000000, 0
9.055133874999999, 1
9.215197999999999, 0
9.228800000000000, 1
9.417658874999999, 0
9.431325124999999, 1
9.619342375000000, 0
9.632297625000000, 1
9.648227250000000, 0
9.660775500000000, 1
9.820575000000000, 0
9.834145999999999, 1
10.022373875000000, 0
10.035971374999999, 1
10.223399875000000, 0
10.236296124999999, 1
10.252119374999999, 0
10.264610249999999, 1
10.423598875000000, 0
10.437150749999999, 1
10.624837500000000, 0
10.638377499999999, 1
10.825416125000000, 0
10.838252125000000, 1
10.854083500000000, 0
10.866550000000000, 1
11.025500874999999, 0
11.039074124999999, 1
11.226746125000000, 0
11.240342249999999, 1
11.427294874999999, 0
11.440102374999999, 1
11.455926000000000, 0
11.468391374999999, 1
11.627294124999999, 0
11.640810499999999, 1
11.828421375000000, 0
11.842029000000000, 1
12.028772750000000, 0
12.041601000000000, 1
12.057413750000000, 0
12.069831875000000, 1
12.228572374999999, 0
12.242053374999999, 1
12.429445500000000, 0
12.442997750000000, 1
12.629547375000000, 0
12.642398000000000, 1
12.658179250000000, 0
12.670611624999999, 1
12.828964749999999, 0
12.842411624999999, 1
13.029316874999999, 0
13.042813749999999, 1
13.228644874999999, 0
13.241438499999999, 1
13.257108250000000, 0
13.269535749999999, 1
13.427335625000000, 0
13.440760500000000, 1
13.626964375000000, 0
13.640382624999999, 1
13.825740000000000, 0
13.838502499999999, 1
13.854166625000000, 0
13.866553999999999, 1
14.024221375000000, 0
14.037663125000000, 1
14.223614124999999, 0
14.237031625000000, 1
14.421876624999999, 0
14.434580125000000, 1
14.450268124999999, 0
14.462623375000000, 1
14.619814499999999, 0
14.633172499999999, 1
14.818382874999999, 0
14.831769999999999, 1
15.016223000000000, 0
15.028922374999999, 1
15.044533249999999, 0
15.056818249999999, 1
15.213625875000000, 0
15.226932625000000, 1
15.411591999999999, 0
15.424950375000000, 1
15.608954749999999, 0
15.621636875000000, 1
15.637183499999999, 0
15.649459374999999, 1
15.805754374999999, 0
15.819007124999999, 1
16.003203499999998, 0
1 Time[s] Channel 0
2 0.000000000000000 1
3 0.264084375000000 0
4 0.279566250000000 1
5 0.481238250000000 0
6 0.494669750000000 1
7 0.511190875000000 0
8 0.524379875000000 1
9 0.686984250000000 0
10 0.700691125000000 1
11 0.890604000000000 0
12 0.904307875000000 1
13 1.092735375000000 0
14 1.105740750000000 1
15 1.121713500000000 0
16 1.134568875000000 1
17 1.294476250000000 0
18 1.308144000000000 1
19 1.497430500000000 0
20 1.511106625000000 1
21 1.699997000000000 0
22 1.713021250000000 1
23 1.729018625000000 0
24 1.741925125000000 1
25 1.902268500000000 0
26 1.915974750000000 1
27 2.105497500000000 0
28 2.119163000000000 1
29 2.307894500000000 0
30 2.320885875000000 1
31 2.336949750000000 0
32 2.349813000000000 1
33 2.510422125000000 0
34 2.524162000000000 1
35 2.714012875000000 0
36 2.727742000000000 1
37 2.916892000000000 0
38 2.929882875000000 1
39 2.945957250000000 0
40 2.958817500000000 1
41 3.119793375000000 0
42 3.133512875000000 1
43 3.323694625000000 0
44 3.337466125000000 1
45 3.527006000000000 0
46 3.540053250000000 1
47 3.556150625000000 0
48 3.569019000000000 1
49 3.729982750000000 0
50 3.743721625000000 1
51 3.933991750000000 0
52 3.947743000000000 1
53 4.137247250000000 0
54 4.150312374999999 1
55 4.166406750000000 0
56 4.179277750000000 1
57 4.340192750000000 0
58 4.353944875000000 1
59 4.544234250000000 0
60 4.557976375000000 1
61 4.747689250000000 0
62 4.760726875000000 1
63 4.776827625000000 0
64 4.789635750000000 1
65 4.950789125000000 0
66 4.964605375000000 1
67 5.155235250000000 0
68 5.169020875000000 1
69 5.359055500000000 0
70 5.372093375000000 1
71 5.388240124999999 0
72 5.401016625000000 1
73 5.562542875000000 0
74 5.576271875000000 1
75 5.766988875000000 0
76 5.780803875000000 1
77 5.970863625000000 0
78 5.983926500000000 1
79 6.000054500000000 0
80 6.012743625000000 1
81 6.174015000000000 0
82 6.187711500000000 1
83 6.377958749999999 0
84 6.391741375000000 1
85 6.581075500000000 0
86 6.594134500000000 1
87 6.610192124999999 0
88 6.622822875000000 1
89 6.783915875000000 0
90 6.797596875000000 1
91 6.987990874999999 0
92 7.001740125000000 1
93 7.191222124999999 0
94 7.204291124999999 1
95 7.220328125000000 0
96 7.232995250000000 1
97 7.393770624999999 0
98 7.407460500000000 1
99 7.597040499999999 0
100 7.610697249999999 1
101 7.799446000000000 0
102 7.812430750000000 1
103 7.828400374999999 0
104 7.841015000000000 1
105 8.001562125000000 0
106 8.015244875000000 1
107 8.204672750000000 0
108 8.218344249999999 1
109 8.406994375000000 0
110 8.419949125000000 1
111 8.435946000000000 0
112 8.448535249999999 1
113 8.608982500000000 0
114 8.622637124999999 1
115 8.811728750000000 0
116 8.825425375000000 1
117 9.013702875000000 0
118 9.026638125000000 1
119 9.042598000000000 0
120 9.055133874999999 1
121 9.215197999999999 0
122 9.228800000000000 1
123 9.417658874999999 0
124 9.431325124999999 1
125 9.619342375000000 0
126 9.632297625000000 1
127 9.648227250000000 0
128 9.660775500000000 1
129 9.820575000000000 0
130 9.834145999999999 1
131 10.022373875000000 0
132 10.035971374999999 1
133 10.223399875000000 0
134 10.236296124999999 1
135 10.252119374999999 0
136 10.264610249999999 1
137 10.423598875000000 0
138 10.437150749999999 1
139 10.624837500000000 0
140 10.638377499999999 1
141 10.825416125000000 0
142 10.838252125000000 1
143 10.854083500000000 0
144 10.866550000000000 1
145 11.025500874999999 0
146 11.039074124999999 1
147 11.226746125000000 0
148 11.240342249999999 1
149 11.427294874999999 0
150 11.440102374999999 1
151 11.455926000000000 0
152 11.468391374999999 1
153 11.627294124999999 0
154 11.640810499999999 1
155 11.828421375000000 0
156 11.842029000000000 1
157 12.028772750000000 0
158 12.041601000000000 1
159 12.057413750000000 0
160 12.069831875000000 1
161 12.228572374999999 0
162 12.242053374999999 1
163 12.429445500000000 0
164 12.442997750000000 1
165 12.629547375000000 0
166 12.642398000000000 1
167 12.658179250000000 0
168 12.670611624999999 1
169 12.828964749999999 0
170 12.842411624999999 1
171 13.029316874999999 0
172 13.042813749999999 1
173 13.228644874999999 0
174 13.241438499999999 1
175 13.257108250000000 0
176 13.269535749999999 1
177 13.427335625000000 0
178 13.440760500000000 1
179 13.626964375000000 0
180 13.640382624999999 1
181 13.825740000000000 0
182 13.838502499999999 1
183 13.854166625000000 0
184 13.866553999999999 1
185 14.024221375000000 0
186 14.037663125000000 1
187 14.223614124999999 0
188 14.237031625000000 1
189 14.421876624999999 0
190 14.434580125000000 1
191 14.450268124999999 0
192 14.462623375000000 1
193 14.619814499999999 0
194 14.633172499999999 1
195 14.818382874999999 0
196 14.831769999999999 1
197 15.016223000000000 0
198 15.028922374999999 1
199 15.044533249999999 0
200 15.056818249999999 1
201 15.213625875000000 0
202 15.226932625000000 1
203 15.411591999999999 0
204 15.424950375000000 1
205 15.608954749999999 0
206 15.621636875000000 1
207 15.637183499999999 0
208 15.649459374999999 1
209 15.805754374999999 0
210 15.819007124999999 1
211 16.003203499999998 0

View File

@ -0,0 +1,20 @@
#include "pch.h"
#include "logicdata_csv_reader.h"
TEST(nissan, realFromFileVVTIN) {
CsvReader reader(1, /* vvtCount */ 0);
reader.open("tests/trigger/resources/hr12-vvt-in-16s.csv");
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
eth.setTriggerType(trigger_type_e::TT_NISSAN_HR_CAM_IN);
while (reader.haveMore()) {
reader.processLine(&eth);
}
ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#realFromFileVVTIN";
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
ASSERT_EQ(202, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
}