trigger refactoring
This commit is contained in:
parent
c018e0bc0a
commit
4f5aeea301
|
@ -252,6 +252,9 @@ void Engine::OnTriggerStateDecodingError() {
|
||||||
void Engine::OnTriggerStateProperState(efitick_t nowNt) {
|
void Engine::OnTriggerStateProperState(efitick_t nowNt) {
|
||||||
Engine *engine = this;
|
Engine *engine = this;
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
|
|
||||||
|
triggerCentral.triggerState.runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
|
||||||
// for effective noise filtering, we need both signal edges,
|
// for effective noise filtering, we need both signal edges,
|
||||||
// so we pass them to handleShaftSignal() and defer this test
|
// so we pass them to handleShaftSignal() and defer this test
|
||||||
if (!CONFIG(useNoiselessTriggerDecoder)) {
|
if (!CONFIG(useNoiselessTriggerDecoder)) {
|
||||||
if (!isUsefulSignal(signal PASS_ENGINE_PARAMETER_SUFFIX)) {
|
if (!isUsefulSignal(signal PASS_CONFIG_PARAMETER_SUFFIX)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// moved here from hwHandleShaftSignal()
|
// moved here from hwHandleShaftSignal()
|
||||||
if (!isUsefulSignal(signal PASS_ENGINE_PARAMETER_SUFFIX)) {
|
if (!isUsefulSignal(signal PASS_CONFIG_PARAMETER_SUFFIX)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,7 +670,6 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
|
|
||||||
// Needed for early instant-RPM detection
|
// Needed for early instant-RPM detection
|
||||||
if (triggerStateListener) {
|
if (triggerStateListener) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ EXTERN_ENGINE;
|
||||||
static const bool isRisingEdge[6] = { false, true, false, true, false, true };
|
static const bool isRisingEdge[6] = { false, true, false, true, false, true };
|
||||||
|
|
||||||
// todo: should this method be invoked somewhere deeper? at the moment we have too many usages too high
|
// todo: should this method be invoked somewhere deeper? at the moment we have too many usages too high
|
||||||
bool isUsefulSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
bool isUsefulSignal(trigger_event_e signal DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||||
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
|
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(const TriggerStateCallback trig
|
||||||
if (needEvent(stateIndex, size, multiChannelStateSequence, 0)) {
|
if (needEvent(stateIndex, size, multiChannelStateSequence, 0)) {
|
||||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/0, stateIndex);
|
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/0, stateIndex);
|
||||||
trigger_event_e s = currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
|
trigger_event_e s = currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
|
||||||
if (isUsefulSignal(s PASS_ENGINE_PARAMETER_SUFFIX)) {
|
if (isUsefulSignal(s PASS_CONFIG_PARAMETER_SUFFIX)) {
|
||||||
state->decodeTriggerEvent(triggerCycleCallback,
|
state->decodeTriggerEvent(triggerCycleCallback,
|
||||||
/* override */ nullptr,
|
/* override */ nullptr,
|
||||||
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
@ -73,7 +73,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(const TriggerStateCallback trig
|
||||||
if (needEvent(stateIndex, size, multiChannelStateSequence, 1)) {
|
if (needEvent(stateIndex, size, multiChannelStateSequence, 1)) {
|
||||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/1, stateIndex);
|
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/1, stateIndex);
|
||||||
trigger_event_e s = currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
|
trigger_event_e s = currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
|
||||||
if (isUsefulSignal(s PASS_ENGINE_PARAMETER_SUFFIX)) {
|
if (isUsefulSignal(s PASS_CONFIG_PARAMETER_SUFFIX)) {
|
||||||
state->decodeTriggerEvent(triggerCycleCallback,
|
state->decodeTriggerEvent(triggerCycleCallback,
|
||||||
/* override */ nullptr,
|
/* override */ nullptr,
|
||||||
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
@ -83,7 +83,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(const TriggerStateCallback trig
|
||||||
if (needEvent(stateIndex, size, multiChannelStateSequence, 2)) {
|
if (needEvent(stateIndex, size, multiChannelStateSequence, 2)) {
|
||||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/2, stateIndex);
|
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/2, stateIndex);
|
||||||
trigger_event_e s = currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
|
trigger_event_e s = currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
|
||||||
if (isUsefulSignal(s PASS_ENGINE_PARAMETER_SUFFIX)) {
|
if (isUsefulSignal(s PASS_CONFIG_PARAMETER_SUFFIX)) {
|
||||||
state->decodeTriggerEvent(triggerCycleCallback,
|
state->decodeTriggerEvent(triggerCycleCallback,
|
||||||
/* override */ nullptr,
|
/* override */ nullptr,
|
||||||
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
s, time PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
|
@ -25,4 +25,4 @@ private:
|
||||||
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback, TriggerState *state, TriggerWaveform * shape, int i DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback, TriggerState *state, TriggerWaveform * shape, int i DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isUsefulSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX);
|
bool isUsefulSignal(trigger_event_e signal DECLARE_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
Loading…
Reference in New Issue