rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
trigger_subaru.h File Reference

Detailed Description

Date
Sep 10, 2015
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file trigger_subaru.h.

Functions

void initialize36_2_2_2 (TriggerWaveform *s)
 
void initializeSubaru7_6 (TriggerWaveform *s)
 
void initializeSubaruOnly7 (TriggerWaveform *s)
 
void initializeSubaru7_6_crankOnly (TriggerWaveform *s)
 
void initializeSubaru_SVX (TriggerWaveform *s)
 
void initializeSubaruEZ30 (TriggerWaveform *s)
 
void initialize_one_of_36_2_2_2 (TriggerWaveform *s, int firstCount, int secondCount)
 

Function Documentation

◆ initialize36_2_2_2()

void initialize36_2_2_2 ( TriggerWaveform s)

This trigger is also used by Nissan and Mazda https://rusefi.com/forum/viewtopic.php?f=2&t=1932

Definition at line 43 of file trigger_subaru.cpp.

43 {
45
46#if EFI_UNIT_TEST
47 // usually used on crank but placed on 'cam' on '2-stroke' rotary
48 // this 'knownOperationMode' does not matter for trigger decoding only matters for .ini code generation and trigger images
49 s->knownOperationMode = false;
50#endif // EFI_UNIT_TEST
51
52 // 36/2/2/2 data from https://rusefi.com/online/view.php?log=1287
53 // todo: probably should be unified with EZ30 below?
54 s->setTriggerSynchronizationGap3(/*gapIndex*/0, 0.25, 0.5);
55 s->setTriggerSynchronizationGap3(/*gapIndex*/1, 0.7, 1.7);
56 s->setTriggerSynchronizationGap3(/*gapIndex*/2, 2.25, 4.2);
57}
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo)
void initialize_one_of_36_2_2_2(TriggerWaveform *s, int firstCount, int secondCount)

Referenced by TriggerWaveform::initializeTriggerWaveform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize_one_of_36_2_2_2()

void initialize_one_of_36_2_2_2 ( TriggerWaveform s,
int  firstCount,
int  secondCount 
)

Definition at line 12 of file trigger_subaru.cpp.

12 {
14
15 float narrow = 360 / 36;
16 float wide = narrow * 3;
17
18 float base = 0;
19
20 for (int i = 0; i < firstCount; i++) {
21 s->addToothFallRise(base + narrow, narrow / 2);
22 base += narrow;
23 }
24
25 s->addToothFallRise(base + wide, wide / 2);
26 base += wide;
27
28 for (int i = 0; i < secondCount; i++) {
29 s->addToothFallRise(base + narrow, narrow / 2);
30 base += narrow;
31 }
32
33 // depending on firstCount + secondCount we might have a gap here
34
35 s->addToothFallRise(360 - wide, narrow / 2);
36 s->addToothFallRise(360, narrow / 2);
37}
void initialize(operation_mode_e operationMode, SyncEdge syncEdge)
void addToothFallRise(angle_t angle, angle_t width=10, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
@ FOUR_STROKE_CRANK_SENSOR

Referenced by initialize36_2_2_2(), and initializeSubaruEZ30().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeSubaru7_6()

void initializeSubaru7_6 ( TriggerWaveform s)

Definition at line 159 of file trigger_subaru.cpp.

159 {
160 initializeSubaru7_6(s, true);
161}
static void initializeSubaru7_6(TriggerWaveform *s, bool withCrankWheel)
Here is the call graph for this function:

◆ initializeSubaru7_6_crankOnly()

void initializeSubaru7_6_crankOnly ( TriggerWaveform s)

Note how we use 0..180 range while defining FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR trigger Note that only half of the physical wheel is defined here!

Definition at line 215 of file trigger_subaru.cpp.

215 {
216 /**
217 * Note how we use 0..180 range while defining FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR trigger
218 * Note that only half of the physical wheel is defined here!
219 */
221
222 const float width = 1;
223 const float offset = 10;
224
225 s->tdcPosition = 65;
226
227 // BTDC: 97, 65, 10
228 // Distances: 93, 32, 55
231
234
237
238 // Nominal gaps:
239 // 55 / 32 = 1.7187
240 //s->setTriggerSynchronizationGap2(0.85f, 3.43f);
241 // 93 / 55 = 1.6909
242 //s->setTriggerSynchronizationGap2(0.84f, 3.38);
243 // 32 / 93 = 0.344
244 s->setTriggerSynchronizationGap2(0.172f, 0.688f);
245}
void addEventAngle(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo)
@ FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
uint16_t offset
Definition tunerstudio.h:0

Referenced by TriggerWaveform::initializeTriggerWaveform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeSubaru_SVX()

void initializeSubaru_SVX ( TriggerWaveform s)

Definition at line 266 of file trigger_subaru.cpp.

266 {
267 int n;
268 /* we should use only falling edges */
269 float width = 5.0;
270
271 float offset = 10.0; /* to make last event @ 720 */
272
273 /* T_CHANNEL_3 currently not supported, to keep trigger decode happy
274 * set cam second as primary, so logic will be able to sync
275 * Crank angle sensor #1 = TriggerWheel:: T_SECONDARY
276 * Crank andle sensor #2 = T_CHANNEL_3 - not supported yet
277 * Cam angle sensor = T_PRIMARY */
278#define SVX_CRANK_1 TriggerWheel::T_SECONDARY
279//#define SVX_CRANK_2 T_CHANNEL_3
280#define SVX_CAM TriggerWheel::T_PRIMARY
281
282#define CRANK_1_FALL(n) (20.0 + offset + 30.0 * (n))
283#define CRANK_1_RISE(n) (CRANK_1_FALL(n) - width)
284
285#define SUBARU_SVX_CRANK1_PULSE(n) \
286 s->addEventAngle(CRANK_1_RISE(n), TriggerValue::RISE, SVX_CRANK_1); \
287 s->addEventAngle(CRANK_1_FALL(n), TriggerValue::FALL, SVX_CRANK_1)
288
289 /* cam falling edge offset from preceding Cr #1 falling edge */
290 float cam_offset = (10.0 + 30.0 + 30.0 + 30.0) - 90.0;
291#define SUBARU_SVX_CAM_PULSE(n) \
292 s->addEvent720(CRANK_1_RISE(n) + cam_offset, TriggerValue::RISE, SVX_CAM); \
293 s->addEvent720(CRANK_1_FALL(n) + cam_offset, TriggerValue::FALL, SVX_CAM)
294
295#ifdef SVX_CRANK_2
296 /* Cr #2 signle tooth falling edge is (55 + 1) BTDC
297 * preceding Cr #1 falling edge is (10 + 30 + 30) BTDC */
298 float crank_2_offset = (10.0 + 30.0 + 30.0) - (55.0 + 1.0);
299
300 #define SUBARU_SVX_CRANK2_PULSE(n) \
301 s->addEvent720(CRANK_1_RISE(n) + crank_2_offset, TriggerValue::RISE, SVX_CRANK_2); \
302 s->addEvent720(CRANK_1_FALL(n) + crank_2_offset, TriggerValue::FALL, SVX_CRANK_2)
303#else
304 #define SUBARU_SVX_CRANK2_PULSE(n) (void)(n)
305#endif
306
307 /* we should use only falling edges */
308 // TODO: this trigger needs to be converted to SyncEdge::RiseOnly, so invert all rise/fall events!
309 // see https://github.com/rusefi/rusefi/issues/4624
311 s->isSynchronizationNeeded = false;
312 s->useOnlyPrimaryForSync = true;
313
314 /* counting Crank #1 tooths, should reach 23 at the end */
315 n = 0;
316 /****** 0 *****/
317 SUBARU_SVX_CRANK1_PULSE(n);
318 n++;
319 SUBARU_SVX_CRANK1_PULSE(n);
320 /* crank #2 - one 1/1 */
321 SUBARU_SVX_CRANK2_PULSE(n);
322 n++;
323 SUBARU_SVX_CRANK1_PULSE(n);
324 n++;
325 SUBARU_SVX_CRANK1_PULSE(n);
326 /* +10 - TDC #1 */
327 n++;
328 SUBARU_SVX_CRANK1_PULSE(n);
329 /* cam - one */
330 SUBARU_SVX_CAM_PULSE(n);
331 n++;
332 SUBARU_SVX_CRANK1_PULSE(n);
333 /* crank #2 - three - 1/3 */
334 SUBARU_SVX_CRANK2_PULSE(n);
335 n++;
336 SUBARU_SVX_CRANK1_PULSE(n);
337 /* crank #2 - three - 2/3 */
338 SUBARU_SVX_CRANK2_PULSE(n);
339 n++;
340 SUBARU_SVX_CRANK1_PULSE(n);
341 /* +10 - TDC #6 */
342 /* crank #2 - three - 3/3 */
343 SUBARU_SVX_CRANK2_PULSE(n);
344 n++;
345 SUBARU_SVX_CRANK1_PULSE(n);
346 n++;
347 SUBARU_SVX_CRANK1_PULSE(n);
348 /* crank #2 - two - 1/2 */
349 SUBARU_SVX_CRANK2_PULSE(n);
350 n++;
351 SUBARU_SVX_CRANK1_PULSE(n);
352 /* crank #2 - two - 2/2 */
353 SUBARU_SVX_CRANK2_PULSE(n);
354 n++;
355 SUBARU_SVX_CRANK1_PULSE(n);
356 /* +10 - TDC #3 */
357
358 /****** 360 *****/
359 n++;
360 SUBARU_SVX_CRANK1_PULSE(n);
361 n++;
362 SUBARU_SVX_CRANK1_PULSE(n);
363 /* crank #2 - one - 1/1 */
364 SUBARU_SVX_CRANK2_PULSE(n);
365 n++;
366 SUBARU_SVX_CRANK1_PULSE(n);
367 n++;
368 SUBARU_SVX_CRANK1_PULSE(n);
369 /* +10 - TDC #2 */
370 n++;
371 SUBARU_SVX_CRANK1_PULSE(n);
372 n++;
373 SUBARU_SVX_CRANK1_PULSE(n);
374 /* crank #2 - three - 1/3 */
375 SUBARU_SVX_CRANK2_PULSE(n);
376 n++;
377 SUBARU_SVX_CRANK1_PULSE(n);
378 /* crank #2 - three - 2/3 */
379 SUBARU_SVX_CRANK2_PULSE(n);
380 n++;
381 SUBARU_SVX_CRANK1_PULSE(n);
382 /* +10 - TDC #5 */
383 /* crank #2 - three - 3/3 */
384 SUBARU_SVX_CRANK2_PULSE(n);
385 n++;
386 SUBARU_SVX_CRANK1_PULSE(n);
387 n++;
388 SUBARU_SVX_CRANK1_PULSE(n);
389 /* crank #2 - two - 1/2 */
390 SUBARU_SVX_CRANK2_PULSE(n);
391 n++;
392 SUBARU_SVX_CRANK1_PULSE(n);
393 /* crank #2 - two - 2/2 */
394 SUBARU_SVX_CRANK2_PULSE(n);
395 n++;
396 SUBARU_SVX_CRANK1_PULSE(n);
397 /* +10 - TDC #4 */
398 /****** 720 *****/
399
400 /* from sichronization point, which is Cam falling */
401 s->tdcPosition = 720 - 30;
402
403#undef SUBARU_SVX_CRANK1_PULSE
404#undef SUBARU_SVX_CRANK2_PULSE
405#undef SUBARU_SVX_CAM_PULSE
406}
@ FOUR_STROKE_CAM_SENSOR

Referenced by TriggerWaveform::initializeTriggerWaveform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeSubaruEZ30()

void initializeSubaruEZ30 ( TriggerWaveform s)

Definition at line 59 of file trigger_subaru.cpp.

59 {
61
62 s->tdcPosition = 240;
63
64 s->setTriggerSynchronizationGap3(/*gapIndex*/0, 0.25, 0.5);
65 s->setTriggerSynchronizationGap3(/*gapIndex*/1, 0.7, 1.5);
66 s->setTriggerSynchronizationGap3(/*gapIndex*/2, 2, 4);
67}

Referenced by TriggerWaveform::initializeTriggerWaveform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeSubaruOnly7()

void initializeSubaruOnly7 ( TriggerWaveform s)

Definition at line 210 of file trigger_subaru.cpp.

210 {
211 //initializeSubaru7_6(s, false);
213}
void initializeSubaru7_6_camOnly(TriggerWaveform *s)

Referenced by TriggerWaveform::initializeTriggerWaveform().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.