rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Private Attributes
TriggerWaveform Class Reference

Trigger shape has all the fields needed to describe and decode trigger signal. More...

#include <trigger_structure.h>

Collaboration diagram for TriggerWaveform:
Collaboration graph
[legend]

Public Member Functions

 TriggerWaveform ()
 
void initializeTriggerWaveform (operation_mode_e triggerOperationMode, const trigger_config_s &triggerType, bool isCrankWheel=true)
 
void setShapeDefinitionError (bool value)
 
void calculateExpectedEventCounts ()
 
size_t getExpectedEventCount (TriggerWheel channelIndex) const
 
void addEvent (angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addEvent720 (angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addEvent360 (angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addToothRiseFall (angle_t angle, angle_t width=10, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addToothFallRise (angle_t angle, angle_t width=10, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addEventAngle (angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
 
void addEventClamped (angle_t angle, TriggerValue const state, TriggerWheel const channelIndex, float filterLeft, float filterRight)
 
operation_mode_e getWheelOperationMode () const
 
void initialize (operation_mode_e operationMode, SyncEdge syncEdge)
 
void setTriggerSynchronizationGap (float syncRatio)
 
void setTriggerSynchronizationGap3 (int index, float syncRatioFrom, float syncRatioTo)
 
void setTriggerSynchronizationGap4 (int index, float syncRatio)
 
void setTriggerSynchronizationGap2 (float syncRatioFrom, float syncRatioTo)
 
void setSecondTriggerSynchronizationGap (float syncRatio)
 
void setSecondTriggerSynchronizationGap2 (float syncRatioFrom, float syncRatioTo)
 
void setThirdTriggerSynchronizationGap (float syncRatio)
 
size_t getLength () const
 
size_t getSize () const
 
int getTriggerWaveformSynchPointIndex () const
 
angle_t getAngle (int phaseIndex) const
 
angle_t getCycleDuration () const
 
bool needsDisambiguation () const
 
void initializeSyncPoint (TriggerDecoderBase &state, const TriggerConfiguration &triggerConfiguration)
 
uint16_t findAngleIndex (TriggerFormDetails *details, angle_t angle) const
 
TriggerWheel getWheel (size_t index)
 
angle_t getSwitchAngle (int index) const
 

Data Fields

bool isSynchronizationNeeded
 
bool isSecondWheelCam
 
int gapTrackingLength = 1
 
bool shapeWithoutTdc = false
 
bool needSecondTriggerInput = false
 
bool shapeDefinitionError = false
 
int version = 0
 
float synchronizationRatioFrom [GAP_TRACKING_LENGTH]
 
float synchronizationRatioTo [GAP_TRACKING_LENGTH]
 
int syncRatioAvg
 
angle_t tdcPosition
 
bool useOnlyPrimaryForSync
 
SyncEdge syncEdge
 
bool useOnlyRisingEdges
 
size_t expectedEventCount [PWM_PHASE_MAX_WAVE_PER_PWM]
 
TriggerWheel triggerSignalIndeces [PWM_PHASE_MAX_COUNT]
 
TriggerValue triggerSignalStates [PWM_PHASE_MAX_COUNT]
 
bool knownOperationMode = true
 
MultiChannelStateSequenceWithData< PWM_PHASE_MAX_COUNT > wave
 
bool isRiseEvent [PWM_PHASE_MAX_COUNT]
 
int triggerShapeSynchPointIndex
 

Private Attributes

angle_t previousAngle
 
operation_mode_e operationMode
 

Detailed Description

Trigger shape has all the fields needed to describe and decode trigger signal.

See also
TriggerState for trigger decoder state which works based on this trigger shape model

Definition at line 47 of file trigger_structure.h.

Constructor & Destructor Documentation

◆ TriggerWaveform()

TriggerWaveform::TriggerWaveform ( )

Definition at line 61 of file trigger_structure.cpp.

61 {
63}
void initialize(operation_mode_e operationMode, SyncEdge syncEdge)
@ OM_NONE
Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void TriggerWaveform::addEvent ( angle_t  angle,
TriggerValue const  state,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)
Parameters
angle(0..1]

todo: it would be nice to be able to provide trigger angles without sorting them externally The idea here is to shift existing data - including handling high vs low state of the signals

Definition at line 270 of file trigger_structure.cpp.

270 {
271 efiAssertVoid(ObdCode::CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set");
272
273 if (channelIndex == TriggerWheel::T_SECONDARY) {
275 }
276
277#if EFI_UNIT_TEST
278 if (printTriggerDebug) {
279 printf("addEvent2 %.2f i=%d front=%d\r\n", angle, channelIndex, state);
280 }
281#endif
282
283#if EFI_UNIT_TEST
284 assertIsInBounds(wave.phaseCount, triggerSignalIndeces, "trigger shape overflow");
285 triggerSignalIndeces[wave.phaseCount] = channelIndex;
287#endif // EFI_UNIT_TEST
288
289
290 // todo: the whole 'useOnlyRisingEdgeForTrigger' parameter and logic should not be here
291 // todo: see calculateExpectedEventCounts
292 // related calculation should be done once trigger is initialized outside of trigger shape scope
294 expectedEventCount[(int)channelIndex]++;
295 }
296
297 if (angle <= 0 || angle > 1) {
298 firmwareError(ObdCode::CUSTOM_ERR_6599, "angle should be positive not above 1: index=%d angle %f", (int)channelIndex, angle);
299 return;
300 }
301 if (wave.phaseCount > 0) {
302 if (angle <= previousAngle) {
303 warning(ObdCode::CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order %s %s: new=%.2f/%f and prev=%.2f/%f, size=%d",
304 getTriggerWheel(channelIndex),
306 angle, angle * getCycleDuration(),
310 return;
311 }
312 }
313 previousAngle = angle;
314 if (wave.phaseCount == 0) {
315 wave.phaseCount = 1;
316 for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
317 wave.setChannelState(i, /* switchIndex */ 0, TriggerValue::FALL);
318 }
319
321 wave.setSwitchTime(0, angle);
322 wave.setChannelState((int)channelIndex, /* channelIndex */ 0, /* value */ state);
323 return;
324 }
325
326 if (wave.findAngleMatch(angle)) {
327 warning(ObdCode::CUSTOM_ERR_SAME_ANGLE, "same angle: not supported");
329 return;
330 }
331
332 int index = wave.findInsertionAngle(angle);
333
334 /**
335 * todo: it would be nice to be able to provide trigger angles without sorting them externally
336 * The idea here is to shift existing data - including handling high vs low state of the signals
337 */
338 // todo: does this logic actually work? I think it does not! due to broken state handling
339/*
340 for (int i = size - 1; i >= index; i--) {
341 for (int j = 0; j < PWM_PHASE_MAX_WAVE_PER_PWM; j++) {
342 wave.waves[j].pinStates[i + 1] = wave.getChannelState(j, index);
343 }
344 wave.setSwitchTime(i + 1, wave.getSwitchTime(i));
345 }
346*/
348
349 if ((unsigned)index != wave.phaseCount) {
350 firmwareError(ObdCode::ERROR_TRIGGER_DRAMA, "are we ever here?");
351 }
352
354
355 for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
356 pin_state_t value = wave.getChannelState(/* channelIndex */i, index - 1);
357 wave.setChannelState(i, index, value);
358 }
359 wave.setSwitchTime(index, angle);
360 wave.setChannelState((int)channelIndex, index, state);
361}
const char * getTriggerWheel(TriggerWheel value)
int findInsertionAngle(float angle) const
expected< int > findAngleMatch(float angle) const
pin_state_t getChannelState(int channelIndex, int phaseIndex) const override
void setSwitchTime(const int phaseIndex, const float value)
void setChannelState(const int channelIndex, const int phaseIndex, pin_state_t state)
void setShapeDefinitionError(bool value)
bool isRiseEvent[PWM_PHASE_MAX_COUNT]
angle_t getCycleDuration() const
TriggerValue triggerSignalStates[PWM_PHASE_MAX_COUNT]
operation_mode_e operationMode
MultiChannelStateSequenceWithData< PWM_PHASE_MAX_COUNT > wave
TriggerWheel triggerSignalIndeces[PWM_PHASE_MAX_COUNT]
size_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM]
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_ERR_SAME_ANGLE
@ CUSTOM_ERR_6599
@ CUSTOM_OMODE_UNDEF
@ CUSTOM_ERR_TRG_ANGLE_ORDER
@ ERROR_TRIGGER_DRAMA
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1890, 1.0, -1.0, -1.0, "")
TriggerValue
const char * getTrigger_value_e(TriggerValue value)
bool printTriggerDebug
printf("\n")

Referenced by addEvent360(), addEvent720(), addEventAngle(), addEventClamped(), and initialize60_2_2_Renault_F().

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

◆ addEvent360()

void TriggerWaveform::addEvent360 ( angle_t  angle,
TriggerValue const  state,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)

this method helps us use real world 360 degrees shape for FOUR_STROKE_CAM_SENSOR and FOUR_STROKE_CRANK_SENSOR

Definition at line 250 of file trigger_structure.cpp.

250 {
252#define CRANK_MODE_MULTIPLIER 2.0f
253 addEvent(CRANK_MODE_MULTIPLIER * angle / FOUR_STROKE_CYCLE_DURATION, state, channelIndex);
254}
void addEvent(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
@ FOUR_STROKE_CRANK_SENSOR
@ FOUR_STROKE_CAM_SENSOR

Referenced by addToothFallRise(), addToothRiseFall(), addvq30tooth(), configure60degSingleTooth(), configureBenelli(), configureGm60_2_2_2(), configureNeon1995TriggerWaveformOnlyCrank(), configureNeon2003TriggerWaveformCrank(), configureOnePlusOne(), gm_tooth_pair(), initializeMazdaLCam(), initializeMitsubishi4G69Cam(), initializeSuzukiK6A(), initializeVvt6G72(), initializeVvtN63TU(), and setSkodaFavorit().

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

◆ addEvent720()

void TriggerWaveform::addEvent720 ( angle_t  angle,
TriggerValue const  state,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)

◆ addEventAngle()

void TriggerWaveform::addEventAngle ( angle_t  angle,
TriggerValue const  state,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)

This version of the method is best when same wheel could be mounted either on crank or cam

This version of 'addEvent...' family considers the angle duration of operationMode in this trigger For example, (0..180] for FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR

TODO: one day kill all usages with FOUR_STROKE_CAM_SENSOR 720 cycle and add runtime prohibition TODO: for FOUR_STROKE_CAM_SENSOR addEvent360 is the way to go

Parameters
angle(0..360] or (0..720] depending on configuration

Definition at line 266 of file trigger_structure.cpp.

266 {
267 addEvent(angle / getCycleDuration(), state, channelIndex);
268}

Referenced by commonRenix(), commonSymmetrical(), configureChryslerNGC_36_2_2(), configureFordPip(), configureFordST170(), configureJeepEVD_36_2_2(), daihatsu(), initializeMazdaMiataNb2Crank(), initializeNissanQR25crank(), initializeSubaru7_6_crankOnly(), JeepRenix66_2_2(), and makeNissanPattern().

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

◆ addEventClamped()

void TriggerWaveform::addEventClamped ( angle_t  angle,
TriggerValue const  state,
TriggerWheel const  channelIndex,
float  filterLeft,
float  filterRight 
)

Definition at line 189 of file trigger_structure.cpp.

189 {
190 if (angle > filterLeft && angle < filterRight) {
191#if EFI_UNIT_TEST
192// printf("addEventClamped %f %s\r\n", angle, getTrigger_value_e(stateParam));
193#endif /* EFI_UNIT_TEST */
194 addEvent(angle / getEngineCycle(operationMode), stateParam, channelIndex);
195 }
196}
angle_t getEngineCycle(operation_mode_e operationMode)

Referenced by addSkippedToothTriggerEvents(), configureTriTach(), and setVwConfiguration().

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

◆ addToothFallRise()

void TriggerWaveform::addToothFallRise ( angle_t  angle,
angle_t  width = 10,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)

Definition at line 261 of file trigger_structure.cpp.

261 {
262 addEvent360(angle - width, TriggerValue::FALL, channelIndex);
263 addEvent360(angle, TriggerValue::RISE, channelIndex);
264}
void addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)

Referenced by initialize_one_of_24_2_2(), initialize_one_of_36_2_2(), and initialize_one_of_36_2_2_2().

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

◆ addToothRiseFall()

void TriggerWaveform::addToothRiseFall ( angle_t  angle,
angle_t  width = 10,
TriggerWheel const  channelIndex = TriggerWheel::T_PRIMARY 
)

◆ calculateExpectedEventCounts()

void TriggerWaveform::calculateExpectedEventCounts ( )

Definition at line 214 of file trigger_structure.cpp.

214 {
215 if (!useOnlyRisingEdges) {
216 for (size_t i = 0; i < efi::size(expectedEventCount); i++) {
217 if (getExpectedEventCount((TriggerWheel)i) % 2 != 0) {
218 firmwareError(ObdCode::ERROR_TRIGGER_DRAMA, "Trigger: should be even number of events index=%d count=%d", i, getExpectedEventCount((TriggerWheel)i));
219 }
220 }
221 }
222
224 // todo: next step would be to set 'isSynchronizationNeeded' automatically based on the logic we have here
225 if (!shapeWithoutTdc && isSingleToothOnPrimaryChannel != !isSynchronizationNeeded) {
226 firmwareError(ObdCode::ERROR_TRIGGER_DRAMA, "shapeWithoutTdc isSynchronizationNeeded isSingleToothOnPrimaryChannel constraint violation");
227 }
228 if (isSingleToothOnPrimaryChannel) {
230 } else {
232 firmwareError(ObdCode::ERROR_TRIGGER_DRAMA, "why would you set useOnlyPrimaryForSync with only one trigger wheel?");
233 }
234 }
235
236// todo: move the following logic from below here
237 // if (!useOnlyRisingEdgeForTrigger || stateParam == TriggerValue::RISE) {
238// expectedEventCount[channelIndex]++;
239// }
240
241}
size_t getExpectedEventCount(TriggerWheel channelIndex) const
TriggerWheel

Referenced by initializeTriggerWaveform().

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

◆ findAngleIndex()

uint16_t TriggerWaveform::findAngleIndex ( TriggerFormDetails details,
angle_t  angle 
) const

Let's find the last trigger angle which is less or equal to the desired angle todo: extract binary search as template method?

Definition at line 390 of file trigger_structure.cpp.

390 {
391 size_t engineCycleEventCount = getLength();
392
393 efiAssert(ObdCode::CUSTOM_ERR_ASSERT, engineCycleEventCount != 0 && engineCycleEventCount <= 0xFFFF,
394 "engineCycleEventCount", 0);
395
396 uint32_t left = 0;
397 uint32_t right = engineCycleEventCount - 1;
398
399 /**
400 * Let's find the last trigger angle which is less or equal to the desired angle
401 * todo: extract binary search as template method?
402 */
403 do {
404 uint32_t middle = (left + right) / 2;
405
406 if (details->eventAngles[middle] <= targetAngle) {
407 left = middle + 1;
408 } else {
409 right = middle - 1;
410 }
411 } while (left <= right);
412 left -= 1;
413 if (useOnlyRisingEdges) {
414 left &= ~1U;
415 }
416 return left;
417}
angle_t eventAngles[2 *PWM_PHASE_MAX_COUNT]
size_t getLength() const
@ CUSTOM_ERR_ASSERT

Referenced by InstantRpmCalculator::calculateInstantRpm().

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

◆ getAngle()

angle_t TriggerWaveform::getAngle ( int  phaseIndex) const

This private method should only be used to prepare the array of pre-calculated values See eventAngles array

FOUR_STROKE_CRANK_SENSOR magic: We have two crank shaft revolutions for each engine cycle See also trigger_central.cpp See also getEngineCycleEventCount()

Definition at line 172 of file trigger_structure.cpp.

172 {
173 /**
174 * FOUR_STROKE_CRANK_SENSOR magic:
175 * We have two crank shaft revolutions for each engine cycle
176 * See also trigger_central.cpp
177 * See also getEngineCycleEventCount()
178 */
179 efiAssert(ObdCode::CUSTOM_ERR_ASSERT, wave.phaseCount != 0, "shapeSize=0", NAN);
180 int crankCycle = index / wave.phaseCount;
181 int remainder = index % wave.phaseCount;
182
183 auto cycleStartAngle = getCycleDuration() * crankCycle;
184 auto positionWithinCycle = getSwitchAngle(remainder);
185
186 return cycleStartAngle + positionWithinCycle;
187}
angle_t getSwitchAngle(int index) const

Referenced by TriggerFormDetails::prepareEventAngles().

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

◆ getCycleDuration()

angle_t TriggerWaveform::getCycleDuration ( ) const

physical primary trigger duration

See also
getEngineCycle
getCrankDivider

Definition at line 115 of file trigger_structure.cpp.

115 {
116 switch (operationMode) {
118 return FOUR_STROKE_CYCLE_DURATION / SYMMETRICAL_CRANK_SENSOR_DIVIDER;
120 return FOUR_STROKE_CYCLE_DURATION / SYMMETRICAL_THREE_TIMES_CRANK_SENSOR_DIVIDER;
122 return FOUR_STROKE_CYCLE_DURATION / SYMMETRICAL_SIX_TIMES_CRANK_SENSOR_DIVIDER;
124 return FOUR_STROKE_CYCLE_DURATION / SYMMETRICAL_TWELVE_TIMES_CRANK_SENSOR_DIVIDER;
126 case TWO_STROKE:
127 return TWO_STROKE_CYCLE_DURATION;
128 case OM_NONE:
130 return FOUR_STROKE_CYCLE_DURATION;
131 }
132 criticalError("unreachable getCycleDuration");
133 return 0;
134}
@ FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
@ FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR
@ FOUR_STROKE_THREE_TIMES_CRANK_SENSOR
@ TWO_STROKE
@ FOUR_STROKE_SIX_TIMES_CRANK_SENSOR

Referenced by addEvent(), addEventAngle(), commonRenix(), configureChryslerNGC_36_2_2(), configureFordPip(), configureFordST170(), daihatsu(), getAngle(), getLength(), getSwitchAngle(), initializeTriggerWaveform(), and JeepRenix66_2_2().

Here is the caller graph for this function:

◆ getExpectedEventCount()

size_t TriggerWaveform::getExpectedEventCount ( TriggerWheel  channelIndex) const

Definition at line 210 of file trigger_structure.cpp.

210 {
211 return expectedEventCount[(int)channelIndex];
212}

Referenced by calculateExpectedEventCounts(), TriggerDecoderBase::getEventCountersError(), and Engine::OnTriggerSynchronization().

Here is the caller graph for this function:

◆ getLength()

size_t TriggerWaveform::getLength ( ) const

this one is per CRANKshaft revolution

Trigger event count equals engine cycle event count if we have a cam sensor. Two trigger cycles make one engine cycle in case of a four stroke engine If we only have a cranksensor.

'engine->engineCycleEventCount' hold a pre-calculated copy of this value as a performance optimization

24 for FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR 6 for FOUR_STROKE_THREE_TIMES_CRANK_SENSOR 4 for FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR 2 for FOUR_STROKE_CRANK_SENSOR 1 otherwise

Definition at line 160 of file trigger_structure.cpp.

160 {
161 /**
162 * 24 for FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR
163 * 6 for FOUR_STROKE_THREE_TIMES_CRANK_SENSOR
164 * 4 for FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
165 * 2 for FOUR_STROKE_CRANK_SENSOR
166 * 1 otherwise
167 */
168 int multiplier = getEngineCycle(operationMode) / getCycleDuration();
169 return multiplier * getSize();
170}
size_t getSize() const

Referenced by TriggerCentral::applyShapesConfiguration(), TriggerDecoderBase::decodeTriggerEvent(), findAngleIndex(), InstantRpmCalculator::movePreSynchTimestamps(), and TriggerFormDetails::prepareEventAngles().

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

◆ getSize()

size_t TriggerWaveform::getSize ( ) const

◆ getSwitchAngle()

angle_t TriggerWaveform::getSwitchAngle ( int  index) const

These angles are in trigger DESCRIPTION coordinates - i.e. the way you add events while declaring trigger shape

Definition at line 363 of file trigger_structure.cpp.

363 {
364 return getCycleDuration() * wave.getSwitchTime(index);
365}
float getSwitchTime(int phaseIndex) const override

Referenced by getAngle().

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

◆ getTriggerWaveformSynchPointIndex()

int TriggerWaveform::getTriggerWaveformSynchPointIndex ( ) const

Definition at line 106 of file trigger_structure.cpp.

106 {
108}

◆ getWheel()

TriggerWheel TriggerWaveform::getWheel ( size_t  index)

Definition at line 419 of file trigger_structure.cpp.

419 {
420#if EFI_UNIT_TEST
421 return triggerSignalIndeces[index];
422#endif
424}

Referenced by TriggerFormDetails::prepareEventAngles().

Here is the caller graph for this function:

◆ getWheelOperationMode()

operation_mode_e TriggerWaveform::getWheelOperationMode ( ) const

See also Engine::getOperationMode which accounts for additional settings which are needed to resolve precise mode for vague wheels

Definition at line 202 of file trigger_structure.cpp.

202 {
203 return operationMode;
204}

Referenced by RpmCalculator::getOperationMode(), TriggerCentral::handleShaftSignal(), and needsDisambiguation().

Here is the caller graph for this function:

◆ initialize()

void TriggerWaveform::initialize ( operation_mode_e  operationMode,
SyncEdge  syncEdge 
)

Definition at line 65 of file trigger_structure.cpp.

65 {
66 operationMode = p_operationMode;
67 syncEdge = p_syncEdge;
68
69 isSynchronizationNeeded = true; // that's default value
70 isSecondWheelCam = false;
72 shapeWithoutTdc = false;
73
74 // If RiseOnly, ignore falling edges completely.
76
78 for (int gapIndex = 1; gapIndex < GAP_TRACKING_LENGTH ; gapIndex++) {
79 // NaN means do not use this gap ratio
80 setTriggerSynchronizationGap3(gapIndex, NAN, 100000);
81 }
83
84 tdcPosition = 0;
87
90 wave.reset();
91 wave.waveCount = TRIGGER_INPUT_PIN_COUNT;
92 wave.phaseCount = 0;
93 previousAngle = 0;
95#if EFI_UNIT_TEST
97 memset(&triggerSignalStates, 0, sizeof(triggerSignalStates));
98 knownOperationMode = true;
99#endif // EFI_UNIT_TEST
100}
void setTriggerSynchronizationGap(float syncRatio)
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo)
void setArrayValues(TValue(&array)[TSize], float value)

Referenced by configure12ToothCrank(), configure3_1_cam(), configure3ToothCrank(), configure60degSingleTooth(), configure6ToothCrank(), configureArcticCat(), configureBarra3plus1cam(), configureBenelli(), configureChryslerNGC_36_2_2(), configureChryslerVtt15(), configureDodgeStratusTriggerWaveform(), configureFiatIAQ_P8(), configureFordAspireTriggerWaveform(), configureFordCoyote(), configureFordPip(), configureFordST170(), configureGm60_2_2_2(), configureGmTriggerWaveform(), configureHondaCbr600(), configureHondaK_12_1(), configureHondaK_4_1(), configureJeepEVD_36_2_2(), configureKawaKX450F(), configureMazdaProtegeLx(), configureMazdaProtegeSOHC(), configureNeon1995TriggerWaveformOnlyCrank(), configureNeon2003TriggerWaveformCam(), configureNeon2003TriggerWaveformCrank(), configureOnePlusOne(), configureQuickStartSenderWheel(), configureTriTach(), daihatsu(), initDodgeRam(), initGmLS24(), initialize2jzGE3_34_simulation_shape(), initialize36_2_1(), initialize36_2_1_1(), initialize60_2_2_Renault_F(), initialize_one_of_24_2_2(), initialize_one_of_36_2_2(), initialize_one_of_36_2_2_2(), initializeJeepRenix66_2_2(), initializeMazdaLCam(), initializeMazdaMiataNaShape(), initializeMazdaMiataNb1ShapeWithOffset(), initializeMazdaMiataNb2Crank(), initializeMazdaMiataVVtCamShape(), initializeMazdaSkyactivCam(), initializeMitsubishi4g63Cam(), initializeMitsubishi4G69Cam(), initializeNissanHRvvtIn(), initializeNissanK11(), initializeNissanMR18crank(), initializeNissanMRvvt(), initializeNissanQR25crank(), initializeNissanSR20VE_4(), initializeNissanVQ30cam(), initializeNissanVQ35crank(), initializeNissanVQvvt(), initializeRenix44_2_2(), initializeRenix66_2_2(), initializeRoverK(), initializeSkippedToothTrigger(), initializeSubaru7_6(), initializeSubaru7_6_camOnly(), initializeSubaru7_6_crankOnly(), initializeSubaru_SVX(), initializeSuzukiG13B(), initializeSuzukiK6A(), initializeUzCam(), initializeVvt3A92(), initializeVvt6G72(), initializeVvtN63TU(), initJeep18_2_2_2(), initJeep_XJ_4cyl_2500(), setMercedesTwoSegment(), setSkodaFavorit(), setVwConfiguration(), and TriggerWaveform().

Here is the call graph for this function:

◆ initializeSyncPoint()

void TriggerWaveform::initializeSyncPoint ( TriggerDecoderBase state,
const TriggerConfiguration triggerConfiguration 
)

Definition at line 112 of file trigger_decoder.cpp.

113 {
114 triggerShapeSynchPointIndex = state.findTriggerZeroEventIndex(*this, triggerConfiguration);
115}

Referenced by calculateTriggerSynchPoint(), and initVvtShape().

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

◆ initializeTriggerWaveform()

void TriggerWaveform::initializeTriggerWaveform ( operation_mode_e  triggerOperationMode,
const trigger_config_s triggerType,
bool  isCrankWheel = true 
)

External logger is needed because at this point our logger is not yet initialized

Note
TT_HALF_MOON setup events as 180 and 360 degrees. It uses SyncEdge::Rise for additional phase align on falling edge and will not work with non- symmetrical blind type where open and closed sections are not equal

different from TT_HALF_MOON

Note
Have a something like TT_ONE_PHASED trigger with externally setuped blind width will be a good approach to utilize Rise(and::Both in future) with both edges phase-sync, but to stay simple I suggest just to use another enum for each trigger type.

Feb 2019 suggestion: it would be an improvement to remove 'expectedEventCount' logic from 'addEvent' and move it here, after all events were added.

Definition at line 458 of file trigger_structure.cpp.

458 {
459
460#if EFI_PROD_CODE
461 efiAssertVoid(ObdCode::CUSTOM_ERR_6641, hasLotsOfRemainingStack(), "init t");
462 efiPrintf("initializeTriggerWaveform(%s/%d)", getTrigger_type_e(triggerType.type), (int)triggerType.type);
463#endif
464
465 shapeDefinitionError = false;
466
467 switch (triggerType.type) {
469 initializeSkippedToothTrigger(this, triggerType.customTotalToothCount,
470 triggerType.customSkippedToothCount, triggerOperationMode, SyncEdge::RiseOnly);
471 break;
472
475 break;
476
479 break;
480
483 break;
484
487 break;
488
490 configureFordPip(this);
491 break;
492
494 configureFordST170(this);
495 break;
496
499 break;
500
503 break;
504
507 break;
508
511 break;
512
516 break;
517
520 break;
521
524 break;
525
528// configureNeon2003TriggerWaveformCrank(triggerShape);
529 break;
530
533 break;
534
537 break;
538
540 initializeVvt6G72(this);
541 break;
542
544 initializeVvt3A92(this);
545 break;
546
548 initializeUzCam(this);
549 break;
550
552 initializeSkippedToothTrigger(this, 4, 1, triggerOperationMode, SyncEdge::RiseOnly);
553 setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.60, 2.40);
554 setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.75, 1.25);
555 break;
556
559 break;
560
563 break;
564
567 break;
568
571 break;
572
575 break;
576
579 break;
580
582 setSkodaFavorit(this);
583 break;
584
587 break;
588
591 break;
592
595 break;
596
599 break;
600
602 configure3_1_cam(this);
603 break;
604
607 break;
608
610 /** @note TT_HALF_MOON setup events as 180 and 360 degrees. It uses SyncEdge::Rise
611 * for additional phase align on falling edge and will not work with non-
612 * symmetrical blind type where open and closed sections are not equal */
613 initializeSkippedToothTrigger(this, 1, 0, triggerOperationMode, SyncEdge::Rise);
614 break;
615
617 /** different from TT_HALF_MOON */
618 initializeSkippedToothTrigger(this, 1, 0, triggerOperationMode, SyncEdge::RiseOnly);
619 break;
620
623 break;
624
627 break;
628
631 break;
632
634 initializeSkippedToothTrigger(this, 3, 0, triggerOperationMode, SyncEdge::RiseOnly);
635 break;
636
638 initialize36_2_1_1(this);
639 break;
640
642 initialize36_2_1(this);
643 break;
644
646 initializeSkippedToothTrigger(this, 32, 2, triggerOperationMode, SyncEdge::RiseOnly);
647 // todo: why is this 32/2 asking for third gap while 60/2 is happy with just two gaps?
648 // method above sets second gap, here we add third
649 // this third gap is not required to sync on perfect signal but is needed to handle to reject cranking transition noise
651 break;
652
654 initializeSkippedToothTrigger(this, 60, 2, triggerOperationMode, SyncEdge::RiseOnly);
655 break;
656
658 initializeSkippedToothTrigger(this, 36, 2, triggerOperationMode, SyncEdge::RiseOnly);
659 setTriggerSynchronizationGap3(/*gapIndex*/0, /*from*/1.6, 3.5);
660 setTriggerSynchronizationGap3(/*gapIndex*/1, /*from*/0.7, 1.3); // second gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise
661 break;
662
664 setVwConfiguration(this);
665 break;
666
668 initializeSkippedToothTrigger(this, 36, 1, triggerOperationMode, SyncEdge::RiseOnly);
669 break;
670
673 break;
674
677 break;
678
681 break;
682
685 break;
686
689 break;
690
693 break;
694
697 break;
698
701 break;
702
704 configureBenelli(this);
705 break;
706
709 break;
713 break;
715 /** @note
716 * Have a something like TT_ONE_PHASED trigger with
717 * externally setuped blind width will be a good
718 * approach to utilize ::Rise(and::Both in future)
719 * with both edges phase-sync, but to stay simple I suggest
720 * just to use another enum for each trigger type. */
722 break;
725 break;
728 break;
731 break;
732
735 break;
738 break;
739
742 break;
745 break;
746
749 break;
750
752 initDodgeRam(this);
753 break;
754
757 break;
758
760 initJeep18_2_2_2(this);
761 break;
762
765 break;
766
768 initialize36_2_2_2(this);
769 break;
770
773 break;
774
777 break;
778
781 break;
782
785 break;
786
788 configureArcticCat(this);
789 break;
790
793 break;
796 break;
799 break;
800
802 initializeRoverK(this);
803 break;
804
807 break;
808
810 configureTriTach(this);
811 break;
812
814 initGmLS24_5deg(this);
815 break;
816
818 initGmLS24_3deg(this);
819 break;
820
823 break;
824
827 break;
828
831 break;
832
835 break;
836
839 break;
840
845 break;
846
847
848 default:
849 customTrigger(triggerOperationMode, this, triggerType.type);
850 }
851
852 if (isCrankWheel && !needSecondTriggerInput &&
853#if EFI_UNIT_TEST
854 engineConfiguration != nullptr &&
855#endif
857// todo: technical debt: HW CI should not require special treatment
858#ifndef HARDWARE_CI
859 criticalError("Single-channel trigger %s selected while two inputs were configured", getTrigger_type_e(triggerType.type));
860#endif
861 }
862
863 /**
864 * Feb 2019 suggestion: it would be an improvement to remove 'expectedEventCount' logic from 'addEvent'
865 * and move it here, after all events were added.
866 */
868 version++;
869
872 }
873}
const char * getTrigger_type_e(trigger_type_e value)
void checkSwitchTimes(float scale) const
void setThirdTriggerSynchronizationGap(float syncRatio)
@ Unassigned
static constexpr engine_configuration_s * engineConfiguration
@ TT_2JZ_3_34_SIMULATION_ONLY
@ TT_DODGE_NEON_1995_ONLY_CRANK
@ CUSTOM_ERR_6641
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
void configureChryslerVtt15(TriggerWaveform *s)
void configureDodgeStratusTriggerWaveform(TriggerWaveform *s)
void configureChryslerNGC_36_2_2(TriggerWaveform *s)
void initJeep18_2_2_2(TriggerWaveform *s)
void initJeep_XJ_4cyl_2500(TriggerWaveform *s)
void configureNeon2003TriggerWaveformCam(TriggerWaveform *s)
void configureNeon1995TriggerWaveformOnlyCrank(TriggerWaveform *s)
void configureJeepEVD_36_2_2(TriggerWaveform *s)
void initDodgeRam(TriggerWaveform *s)
void configureFordCoyote(TriggerWaveform *s)
void initGmLS24_3deg(TriggerWaveform *s)
void configureGmTriggerWaveform(TriggerWaveform *s)
void initGmLS24_5deg(TriggerWaveform *s)
void configureGm60_2_2_2(TriggerWaveform *s)
void configureHondaCbr600(TriggerWaveform *s)
void configureHondaK_12_1(TriggerWaveform *s)
void configureHondaJ30A2_24_1_1(TriggerWaveform *s)
void configureHondaK_4_1(TriggerWaveform *s)
triggerType
void configureMazdaProtegeSOHC(TriggerWaveform *s)
void configureMazdaProtegeLx(TriggerWaveform *s)
void initializeMazdaMiataVVtTestShape(TriggerWaveform *s)
void initializeMazdaMiataNaShape(TriggerWaveform *s)
void initializeMazdaLCam(TriggerWaveform *s)
void initializeMazdaMiataVVtCamShape(TriggerWaveform *s)
void initializeMazdaMiataNb2Crank(TriggerWaveform *s)
void initializeMazdaSkyactivCam(TriggerWaveform *s)
void setMercedesTwoSegment(TriggerWaveform *s)
void configureDaihatsu4cyl(TriggerWaveform *s)
void configureDaihatsu3cyl(TriggerWaveform *s)
void configureBarra3plus1cam(TriggerWaveform *s)
void configureFordPip(TriggerWaveform *s)
void configureTriTach(TriggerWaveform *s)
void configureFiatIAQ_P8(TriggerWaveform *s)
void configureFordST170(TriggerWaveform *s)
void configure60degSingleTooth(TriggerWaveform *s)
Configure trigger as Sovek or Saruman ignition.
void configureArcticCat(TriggerWaveform *s)
void configureBenelli(TriggerWaveform *s)
void initializeVvt6G72(TriggerWaveform *s)
void initialize36_2_1(TriggerWaveform *s)
void initializeMitsubishi4gSymmetricalCrank(TriggerWaveform *s)
void initializeVvt3A92(TriggerWaveform *s)
void initializeMitsubishi4g63Cam(TriggerWaveform *s)
void initializeMitsubishi4G69Cam(TriggerWaveform *s)
void configureFordAspireTriggerWaveform(TriggerWaveform *s)
void initialize36_2_1_1(TriggerWaveform *s)
void initializeNissanVQvvt(TriggerWaveform *s)
void initializeNissanSR20VE_4(TriggerWaveform *s)
void initializeNissanQR25crank(TriggerWaveform *s)
void initializeNissanVQ35crank(TriggerWaveform *s)
void initializeNissanHRvvtIn(TriggerWaveform *s)
void initializeNissanVQ30cam(TriggerWaveform *s)
void initializeNissanMR18crank(TriggerWaveform *s)
void initializeNissanHRcrank(TriggerWaveform *s)
void initializeNissanMRvvt(TriggerWaveform *s)
void initializeNissanK11(TriggerWaveform *s)
void initialize60_2_2_Renault_F(TriggerWaveform *s)
void initializeRenix66_2_2(TriggerWaveform *s)
void initializeRenix44_2_2(TriggerWaveform *s)
void initializeJeepRenix66_2_2(TriggerWaveform *s)
void initializeRoverK(TriggerWaveform *s)
PUBLIC_API_WEAK void customTrigger(operation_mode_e triggerOperationMode, TriggerWaveform *s, trigger_type_e type)
void initializeSubaru_SVX(TriggerWaveform *s)
void initializeSubaru7_6_crankOnly(TriggerWaveform *s)
void initialize36_2_2_2(TriggerWaveform *s)
static void initializeSubaru7_6(TriggerWaveform *s, bool withCrankWheel)
void initializeSubaruOnly7(TriggerWaveform *s)
void initializeSubaruEZ30(TriggerWaveform *s)
void initializeSuzukiK6A(TriggerWaveform *s)
void initializeSuzukiG13B(TriggerWaveform *s)
void initialize2jzGE3_34_simulation_shape(TriggerWaveform *s)
void initializeUzCam(TriggerWaveform *s)
void configure3ToothCrank(TriggerWaveform *s)
void configureQuickStartSenderWheel(TriggerWaveform *s)
void configureKawaKX450F(TriggerWaveform *s)
void configureOnePlusOne(TriggerWaveform *s)
void configure12ToothCrank(TriggerWaveform *s)
void initializeSkippedToothTrigger(TriggerWaveform *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode, SyncEdge syncEdge)
void configure3_1_cam(TriggerWaveform *s)
void configure6ToothCrank(TriggerWaveform *s)
void setVwConfiguration(TriggerWaveform *s)
void setSkodaFavorit(TriggerWaveform *s)

Referenced by TriggerCentral::applyShapesConfiguration(), and initVvtShape().

Here is the caller graph for this function:

◆ needsDisambiguation()

bool TriggerWaveform::needsDisambiguation ( ) const

Definition at line 136 of file trigger_structure.cpp.

136 {
137 switch (getWheelOperationMode()) {
143 return true;
145 case TWO_STROKE:
146 case OM_NONE:
147 return false;
148 /* let's NOT handle default in order to benefit from -Werror=switch */
149 }
150 criticalError("unreachable needsDisambiguation");
151 return true;
152}
operation_mode_e getWheelOperationMode() const

Referenced by TriggerCentral::applyShapesConfiguration().

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

◆ setSecondTriggerSynchronizationGap()

void TriggerWaveform::setSecondTriggerSynchronizationGap ( float  syncRatio)

◆ setSecondTriggerSynchronizationGap2()

void TriggerWaveform::setSecondTriggerSynchronizationGap2 ( float  syncRatioFrom,
float  syncRatioTo 
)

Definition at line 438 of file trigger_structure.cpp.

438 {
439 setTriggerSynchronizationGap3(/*gapIndex*/1, syncRatioFrom, syncRatioTo);
440}

Referenced by configureHondaK_12_1(), initializeMazdaMiataNaShape(), initializeMazdaMiataNb2Crank(), initializeMazdaMiataVVtCamShape(), initializeMitsubishi4g63Cam(), initializeNissanMRvvt(), initializeNissanVQvvt(), and initializeRoverK().

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

◆ setShapeDefinitionError()

void TriggerWaveform::setShapeDefinitionError ( bool  value)

◆ setThirdTriggerSynchronizationGap()

void TriggerWaveform::setThirdTriggerSynchronizationGap ( float  syncRatio)

Definition at line 442 of file trigger_structure.cpp.

442 {
443 setTriggerSynchronizationGap4(/*gapIndex*/2, syncRatio);
444}

Referenced by initGmLS24_3deg(), initGmLS24_5deg(), initialize60_2_2_Renault_F(), initializeMazdaSkyactivCam(), initializeRoverK(), initializeTriggerWaveform(), setMercedesTwoSegment(), and setVwConfiguration().

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

◆ setTriggerSynchronizationGap()

void TriggerWaveform::setTriggerSynchronizationGap ( float  syncRatio)

◆ setTriggerSynchronizationGap2()

void TriggerWaveform::setTriggerSynchronizationGap2 ( float  syncRatioFrom,
float  syncRatioTo 
)

◆ setTriggerSynchronizationGap3()

void TriggerWaveform::setTriggerSynchronizationGap3 ( int  index,
float  syncRatioFrom,
float  syncRatioTo 
)

note that index is in reverse order comparing with chronological order on the documentation images https://wiki.rusefi.com/All-Supported-Triggers

Definition at line 371 of file trigger_structure.cpp.

371 {
373 criticalAssertVoid(gapIndex >= 0 && gapIndex < GAP_TRACKING_LENGTH, "gapIndex out of range");
374 synchronizationRatioFrom[gapIndex] = syncRatioFrom;
375 synchronizationRatioTo[gapIndex] = syncRatioTo;
376 if (gapIndex == 0) {
377 // we have a special case here - only sync with one gap has this feature
378 this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
379 }
380 gapTrackingLength = maxI(1 + gapIndex, gapTrackingLength);
381
382#if EFI_UNIT_TEST
383 if (printTriggerDebug) {
384 printf("setTriggerSynchronizationGap3 %d %.2f %.2f\r\n", gapIndex, syncRatioFrom, syncRatioTo);
385 }
386#endif /* EFI_UNIT_TEST */
387
388}
float synchronizationRatioFrom[GAP_TRACKING_LENGTH]
float synchronizationRatioTo[GAP_TRACKING_LENGTH]
float efiRound(float value, float precision)
Definition efilib.cpp:34

Referenced by TriggerCentral::applyTriggerGapOverride(), commonSymmetrical(), configureArcticCat(), configureBarra3plus1cam(), configureHondaJ30A2_24_1_1(), configureHondaK_4_1(), configureJeepEVD_36_2_2(), configureNeon1995TriggerWaveformOnlyCrank(), configureNeon2003TriggerWaveformCam(), initialize(), initialize36_2_2_2(), initializeJeepRenix66_2_2(), initializeMazdaLCam(), initializeMazdaMiataNb1ShapeWithOffset(), initializeNissanHRcrank(), initializeNissanHRvvtIn(), initializeNissanK11(), initializeNissanVQ35crank(), initializeSubaru7_6(), initializeSubaru7_6_camOnly(), initializeSubaruEZ30(), initializeTriggerWaveform(), initializeVvt6G72(), setSecondTriggerSynchronizationGap2(), setSkodaFavorit(), setTriggerSynchronizationGap2(), and setTriggerSynchronizationGap4().

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

◆ setTriggerSynchronizationGap4()

void TriggerWaveform::setTriggerSynchronizationGap4 ( int  index,
float  syncRatio 
)
inline

Definition at line 201 of file trigger_structure.h.

201 {
202 setTriggerSynchronizationGap3(index, syncRatio * TRIGGER_GAP_DEVIATION_LOW, syncRatio * TRIGGER_GAP_DEVIATION_HIGH);
203 }

Referenced by configureChryslerNGC_36_2_2(), configureChryslerVtt15(), initializeNissanVQ30cam(), initializeUzCam(), setSecondTriggerSynchronizationGap(), setThirdTriggerSynchronizationGap(), and setTriggerSynchronizationGap().

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

Field Documentation

◆ expectedEventCount

size_t TriggerWaveform::expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM]

This is used for signal validation

Definition at line 133 of file trigger_structure.h.

Referenced by addEvent(), calculateExpectedEventCounts(), getExpectedEventCount(), and initialize().

◆ gapTrackingLength

int TriggerWaveform::gapTrackingLength = 1

◆ isRiseEvent

bool TriggerWaveform::isRiseEvent[PWM_PHASE_MAX_COUNT]

◆ isSecondWheelCam

bool TriggerWaveform::isSecondWheelCam

trigger meta information: is second wheel mounted on crank shaft ('false') or cam shaft ('true')

Definition at line 62 of file trigger_structure.h.

Referenced by configureFordAspireTriggerWaveform(), configureGm60_2_2_2(), configureMazdaProtegeLx(), configureOnePlusOne(), initialize(), and initializeMazdaMiataNaShape().

◆ isSynchronizationNeeded

bool TriggerWaveform::isSynchronizationNeeded

◆ knownOperationMode

bool TriggerWaveform::knownOperationMode = true

◆ needSecondTriggerInput

bool TriggerWaveform::needSecondTriggerInput = false

this flag tells us if we should ignore events on second input channel that's the way to ignore noise from the disconnected wire

Definition at line 76 of file trigger_structure.h.

Referenced by addEvent(), initialize(), initializeTriggerWaveform(), and triggerInfo().

◆ operationMode

operation_mode_e TriggerWaveform::operationMode
private

this is part of performance optimization

Definition at line 256 of file trigger_structure.h.

Referenced by addEvent(), addEvent360(), addEventClamped(), getCycleDuration(), getLength(), getWheelOperationMode(), and initialize().

◆ previousAngle

angle_t TriggerWaveform::previousAngle
private

This variable is used to confirm that events are added in the right order. todo: this variable is probably not needed, could be reimplemented by accessing by index

Definition at line 252 of file trigger_structure.h.

Referenced by addEvent(), and initialize().

◆ shapeDefinitionError

bool TriggerWaveform::shapeDefinitionError = false

◆ shapeWithoutTdc

bool TriggerWaveform::shapeWithoutTdc = false

special case for triggers which do not provide exact TDC location For example pick-up in distributor with mechanical ignition firing order control.

Definition at line 71 of file trigger_structure.h.

Referenced by calculateExpectedEventCounts(), commonSymmetrical(), configureMazdaProtegeSOHC(), initialize(), initialize2jzGE3_34_simulation_shape(), initializeSkippedToothTrigger(), and initializeVvtN63TU().

◆ syncEdge

SyncEdge TriggerWaveform::syncEdge

Definition at line 121 of file trigger_structure.h.

Referenced by initialize(), and shouldConsiderEdge().

◆ synchronizationRatioFrom

float TriggerWaveform::synchronizationRatioFrom[GAP_TRACKING_LENGTH]

Depending on trigger shape, we use between one and three previous gap ranges to detect synchronization.

Usually second or third gap is not needed, but some crazy triggers like 36-2-2-2 require two consecutive gaps ratios to sync

Definition at line 94 of file trigger_structure.h.

Referenced by TriggerCentral::applyCamGapOverride(), TriggerCentral::applyTriggerGapOverride(), TriggerDecoderBase::decodeTriggerEvent(), TriggerDecoderBase::isSyncPoint(), TriggerDecoderBase::printGaps(), and setTriggerSynchronizationGap3().

◆ synchronizationRatioTo

float TriggerWaveform::synchronizationRatioTo[GAP_TRACKING_LENGTH]

◆ syncRatioAvg

int TriggerWaveform::syncRatioAvg

used by NoiselessTriggerDecoder (See TriggerCentral::handleShaftSignal())

Definition at line 101 of file trigger_structure.h.

Referenced by setTriggerSynchronizationGap3().

◆ tdcPosition

angle_t TriggerWaveform::tdcPosition

◆ triggerShapeSynchPointIndex

int TriggerWaveform::triggerShapeSynchPointIndex

index of synchronization event within TriggerWaveform See findTriggerZeroEventIndex()

Definition at line 231 of file trigger_structure.h.

Referenced by getTriggerWaveformSynchPointIndex(), initialize(), initializeSyncPoint(), and TriggerFormDetails::prepareEventAngles().

◆ triggerSignalIndeces

TriggerWheel TriggerWaveform::triggerSignalIndeces[PWM_PHASE_MAX_COUNT]

These signals are used for trigger export only

Definition at line 139 of file trigger_structure.h.

Referenced by addEvent(), getWheel(), and initialize().

◆ triggerSignalStates

TriggerValue TriggerWaveform::triggerSignalStates[PWM_PHASE_MAX_COUNT]

Definition at line 140 of file trigger_structure.h.

Referenced by addEvent(), and initialize().

◆ useOnlyPrimaryForSync

bool TriggerWaveform::useOnlyPrimaryForSync

◆ useOnlyRisingEdges

bool TriggerWaveform::useOnlyRisingEdges

◆ version

int TriggerWaveform::version = 0

this variable is incremented after each trigger shape redefinition

Definition at line 85 of file trigger_structure.h.

Referenced by initializeTriggerWaveform(), and updateTriggerWaveformIfNeeded().

◆ wave

MultiChannelStateSequenceWithData<PWM_PHASE_MAX_COUNT> TriggerWaveform::wave

wave.phaseCount is total count of shaft events per CAM or CRANK shaft revolution. TODO this should be migrated to CRANKshaft revolution, this would go together this variable is public for performance reasons (I want to avoid costs of method if it's not inlined) but name is supposed to hint at the fact that decoders should not be assigning to it Please use "getSize()" function to read this value

Definition at line 153 of file trigger_structure.h.

Referenced by addEvent(), TriggerStimulatorHelper::feedSimulatedEvent(), getAngle(), getSimulatedEventTime(), getSize(), getSwitchAngle(), initialize(), initialize60_2_2_Renault_F(), initializeTriggerWaveform(), and startSimulatedTriggerSignal().


The documentation for this class was generated from the following files: