parent
8d3d716d7f
commit
8fee275f53
|
@ -87,8 +87,8 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri
|
|||
memset(expectedEventCount, 0, sizeof(expectedEventCount));
|
||||
wave.reset();
|
||||
previousAngle = 0;
|
||||
memset(frontOnlyIndexes, 0, sizeof(frontOnlyIndexes));
|
||||
memset(isFrontEvent, 0, sizeof(isFrontEvent));
|
||||
memset(riseOnlyIndexes, 0, sizeof(riseOnlyIndexes));
|
||||
memset(isRiseEvent, 0, sizeof(isRiseEvent));
|
||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
memset(&triggerSignals, 0, sizeof(triggerSignals));
|
||||
#endif
|
||||
|
@ -227,7 +227,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
|||
wave->setState(/* switchIndex */ 0, /* value */ initialState[i]);
|
||||
}
|
||||
|
||||
isFrontEvent[0] = TV_RISE == stateParam;
|
||||
isRiseEvent[0] = TV_RISE == stateParam;
|
||||
wave.setSwitchTime(0, angle);
|
||||
wave.channels[channelIndex].setState(/* channelIndex */ 0, /* value */ state);
|
||||
return;
|
||||
|
@ -255,7 +255,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
|||
wave.setSwitchTime(i + 1, wave.getSwitchTime(i));
|
||||
}
|
||||
*/
|
||||
isFrontEvent[index] = TV_RISE == stateParam;
|
||||
isRiseEvent[index] = TV_RISE == stateParam;
|
||||
|
||||
if (index != privateTriggerDefinitionSize) {
|
||||
firmwareError(ERROR_TRIGGER_DRAMA, "are we ever here?");
|
||||
|
|
|
@ -188,12 +188,12 @@ public:
|
|||
// todo: maybe even automate this flag calculation?
|
||||
pin_state_t initialState[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
int8_t isFrontEvent[PWM_PHASE_MAX_COUNT];
|
||||
bool isRiseEvent[PWM_PHASE_MAX_COUNT];
|
||||
/**
|
||||
* this table translates trigger definition index into 'front-only' index. This translation is not so trivial
|
||||
* in case of a multi-channel signal with overlapping waves, for example Ford Aspire/Mitsubishi
|
||||
*/
|
||||
int frontOnlyIndexes[PWM_PHASE_MAX_COUNT];
|
||||
int riseOnlyIndexes[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
/**
|
||||
* This is a pretty questionable option which is considered by 'addEvent' method
|
||||
|
|
|
@ -125,7 +125,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
|
|||
float firstAngle = shape->getAngle(shape->triggerShapeSynchPointIndex);
|
||||
assertAngleRange(shape->triggerShapeSynchPointIndex, "firstAngle", CUSTOM_ERR_6551);
|
||||
|
||||
int frontOnlyIndex = 0;
|
||||
int riseOnlyIndex = 0;
|
||||
|
||||
for (int eventIndex = 0; eventIndex < length; eventIndex++) {
|
||||
if (eventIndex == 0) {
|
||||
|
@ -133,7 +133,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
|
|||
shape->eventAngles[0] = 0;
|
||||
// this value would be used in case of front-only
|
||||
shape->eventAngles[1] = 0;
|
||||
shape->frontOnlyIndexes[0] = 0;
|
||||
shape->riseOnlyIndexes[0] = 0;
|
||||
} else {
|
||||
assertAngleRange(shape->triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex", CUSTOM_ERR_6552);
|
||||
int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
|
||||
|
@ -143,16 +143,16 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
|
|||
efiAssertVoid(CUSTOM_ERR_6596, !cisnan(angle), "trgSyncNaN");
|
||||
fixAngle(angle, "trgSync", CUSTOM_ERR_6559);
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
if (shape->isFrontEvent[triggerDefinitionIndex]) {
|
||||
frontOnlyIndex += 2;
|
||||
shape->eventAngles[frontOnlyIndex] = angle;
|
||||
shape->eventAngles[frontOnlyIndex + 1] = angle;
|
||||
if (shape->isRiseEvent[triggerDefinitionIndex]) {
|
||||
riseOnlyIndex += 2;
|
||||
shape->eventAngles[riseOnlyIndex] = angle;
|
||||
shape->eventAngles[riseOnlyIndex + 1] = angle;
|
||||
}
|
||||
} else {
|
||||
shape->eventAngles[eventIndex] = angle;
|
||||
}
|
||||
|
||||
shape->frontOnlyIndexes[eventIndex] = frontOnlyIndex;
|
||||
shape->riseOnlyIndexes[eventIndex] = riseOnlyIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue