inline & location
This commit is contained in:
parent
b82fbb9dbb
commit
16914e3b5d
|
@ -113,18 +113,6 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F
|
||||||
PRINT_INC_INDEX; \
|
PRINT_INC_INDEX; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define nextRevolution() { \
|
|
||||||
if (triggerCycleCallback != NULL) { \
|
|
||||||
triggerCycleCallback(this); \
|
|
||||||
} \
|
|
||||||
startOfCycleNt = nowNt; \
|
|
||||||
resetCurrentCycleState(); \
|
|
||||||
incrementTotalEventCounter(); \
|
|
||||||
runningRevolutionCounter++; \
|
|
||||||
totalEventCountBase += TRIGGER_SHAPE(size); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
|
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
|
||||||
|
|
||||||
#define needToSkipFall(type) ((!TRIGGER_SHAPE(gapBothDirections)) && (( TRIGGER_SHAPE(useRiseEdge)) && (type != TV_RISE)))
|
#define needToSkipFall(type) ((!TRIGGER_SHAPE(gapBothDirections)) && (( TRIGGER_SHAPE(useRiseEdge)) && (type != TV_RISE)))
|
||||||
|
@ -132,7 +120,37 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F
|
||||||
|
|
||||||
#define isLessImportant(type) (needToSkipFall(type) || needToSkipRise(type) || (!considerEventForGap()) )
|
#define isLessImportant(type) (needToSkipFall(type) || needToSkipRise(type) || (!considerEventForGap()) )
|
||||||
|
|
||||||
|
TriggerState::TriggerState() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerState::reset() {
|
||||||
|
triggerCycleCallback = NULL;
|
||||||
|
shaft_is_synchronized = false;
|
||||||
|
toothed_previous_time = 0;
|
||||||
|
toothed_previous_duration = 0;
|
||||||
|
durationBeforePrevious = 0;
|
||||||
|
thirdPreviousDuration = 0;
|
||||||
|
|
||||||
|
totalRevolutionCounter = 0;
|
||||||
|
totalTriggerErrorCounter = 0;
|
||||||
|
orderingErrorCounter = 0;
|
||||||
|
currentDuration = 0;
|
||||||
|
curSignal = SHAFT_PRIMARY_FALLING;
|
||||||
|
prevSignal = SHAFT_PRIMARY_FALLING;
|
||||||
|
startOfCycleNt = 0;
|
||||||
|
|
||||||
|
resetRunningCounters();
|
||||||
|
resetCurrentCycleState();
|
||||||
|
memset(expectedTotalTime, 0, sizeof(expectedTotalTime));
|
||||||
|
|
||||||
|
totalEventCountBase = 0;
|
||||||
|
isFirstEvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TriggerState::getCurrentIndex() {
|
||||||
|
return currentCycle.current_index;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Trigger decoding happens here
|
* @brief Trigger decoding happens here
|
||||||
* This method is invoked every time we have a fall or rise on one of the trigger sensors.
|
* This method is invoked every time we have a fall or rise on one of the trigger sensors.
|
||||||
|
@ -354,7 +372,16 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
nextTriggerEvent()
|
nextTriggerEvent()
|
||||||
;
|
;
|
||||||
|
|
||||||
nextRevolution();
|
|
||||||
|
if (triggerCycleCallback != NULL) {
|
||||||
|
triggerCycleCallback(this);
|
||||||
|
}
|
||||||
|
startOfCycleNt = nowNt;
|
||||||
|
resetCurrentCycleState();
|
||||||
|
incrementTotalEventCounter();
|
||||||
|
runningRevolutionCounter++;
|
||||||
|
totalEventCountBase += TRIGGER_SHAPE(size);
|
||||||
|
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
|
|
|
@ -166,38 +166,6 @@ void multi_wave_s::setSwitchTime(int index, float value) {
|
||||||
switchTimes[index] = value;
|
switchTimes[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerState::TriggerState() {
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TriggerState::reset() {
|
|
||||||
triggerCycleCallback = NULL;
|
|
||||||
shaft_is_synchronized = false;
|
|
||||||
toothed_previous_time = 0;
|
|
||||||
toothed_previous_duration = 0;
|
|
||||||
durationBeforePrevious = 0;
|
|
||||||
thirdPreviousDuration = 0;
|
|
||||||
|
|
||||||
totalRevolutionCounter = 0;
|
|
||||||
totalTriggerErrorCounter = 0;
|
|
||||||
orderingErrorCounter = 0;
|
|
||||||
currentDuration = 0;
|
|
||||||
curSignal = SHAFT_PRIMARY_FALLING;
|
|
||||||
prevSignal = SHAFT_PRIMARY_FALLING;
|
|
||||||
startOfCycleNt = 0;
|
|
||||||
|
|
||||||
resetRunningCounters();
|
|
||||||
resetCurrentCycleState();
|
|
||||||
memset(expectedTotalTime, 0, sizeof(expectedTotalTime));
|
|
||||||
|
|
||||||
totalEventCountBase = 0;
|
|
||||||
isFirstEvent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TriggerState::getCurrentIndex() {
|
|
||||||
return currentCycle.current_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
efitime_t TriggerState::getStartOfRevolutionIndex() {
|
efitime_t TriggerState::getStartOfRevolutionIndex() {
|
||||||
return totalEventCountBase;
|
return totalEventCountBase;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue