rusEFI
The most advanced open source ECU
|
#include <trigger_central.h>
Public Member Functions | |
TriggerCentral () | |
angle_t | syncEnginePhaseAndReport (int divider, int remainder) |
void | handleShaftSignal (trigger_event_e signal, efitick_t timestamp) |
int | getHwEventCounter (int index) const |
void | resetCounters () |
void | validateCamVvtCounters () |
void | applyShapesConfiguration () |
angle_t | findNextTriggerToothAngle (int nextToothIndex) |
void | prepareTriggerShape () |
bool | checkIfTriggerConfigChanged () |
bool | isTriggerConfigChanged () |
bool | isTriggerDecoderError () |
expected< float > | getCurrentEnginePhase (efitick_t nowNt) const |
float | getSecondsSinceTriggerEvent (efitick_t nowNt) const |
bool | engineMovedRecently (efitick_t nowNt) const |
bool | engineMovedRecently () const |
angle_t | getVVTPosition (uint8_t bankIndex, uint8_t camIndex) |
Private Member Functions | |
void | decodeMapCam (efitick_t nowNt, float currentPhase) |
bool | isToothExpectedNow (efitick_t timestamp) |
Private Attributes | |
Timer | m_lastToothTimer |
float | m_lastToothPhaseFromSyncPoint |
expected< float > | expectedNextPhase = unexpected |
Maybe merge TriggerCentral and TriggerState classes into one class? Probably not: we have an instance of TriggerState which is used for trigger initialization, also composition probably better than inheritance here
Definition at line 49 of file trigger_central.h.
TriggerCentral::TriggerCentral | ( | ) |
Definition at line 43 of file trigger_central.cpp.
void TriggerCentral::applyShapesConfiguration | ( | ) |
this is only useful while troubleshooting a new trigger shape in the field in very VERY rare circumstances
'initState' instance of TriggerDecoderBase is used only to initialize 'this' TriggerWaveform instance #192 BUG real hardware trigger events could be coming even while we are initializing trigger
Definition at line 1125 of file trigger_central.cpp.
Referenced by Engine::updateTriggerConfiguration().
bool TriggerCentral::checkIfTriggerConfigChanged | ( | ) |
Definition at line 1212 of file trigger_central.cpp.
|
private |
Definition at line 660 of file trigger_central.cpp.
Referenced by handleShaftSignal().
|
inline |
Definition at line 156 of file trigger_central.h.
Referenced by engineMovedRecently().
|
inline |
Definition at line 138 of file trigger_central.h.
Referenced by applyIACposition(), RpmCalculator::checkIfSpinning(), EtbController::checkStatus(), Engine::efiWatchdog(), getAcrState(), RpmCalculator::onSlowCallback(), and FuelPumpController::onSlowCallback().
angle_t TriggerCentral::findNextTriggerToothAngle | ( | int | nextToothIndex | ) |
Definition at line 763 of file trigger_central.cpp.
Referenced by handleShaftSignal().
expected< float > TriggerCentral::getCurrentEnginePhase | ( | efitick_t | nowNt | ) | const |
Definition at line 74 of file trigger_central.cpp.
Referenced by getAcrState(), handleVvtCamSignal(), isToothExpectedNow(), HpfpController::pinTurnOff(), and HpfpController::pinTurnOn().
int TriggerCentral::getHwEventCounter | ( | int | index | ) | const |
Definition at line 60 of file trigger_central.cpp.
Referenced by canDashboardHaltech(), sendQcBenchEventCounters(), triggerInfo(), and updateTunerStudioState().
|
inline |
Definition at line 134 of file trigger_central.h.
Referenced by engineMovedRecently().
angle_t TriggerCentral::getVVTPosition | ( | uint8_t | bankIndex, |
uint8_t | camIndex | ||
) |
Definition at line 64 of file trigger_central.cpp.
Referenced by HpfpLobe::findNextLobe(), VvtController::observePlant(), populateFrame(), readGppwmChannel(), and updateVvtSensors().
void TriggerCentral::handleShaftSignal | ( | trigger_event_e | signal, |
efitick_t | timestamp | ||
) |
This method is NOT invoked for VR falls.
If we only have a crank position sensor with four stroke, here we are extending crank revolutions with a 360 degree cycle into a four stroke, 720 degrees cycle.
Definition at line 785 of file trigger_central.cpp.
Referenced by handleShaftSignal().
|
private |
Definition at line 703 of file trigger_central.cpp.
Referenced by handleShaftSignal().
bool TriggerCentral::isTriggerConfigChanged | ( | ) |
Definition at line 1220 of file trigger_central.cpp.
bool TriggerCentral::isTriggerDecoderError | ( | ) |
Definition at line 1252 of file trigger_central.cpp.
Referenced by isTriggerErrorNow(), and triggerInfo().
|
inline |
Definition at line 68 of file trigger_central.h.
Referenced by prepareOutputSignals().
void TriggerCentral::resetCounters | ( | ) |
Definition at line 575 of file trigger_central.cpp.
Referenced by resetRunningTriggerCounters().
angle_t TriggerCentral::syncEnginePhaseAndReport | ( | int | divider, |
int | remainder | ||
) |
we have two kinds of sync: this method is about detecting of exact engine phase with 720 degree precision usually based on cam wheel decoding not to be confused with a totally different trigger wheel sync which could be either crank wheel sync or cam wheel sync
Definition at line 138 of file trigger_central.cpp.
Referenced by adjustCrankPhase().
void TriggerCentral::validateCamVvtCounters | ( | ) |
Definition at line 1087 of file trigger_central.cpp.
Referenced by rpmShaftPositionCallback().
angle_t TriggerCentral::currentVVTEventPosition[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 169 of file trigger_central.h.
Referenced by handleVvtCamSignal().
bool TriggerCentral::directSelfStimulation = false |
See also triggerSimulatorRpm
Definition at line 88 of file trigger_central.h.
Referenced by configureRusefiLuaHooks(), disableTriggerStimulator(), doPeriodicSlowCallback(), emulatorApplyPinState(), enableExternalTriggerStimulator(), enableTriggerStimulator(), engineMovedRecently(), hwHandleShaftSignal(), hwHandleVvtCamSignal(), triggerInfo(), and LimpManager::updateState().
uint32_t TriggerCentral::engineCycleEventCount = 0 |
value of 'triggerShape.getLength()' pre-calculating this value is a performance optimization
Definition at line 118 of file trigger_central.h.
Referenced by applyShapesConfiguration(), and findNextTriggerToothAngle().
|
private |
Definition at line 222 of file trigger_central.h.
Referenced by handleShaftSignal(), and isToothExpectedNow().
bool TriggerCentral::hwTriggerInputEnabled = true |
Definition at line 81 of file trigger_central.h.
Referenced by enableOrDisable(), hwHandleShaftSignal(), hwHandleVvtCamSignal(), and triggerInfo().
InstantRpmCalculator TriggerCentral::instantRpm |
Definition at line 66 of file trigger_central.h.
Referenced by getAdvanceCorrections(), IdleController::onFastCallback(), PrimaryTriggerDecoder::onTriggerError(), Engine::OnTriggerSynchronizationLost(), rpmShaftPositionCallback(), RpmCalculator::setSpinningUp(), syncEnginePhaseAndReport(), and updateTunerStudioState().
bool TriggerCentral::isEngineSnifferEnabled = false |
this is based on engineSnifferRpmThreshold settings and current RPM
Definition at line 208 of file trigger_central.h.
Referenced by TriggerDecoderBase::decodeTriggerEvent(), and Engine::updateSlowSensors().
bool TriggerCentral::isSpinningJustForWatchdog = false |
By the way: 'cranking' means engine is not stopped and the rpm are below crankingRpm 'running' means RPM are above crankingRpm 'spinning' means the engine is not stopped this is set to true each time we register a trigger tooth signal
Definition at line 109 of file trigger_central.h.
Referenced by Engine::efiWatchdog(), and handleShaftSignal().
Timer TriggerCentral::m_lastEventTimer |
Definition at line 203 of file trigger_central.h.
Referenced by configureRusefiLuaHooks(), engineMovedRecently(), getSecondsSinceTriggerEvent(), and handleShaftSignal().
|
private |
Definition at line 218 of file trigger_central.h.
Referenced by getCurrentEnginePhase(), handleShaftSignal(), and isToothExpectedNow().
|
private |
Definition at line 216 of file trigger_central.h.
Referenced by getCurrentEnginePhase(), and handleShaftSignal().
float TriggerCentral::mapCamPrevCycleValue = 0 |
Definition at line 111 of file trigger_central.h.
Referenced by decodeMapCam().
TriggerNoiseFilter TriggerCentral::noiseFilter |
Definition at line 160 of file trigger_central.h.
Referenced by handleShaftSignal(), onConfigurationChangeTriggerCallback(), RpmCalculator::setStopped(), and TriggerCentral().
int TriggerCentral::prevChangeAtCycle = 0 |
Definition at line 112 of file trigger_central.h.
Referenced by decodeMapCam().
PrimaryTriggerConfiguration TriggerCentral::primaryTriggerConfiguration |
Definition at line 90 of file trigger_central.h.
Referenced by applyShapesConfiguration(), handleShaftSignal(), Engine::injectEngineReferences(), and Engine::periodicSlowCallback().
bool TriggerCentral::triggerConfigChangedOnLastConfigurationChange = false |
true if a recent configuration change has changed any of the trigger settings which we have not adjusted for yet
Definition at line 123 of file trigger_central.h.
Referenced by checkIfTriggerConfigChanged(), isTriggerConfigChanged(), and onConfigurationChangeTriggerCallback().
cyclic_buffer<int> TriggerCentral::triggerErrorDetection |
Definition at line 83 of file trigger_central.h.
Referenced by applyShapesConfiguration(), isTriggerDecoderError(), and Engine::OnTriggerSynchronization().
TriggerFormDetails TriggerCentral::triggerFormDetails |
Definition at line 200 of file trigger_central.h.
Referenced by findNextTriggerToothAngle(), handleShaftSignal(), MapAveragingModule::onFastCallback(), prepareTriggerShape(), rpmShaftPositionCallback(), and triggerShapeInfo().
TriggerWaveform TriggerCentral::triggerShape |
Definition at line 179 of file trigger_central.h.
Referenced by applyShapesConfiguration(), engineMovedRecently(), RpmCalculator::getOperationMode(), handleShaftSignal(), handleShaftSignal(), InstantRpmCalculator::movePreSynchTimestamps(), HpfpController::onFastCallback(), Engine::OnTriggerSynchronization(), prepareTriggerShape(), rpmShaftPositionCallback(), InstantRpmCalculator::setLastEventTimeForInstantRpm(), startSimulatedTriggerSignal(), startTriggerInputPins(), triggerInfo(), triggerShapeInfo(), and Engine::updateTriggerConfiguration().
PrimaryTriggerDecoder TriggerCentral::triggerState |
Definition at line 176 of file trigger_central.h.
Referenced by applyShapesConfiguration(), canDashboardHaltech(), decodeMapCam(), extIonCallback(), getAcrState(), getCurrentIgnitionMode(), getLiveData(), getLiveData(), getOutputValueByName(), handleShaftSignal(), handleVvtCamSignal(), isToothExpectedNow(), isTriggerErrorNow(), Engine::OnTriggerSynchronization(), Engine::OnTriggerSynchronizationLost(), rpmShaftPositionCallback(), SetNextCompositeEntry(), RpmCalculator::setSpinningUp(), syncEnginePhaseAndReport(), TriggerCentral(), triggerInfo(), updateDevConsoleState(), LimpManager::updateState(), updateTunerStudioState(), and validateCamVvtCounters().
LocalVersionHolder TriggerCentral::triggerVersion |
Definition at line 97 of file trigger_central.h.
Referenced by checkIfTriggerConfigChanged().
int TriggerCentral::vvtEventFallCounter[CAM_INPUTS_COUNT] |
Definition at line 163 of file trigger_central.h.
Referenced by handleVvtCamSignal(), sendQcBenchEventCounters(), triggerInfo(), and updateTunerStudioState().
int TriggerCentral::vvtEventRiseCounter[CAM_INPUTS_COUNT] |
Definition at line 162 of file trigger_central.h.
Referenced by handleVvtCamSignal(), sendQcBenchEventCounters(), triggerInfo(), and updateTunerStudioState().
angle_t TriggerCentral::vvtPosition[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 173 of file trigger_central.h.
Referenced by getVVTPosition(), and handleVvtCamSignal().
TriggerWaveform TriggerCentral::vvtShape[CAMS_PER_BANK] |
Definition at line 198 of file trigger_central.h.
Referenced by applyShapesConfiguration(), handleVvtCamSignal(), and startSimulatedTriggerSignal().
VvtTriggerDecoder TriggerCentral::vvtState[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 181 of file trigger_central.h.
Referenced by getLiveData(), getOutputValueByName(), handleVvtCamSignal(), and Engine::OnTriggerSynchronizationLost().
VvtTriggerConfiguration TriggerCentral::vvtTriggerConfiguration = {{"VVT1 ", 0}} |
Definition at line 92 of file trigger_central.h.
Referenced by applyShapesConfiguration(), handleVvtCamSignal(), Engine::injectEngineReferences(), and Engine::periodicSlowCallback().