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

Functions

void addSkippedToothTriggerEvents (TriggerWheel wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, float toothWidth, float offset, float engineCycle, float filterLeft, float filterRight)
 
void initializeSkippedToothTrigger (TriggerWaveform *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode, SyncEdge syncEdge)
 
void configure3_1_cam (TriggerWaveform *s)
 
void configureOnePlusOne (TriggerWaveform *s)
 
void configureQuickStartSenderWheel (TriggerWaveform *s)
 
void configureKawaKX450F (TriggerWaveform *s)
 
void configure3ToothCrank (TriggerWaveform *)
 
void configure6ToothCrank (TriggerWaveform *)
 
void configure12ToothCrank (TriggerWaveform *)
 

Function Documentation

◆ addSkippedToothTriggerEvents()

void addSkippedToothTriggerEvents ( TriggerWheel  wheel,
TriggerWaveform s,
int  totalTeethCount,
int  skippedCount,
float  toothWidthPercentage,
float  offset,
float  engineCycle,
float  filterLeft,
float  filterRight 
)

last fall aligned at 720 and skipped area is right before 720

Definition at line 22 of file trigger_universal.cpp.

23 {
24 criticalAssertVoid(totalTeethCount > 0, "total count");
25 criticalAssertVoid(skippedCount >= 0, "skipped count");
26 criticalAssertVoid(toothWidthPercentage < 1, "toothWidthPercentage");
27
28 float oneTooth = engineCycle / totalTeethCount;
29
30 for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
31 float angleDown = oneTooth * (i + (1 - toothWidthPercentage));
32 float angleUp = oneTooth * (i + 1);
33 s->addEventClamped(offset + angleDown, TriggerValue::RISE, wheel, filterLeft, filterRight);
34 s->addEventClamped(offset + angleUp, TriggerValue::FALL, wheel, filterLeft, filterRight);
35 }
36
37 float angleDown = oneTooth * (totalTeethCount - skippedCount - 1 + (1 - toothWidthPercentage));
38 s->addEventClamped(offset + angleDown, TriggerValue::RISE, wheel, filterLeft, filterRight);
39 // custom handling of last event in order to avoid rounding error
40 s->addEventClamped(offset + engineCycle, TriggerValue::FALL, wheel, filterLeft, filterRight);
41}
void addEventClamped(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex, float filterLeft, float filterRight)
uint16_t offset
Definition tunerstudio.h:0

Referenced by configureArcticCat(), configureKawaKX450F(), configureTriTach(), initDodgeRam(), initialize36_2_1(), initialize36_2_1_1(), initialize60_2_2_Renault_F(), initializeSkippedToothTrigger(), and setVwConfiguration().

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

◆ configure12ToothCrank()

void configure12ToothCrank ( TriggerWaveform s)

Definition at line 175 of file trigger_universal.cpp.

175 {
177
178 // 2JZ would be global trigger offset 65 but same wheel could be Honda, not hard coding for now
179 commonSymmetrical(s, 12, 0.2f, 3.4f);
180}
void initialize(operation_mode_e operationMode, SyncEdge syncEdge)
@ FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR
static void commonSymmetrical(TriggerWaveform *s, int count, float gapFrom, float gapTo)

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configure3_1_cam()

void configure3_1_cam ( TriggerWaveform s)

Definition at line 84 of file trigger_universal.cpp.

84 {
86
87
88 const float crankW = 360 / 3 / 2;
89
90
92
95
96
97 float a = 2 * crankW;
98
99 // #1/3
100 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
101 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
102 // #2/3
103 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
104 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
105 // #3/3
106 a += crankW;
107 a += crankW;
108
109 // 2nd #1/3
110 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
111 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
112
113 // 2nd #2/3
114 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
115 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
116
117 s->isSynchronizationNeeded = false;
118}
void addEvent720(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
@ FOUR_STROKE_CAM_SENSOR
TriggerWheel

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configure3ToothCrank()

void configure3ToothCrank ( TriggerWaveform s)

Definition at line 182 of file trigger_universal.cpp.

182 {
184 commonSymmetrical(s, 3, 0.5, 1.4);
185}
@ FOUR_STROKE_THREE_TIMES_CRANK_SENSOR

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configure6ToothCrank()

void configure6ToothCrank ( TriggerWaveform s)

Definition at line 187 of file trigger_universal.cpp.

187 {
189 commonSymmetrical(s, 6, 0.7, 1.4);
190}
@ FOUR_STROKE_SIX_TIMES_CRANK_SENSOR

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configureKawaKX450F()

void configureKawaKX450F ( TriggerWaveform s)

https://rusefi.com/forum/viewtopic.php?f=5&t=1977

Definition at line 123 of file trigger_universal.cpp.

123 {
124 float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
126
128
129 float toothWidth = 3 / 20.0;
130
131 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, 18, 0, toothWidth, 0, engineCycle,
132 NO_LEFT_FILTER, 720 - 39);
133
134 s->addToothRiseFall(360, /* width*/10.80);
135}
void setTriggerSynchronizationGap(float syncRatio)
void addToothRiseFall(angle_t angle, angle_t width=10, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
@ FOUR_STROKE_CRANK_SENSOR
void addSkippedToothTriggerEvents(TriggerWheel wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, float toothWidthPercentage, float offset, float engineCycle, float filterLeft, float filterRight)

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configureOnePlusOne()

void configureOnePlusOne ( TriggerWaveform s)

Definition at line 71 of file trigger_universal.cpp.

71 {
73
76
79
80 s->isSynchronizationNeeded = false;
81 s->useOnlyPrimaryForSync = true;
82}
void addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ configureQuickStartSenderWheel()

void configureQuickStartSenderWheel ( TriggerWaveform s)

Definition at line 138 of file trigger_universal.cpp.

138 {
139 // todo: most cam wheels are defined as 'SyncEdge::Rise' or 'SyncEdge::RiseOnly' shall we unify?
141
142 // our preference is to sync not too close to crank sync point
145
146 s->addToothRiseFall(90, /* width*/ 70);
147 s->addToothRiseFall(130, /* width*/ 20);
148 s->addToothRiseFall(220, /* width*/ 20);
149 s->addToothRiseFall(360, /* width*/ 70);
150}
void setSecondTriggerSynchronizationGap(float syncRatio)

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ initializeSkippedToothTrigger()

void initializeSkippedToothTrigger ( TriggerWaveform s,
int  totalTeethCount,
int  skippedCount,
operation_mode_e  operationMode,
SyncEdge  syncEdge 
)

Definition at line 43 of file trigger_universal.cpp.

44 {
45 if (totalTeethCount <= 0) {
46 firmwareError(ObdCode::CUSTOM_OBD_TRIGGER_WAVEFORM, "Invalid total tooth count for missing tooth decoder: %d", totalTeethCount);
48 return;
49 }
50 efiAssertVoid(ObdCode::CUSTOM_NULL_SHAPE, s != NULL, "TriggerWaveform is NULL");
51
52 s->initialize(operationMode, syncEdge);
53
54#if EFI_UNIT_TEST
55 s->knownOperationMode = false;
56#endif // EFI_UNIT_TEST
57
58 s->setTriggerSynchronizationGap(skippedCount + 1);
59 if (totalTeethCount > 6 && skippedCount > 0) {
60 // this gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise and potentially high rev noise as well
62 }
63 s->shapeWithoutTdc = (totalTeethCount > 1) && (skippedCount == 0);
64 s->isSynchronizationNeeded = (totalTeethCount > 2) && (skippedCount != 0);
65
66
67 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode),
68 NO_LEFT_FILTER, NO_RIGHT_FILTER);
69}
void setShapeDefinitionError(bool value)
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_NULL_SHAPE
@ CUSTOM_OBD_TRIGGER_WAVEFORM
angle_t getEngineCycle(operation_mode_e operationMode)

Referenced by customTrigger(), initializeMitsubishi4gSymmetricalCrank(), and 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.