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

Functions

angle_t getEngineCycle (operation_mode_e operationMode)
 
void addSkippedToothTriggerEvents (TriggerWheel wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, float toothWidthPercentage, float offset, float engineCycle, float filterLeft, float filterRight)
 
void initializeSkippedToothTrigger (TriggerWaveform *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode, SyncEdge syncEdge)
 
void configureOnePlusOne (TriggerWaveform *s)
 
void configure3_1_cam (TriggerWaveform *s)
 
void configureKawaKX450F (TriggerWaveform *s)
 
void configureQuickStartSenderWheel (TriggerWaveform *s)
 
static void commonSymmetrical (TriggerWaveform *s, int count, float gapFrom, float gapTo)
 
void configure12ToothCrank (TriggerWaveform *s)
 
void configure3ToothCrank (TriggerWaveform *s)
 
void configure6ToothCrank (TriggerWaveform *s)
 

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:

◆ commonSymmetrical()

static void commonSymmetrical ( TriggerWaveform s,
int  count,
float  gapFrom,
float  gapTo 
)
static

https://github.com/rusefi/rusefi/issues/4943#issuecomment-1376289608 gaps would be nice during running but horrible during running Hopefully we do not want variable gap logic yet?

Definition at line 153 of file trigger_universal.cpp.

153 {
154 s->shapeWithoutTdc = true;
155
156 // Sync after 2 good teeth
157 for (size_t i = 0; i < 2; i++) {
158 /**
159 * https://github.com/rusefi/rusefi/issues/4943#issuecomment-1376289608
160 * gaps would be nice during running but horrible during running
161 * Hopefully we do not want variable gap logic yet?
162 */
163 s->setTriggerSynchronizationGap3(i, gapFrom, gapTo);
164 }
165
166 float width = 360 / count;
167
168 // Just a single tooth with 50% duty cycle
171}
void addEventAngle(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo)
uint16_t count
Definition tunerstudio.h:1

Referenced by configure12ToothCrank(), configure3ToothCrank(), and configure6ToothCrank().

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

◆ configure12ToothCrank()

void configure12ToothCrank ( TriggerWaveform s)

Definition at line 176 of file trigger_universal.cpp.

176 {
178
179 // 2JZ would be global trigger offset 65 but same wheel could be Honda, not hard coding for now
180 commonSymmetrical(s, 12, 0.2f, 3.4f);
181}
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 85 of file trigger_universal.cpp.

85 {
87
88
89 const float crankW = 360 / 3 / 2;
90
91
93
96
97
98 float a = 2 * crankW;
99
100 // #1/3
101 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
102 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
103 // #2/3
104 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
105 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
106 // #3/3
107 a += crankW;
108 a += crankW;
109
110 // 2nd #1/3
111 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
112 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
113
114 // 2nd #2/3
115 s->addEvent720(a += crankW, TriggerValue::RISE, crank);
116 s->addEvent720(a += crankW, TriggerValue::FALL, crank);
117
118 s->isSynchronizationNeeded = false;
119}
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 183 of file trigger_universal.cpp.

183 {
185 commonSymmetrical(s, 3, 0.5, 1.4);
186}
@ 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 188 of file trigger_universal.cpp.

188 {
190 commonSymmetrical(s, 6, 0.7, 1.4);
191}
@ 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 124 of file trigger_universal.cpp.

124 {
125 float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
127
129
130 float toothWidth = 3 / 20.0;
131
132 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, 18, 0, toothWidth, 0, engineCycle,
133 NO_LEFT_FILTER, 720 - 39);
134
135 s->addToothRiseFall(360, /* width*/10.80);
136}
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->isSecondWheelCam = true;
81 s->isSynchronizationNeeded = false;
82 s->useOnlyPrimaryForSync = true;
83}
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 139 of file trigger_universal.cpp.

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

Referenced by TriggerWaveform::initializeTriggerWaveform().

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

◆ getEngineCycle()

angle_t getEngineCycle ( operation_mode_e  operationMode)
See also
getCycleDuration

Definition at line 15 of file trigger_universal.cpp.

15 {
16 return operationMode == TWO_STROKE ? 360 : FOUR_STROKE_ENGINE_CYCLE;
17}
@ TWO_STROKE

Referenced by TriggerWaveform::addEventClamped(), HpfpLobe::findNextLobe(), TriggerWaveform::getLength(), initializeSkippedToothTrigger(), prepareIgnitionSchedule(), prepareOutputSignals(), Engine::reset(), rpmShaftPositionCallback(), and TriggerCentral::syncEnginePhaseAndReport().

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.