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;
}
void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycleCallback,
efitick_t nowNt, TriggerWaveform *triggerShape) {
void TriggerState::onShaftSynchronization(
const TriggerStateCallback triggerCycleCallback,
const efitick_t nowNt,
const TriggerWaveform *triggerShape) {
if (triggerCycleCallback) {
@ -383,7 +385,8 @@ void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycl
* @param signal type of event which just happened
* @param nowNt current time
*/
void TriggerState::decodeTriggerEvent(TriggerWaveform *triggerShape,
void TriggerState::decodeTriggerEvent(
const TriggerWaveform *triggerShape,
const TriggerStateCallback triggerCycleCallback,
TriggerStateListener * triggerStateListener,
const TriggerConfiguration * triggerConfiguration,

View File

@ -77,7 +77,8 @@ public:
void incrementTotalEventCounter();
efitime_t getTotalEventCounter() const;
void decodeTriggerEvent(TriggerWaveform *triggerShape,
void decodeTriggerEvent(
const TriggerWaveform *triggerShape,
const TriggerStateCallback triggerCycleCallback,
TriggerStateListener * triggerStateListener,
const TriggerConfiguration * triggerConfiguration,
@ -85,11 +86,12 @@ public:
const efitime_t nowUs);
bool validateEventCounters(TriggerWaveform *triggerShape) const;
void onShaftSynchronization(const TriggerStateCallback triggerCycleCallback,
efitick_t nowNt, TriggerWaveform *triggerShape);
void onShaftSynchronization(
const TriggerStateCallback triggerCycleCallback,
const efitick_t nowNt,
const TriggerWaveform *triggerShape);
bool isValidIndex(TriggerWaveform *triggerShape) const;
float getTriggerDutyCycle(int index);
/**
* 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)) {
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/0, stateIndex);
trigger_event_e s = currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) {
trigger_event_e event = currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape,
triggerCycleCallback,
/* override */ nullptr,
triggerConfiguration,
s, time);
event, time);
}
}
if (needEvent(stateIndex, size, multiChannelStateSequence, 1)) {
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/1, stateIndex);
trigger_event_e s = currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) {
trigger_event_e event = currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape,
triggerCycleCallback,
/* override */ nullptr,
triggerConfiguration,
s, time);
event, time);
}
}
if (needEvent(stateIndex, size, multiChannelStateSequence, 2)) {
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/2, stateIndex);
trigger_event_e s = currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
if (isUsefulSignal(s, triggerConfiguration)) {
trigger_event_e event = currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
if (isUsefulSignal(event, triggerConfiguration)) {
state->decodeTriggerEvent(shape,
triggerCycleCallback,
/* override */ nullptr,
triggerConfiguration,
s, time);
event, time);
}
}
}