This commit is contained in:
rusefi 2020-08-26 17:30:13 -04:00
parent 70cdbc51b7
commit 0c5db46438
3 changed files with 21 additions and 16 deletions

View File

@ -353,8 +353,10 @@ bool TriggerState::validateEventCounters(TriggerWaveform *triggerShape) const {
return isDecodingError; return isDecodingError;
} }
void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycleCallback, void TriggerState::onShaftSynchronization(
efitick_t nowNt, TriggerWaveform *triggerShape) { const TriggerStateCallback triggerCycleCallback,
const efitick_t nowNt,
const TriggerWaveform *triggerShape) {
if (triggerCycleCallback) { if (triggerCycleCallback) {
@ -383,7 +385,8 @@ void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycl
* @param signal type of event which just happened * @param signal type of event which just happened
* @param nowNt current time * @param nowNt current time
*/ */
void TriggerState::decodeTriggerEvent(TriggerWaveform *triggerShape, void TriggerState::decodeTriggerEvent(
const TriggerWaveform *triggerShape,
const TriggerStateCallback triggerCycleCallback, const TriggerStateCallback triggerCycleCallback,
TriggerStateListener * triggerStateListener, TriggerStateListener * triggerStateListener,
const TriggerConfiguration * triggerConfiguration, const TriggerConfiguration * triggerConfiguration,

View File

@ -77,7 +77,8 @@ public:
void incrementTotalEventCounter(); void incrementTotalEventCounter();
efitime_t getTotalEventCounter() const; efitime_t getTotalEventCounter() const;
void decodeTriggerEvent(TriggerWaveform *triggerShape, void decodeTriggerEvent(
const TriggerWaveform *triggerShape,
const TriggerStateCallback triggerCycleCallback, const TriggerStateCallback triggerCycleCallback,
TriggerStateListener * triggerStateListener, TriggerStateListener * triggerStateListener,
const TriggerConfiguration * triggerConfiguration, const TriggerConfiguration * triggerConfiguration,
@ -85,11 +86,12 @@ public:
const efitime_t nowUs); const efitime_t nowUs);
bool validateEventCounters(TriggerWaveform *triggerShape) const; bool validateEventCounters(TriggerWaveform *triggerShape) const;
void onShaftSynchronization(const TriggerStateCallback triggerCycleCallback, void onShaftSynchronization(
efitick_t nowNt, TriggerWaveform *triggerShape); const TriggerStateCallback triggerCycleCallback,
const efitick_t nowNt,
const TriggerWaveform *triggerShape);
bool isValidIndex(TriggerWaveform *triggerShape) const; bool isValidIndex(TriggerWaveform *triggerShape) const;
float getTriggerDutyCycle(int index);
/** /**
* TRUE if we know where we are * TRUE if we know where we are

View File

@ -66,37 +66,37 @@ 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 event = currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) { if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape, state->decodeTriggerEvent(shape,
triggerCycleCallback, triggerCycleCallback,
/* override */ nullptr, /* override */ nullptr,
triggerConfiguration, triggerConfiguration,
s, time); event, time);
} }
} }
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 event = currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) { if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape, state->decodeTriggerEvent(shape,
triggerCycleCallback, triggerCycleCallback,
/* override */ nullptr, /* override */ nullptr,
triggerConfiguration, triggerConfiguration,
s, time); event, time);
} }
} }
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 event = currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) { if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape, state->decodeTriggerEvent(shape,
triggerCycleCallback, triggerCycleCallback,
/* override */ nullptr, /* override */ nullptr,
triggerConfiguration, triggerConfiguration,
s, time); event, time);
} }
} }
} }