rusEFI
The most advanced open source ECU
|
This file is about producing real electrical signals which emulate trigger signal based on a known TriggerWaveform.
Historically this implementation was implemented based on PwmConfig which is maybe not the best way to implement it. (todo: why is not the best way?)
A newer implementation of pretty much the same thing is TriggerStimulatorHelper todo: one emulator should be enough! another one should be eliminated
Definition in file trigger_emulator_algo.cpp.
Functions | |
int | getPreviousIndex (const int currentIndex, const int size) |
bool | needEvent (const int currentIndex, const MultiChannelStateSequence &mcss, int channelIndex) |
fail ("EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS") TriggerEmulatorHelper | |
static float | getRpmMultiplier (operation_mode_e mode) |
void | setTriggerEmulatorRPM (int rpm) |
static void | updateTriggerWaveformIfNeeded (PwmConfig *state) |
static void | emulatorApplyPinState (int stateIndex, PwmConfig *state) |
static void | startSimulatedTriggerSignal () |
void | enableTriggerStimulator (bool incGlobalConfiguration) |
void | enableExternalTriggerStimulator () |
void | disableTriggerStimulator () |
void | onConfigurationChangeRpmEmulatorCallback (engine_configuration_s *previousConfiguration) |
void | initTriggerEmulator () |
void | startTriggerEmulatorPins () |
void | stopTriggerEmulatorPins () |
Variables | |
static OutputPin | emulatorOutputs [NUM_EMULATOR_CHANNELS][PWM_PHASE_MAX_WAVE_PER_PWM] |
PwmConfig | triggerEmulatorSignals [NUM_EMULATOR_CHANNELS] |
TriggerWaveform * | triggerEmulatorWaveforms [NUM_EMULATOR_CHANNELS] |
static int | atTriggerVersions [NUM_EMULATOR_CHANNELS] = { 0 } |
static TriggerEmulatorHelper | helper |
static bool | hasStimPins = false |
static bool | hasInitTriggerEmulator = false |
void disableTriggerStimulator | ( | ) |
Definition at line 211 of file trigger_emulator_algo.cpp.
Referenced by configureRusefiLuaHooks(), enableOrDisable(), and handleCommandX14().
|
static |
this callback would invoke the input signal handlers directly
Definition at line 143 of file trigger_emulator_algo.cpp.
Referenced by startSimulatedTriggerSignal().
void enableExternalTriggerStimulator | ( | ) |
Definition at line 205 of file trigger_emulator_algo.cpp.
Referenced by enableOrDisable(), and handleCommandX14().
void enableTriggerStimulator | ( | bool | incGlobalConfiguration | ) |
Definition at line 194 of file trigger_emulator_algo.cpp.
Referenced by configureRusefiLuaHooks(), enableOrDisable(), and handleCommandX14().
fail | ( | "EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS" | ) |
this instance does not have a real physical pin - it's only used for engine sniffer
todo: we can kind of add real physical pin just for a very narrow case of troubleshooting but only if we ever need it :)
Engine idles around 20Hz and revs up to 140Hz, at 60/2 and 8 cylinders we have about 20Khz events If we can read buffer at 50Hz we want buffer to be about 400 elements.
Definition at line 34 of file trigger_emulator_algo.cpp.
int getPreviousIndex | ( | const int | currentIndex, |
const int | size | ||
) |
Definition at line 19 of file trigger_emulator_algo.cpp.
Referenced by TriggerStimulatorHelper::feedSimulatedEvent(), and needEvent().
|
static |
todo: why is this method NOT reciprocal to getCrankDivider?! todo: oh this method has only one usage? there must me another very similar method!
Definition at line 78 of file trigger_emulator_algo.cpp.
Referenced by setTriggerEmulatorRPM().
void initTriggerEmulator | ( | ) |
Definition at line 228 of file trigger_emulator_algo.cpp.
Referenced by initEngineEmulator().
bool needEvent | ( | const int | currentIndex, |
const MultiChannelStateSequence & | mcss, | ||
int | channelIndex | ||
) |
Definition at line 23 of file trigger_emulator_algo.cpp.
Referenced by TriggerStimulatorHelper::feedSimulatedEvent(), and TriggerEmulatorHelper::handleEmulatorCallback().
void onConfigurationChangeRpmEmulatorCallback | ( | engine_configuration_s * | previousConfiguration | ) |
Definition at line 220 of file trigger_emulator_algo.cpp.
Referenced by incrementGlobalConfigurationVersion().
void setTriggerEmulatorRPM | ( | int | rpm | ) |
All we need to do here is to change the periodMs togglePwmState() would see that the periodMs has changed and act accordingly
Definition at line 97 of file trigger_emulator_algo.cpp.
Referenced by configureRusefiLuaHooks(), initTriggerEmulator(), onConfigurationChangeRpmEmulatorCallback(), setValue(), and startSimulatedTriggerSignal().
|
static |
Definition at line 166 of file trigger_emulator_algo.cpp.
Referenced by enableExternalTriggerStimulator(), and enableTriggerStimulator().
void startTriggerEmulatorPins | ( | ) |
Definition at line 238 of file trigger_emulator_algo.cpp.
Referenced by applyNewHardwareSettings(), and initTriggerEmulator().
void stopTriggerEmulatorPins | ( | ) |
Definition at line 273 of file trigger_emulator_algo.cpp.
Referenced by stopHardware().
|
static |
Definition at line 120 of file trigger_emulator_algo.cpp.
Referenced by startSimulatedTriggerSignal().
|
static |
Definition at line 72 of file trigger_emulator_algo.cpp.
Referenced by updateTriggerWaveformIfNeeded().
|
static |
Definition at line 44 of file trigger_emulator_algo.cpp.
Referenced by startTriggerEmulatorPins(), and stopTriggerEmulatorPins().
|
static |
Definition at line 139 of file trigger_emulator_algo.cpp.
Referenced by disableTriggerStimulator(), and startSimulatedTriggerSignal().
|
static |
Definition at line 137 of file trigger_emulator_algo.cpp.
Referenced by emulatorApplyPinState(), and startTriggerEmulatorPins().
|
static |
Definition at line 136 of file trigger_emulator_algo.cpp.
Referenced by emulatorApplyPinState().
PwmConfig triggerEmulatorSignals[NUM_EMULATOR_CHANNELS] |
Definition at line 69 of file trigger_emulator_algo.cpp.
Referenced by disableTriggerStimulator(), emulatorApplyPinState(), setTriggerEmulatorRPM(), startSimulatedTriggerSignal(), startTriggerEmulatorPins(), stopTriggerEmulatorPins(), triggerInfo(), and updateTriggerWaveformIfNeeded().
TriggerWaveform* triggerEmulatorWaveforms[NUM_EMULATOR_CHANNELS] |
Definition at line 70 of file trigger_emulator_algo.cpp.
Referenced by startSimulatedTriggerSignal(), and updateTriggerWaveformIfNeeded().