refactoring
This commit is contained in:
parent
266e50f4ca
commit
5e87b326f2
|
@ -47,15 +47,14 @@ EXTERN_ENGINE;
|
||||||
|
|
||||||
static OutputPin emulatorOutputs[PWM_PHASE_MAX_WAVE_PER_PWM];
|
static OutputPin emulatorOutputs[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||||
|
|
||||||
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void TriggerEmulatorHelper::handleEmulatorCallback(const int size, const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
efitick_t stamp = getTimeNowNt();
|
efitick_t stamp = getTimeNowNt();
|
||||||
|
|
||||||
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
|
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
|
||||||
MultiChannelStateSequence *multiChannelStateSequence = &state->multiChannelStateSequence;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
|
for (size_t i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
|
||||||
if (needEvent(stateIndex, state->phaseCount, state->multiChannelStateSequence, i)) {
|
if (needEvent(stateIndex, size, multiChannelStateSequence, i)) {
|
||||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/i, stateIndex);
|
pin_state_t currentValue = multiChannelStateSequence.getChannelState(/*phaseIndex*/i, stateIndex);
|
||||||
|
|
||||||
constexpr trigger_event_e riseEvents[] = { SHAFT_PRIMARY_RISING, SHAFT_SECONDARY_RISING, SHAFT_3RD_RISING };
|
constexpr trigger_event_e riseEvents[] = { SHAFT_PRIMARY_RISING, SHAFT_SECONDARY_RISING, SHAFT_3RD_RISING };
|
||||||
constexpr trigger_event_e fallEvents[] = { SHAFT_PRIMARY_FALLING, SHAFT_SECONDARY_FALLING, SHAFT_3RD_FALLING };
|
constexpr trigger_event_e fallEvents[] = { SHAFT_PRIMARY_FALLING, SHAFT_SECONDARY_FALLING, SHAFT_3RD_FALLING };
|
||||||
|
@ -136,7 +135,9 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c
|
||||||
/**
|
/**
|
||||||
* this callback would invoke the input signal handlers directly
|
* this callback would invoke the input signal handlers directly
|
||||||
*/
|
*/
|
||||||
helper.handleEmulatorCallback(state, stateIndex);
|
helper.handleEmulatorCallback(state->phaseCount,
|
||||||
|
state->multiChannelStateSequence,
|
||||||
|
stateIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
|
|
@ -26,7 +26,7 @@ void disableTriggerStimulator();
|
||||||
class TriggerEmulatorHelper {
|
class TriggerEmulatorHelper {
|
||||||
public:
|
public:
|
||||||
TriggerEmulatorHelper();
|
TriggerEmulatorHelper();
|
||||||
void handleEmulatorCallback(PwmConfig *state, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void handleEmulatorCallback(const int size, const MultiChannelStateSequence& mcss, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
};
|
};
|
||||||
|
|
||||||
void initTriggerEmulatorLogic(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void initTriggerEmulatorLogic(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
Loading…
Reference in New Issue