trigger emulator refactoring

only:mre_f4
This commit is contained in:
Andrey 2023-03-02 23:54:42 -05:00
parent 7007d7c32a
commit 5949d92483
2 changed files with 6 additions and 7 deletions

View File

@ -57,6 +57,7 @@ void TriggerEmulatorHelper::handleEmulatorCallback(const MultiChannelStateSequen
#endif // EFI_SHAFT_POSITION_INPUT
}
// same is used for either self or external trigger simulation
PwmConfig triggerEmulatorSignal;
static int atTriggerVersion = 0;
@ -154,6 +155,8 @@ static void startSimulatedTriggerSignal() {
hasInitTriggerEmulator = true;
}
// self-stimulation
// see below for trigger output generator
void enableTriggerStimulator() {
startSimulatedTriggerSignal();
engine->triggerCentral.directSelfStimulation = true;
@ -161,6 +164,8 @@ void enableTriggerStimulator() {
incrementGlobalConfigurationVersion();
}
// start generating trigger signal on physical outputs
// similar but different from self-stimulation
void enableExternalTriggerStimulator() {
startSimulatedTriggerSignal();
engine->triggerCentral.directSelfStimulation = false;
@ -174,10 +179,6 @@ void disableTriggerStimulator() {
incrementGlobalConfigurationVersion();
}
void initTriggerEmulatorLogic() {
addConsoleActionI(CMD_RPM, setTriggerEmulatorRPM);
}
void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousConfiguration) {
if (engineConfiguration->triggerSimulatorFrequency ==
previousConfiguration->triggerSimulatorFrequency) {
@ -191,7 +192,7 @@ void initTriggerEmulator() {
startTriggerEmulatorPins();
initTriggerEmulatorLogic();
addConsoleActionI(CMD_RPM, setTriggerEmulatorRPM);
}
#endif /* EFI_UNIT_TEST */

View File

@ -27,8 +27,6 @@ public:
void handleEmulatorCallback(const MultiChannelStateSequence& mcss, int stateIndex);
};
void initTriggerEmulatorLogic();
int getPreviousIndex(const int currentIndex, const int size);
bool needEvent(const int currentIndex, const MultiChannelStateSequence& mcss, int channelIndex);