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) |
void | applyCamGapOverride () |
bool | isMapCamSync (efitick_t nowNt, float currentPhase) |
Private Member Functions | |
void | decodeMapCam (int triggerIndexForListeners, efitick_t nowNt, float currentPhase) |
void | applyTriggerGapOverride () |
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 39 of file trigger_central.cpp.
void TriggerCentral::applyCamGapOverride | ( | ) |
Definition at line 1182 of file trigger_central.cpp.
Referenced by applyShapesConfiguration(), and initVvtShape().
void TriggerCentral::applyShapesConfiguration | ( | ) |
'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 1203 of file trigger_central.cpp.
Referenced by Engine::updateTriggerConfiguration().
|
private |
this is only useful while troubleshooting a new trigger shape in the field in very VERY rare circumstances
Definition at line 1157 of file trigger_central.cpp.
Referenced by applyShapesConfiguration().
bool TriggerCentral::checkIfTriggerConfigChanged | ( | ) |
Definition at line 1253 of file trigger_central.cpp.
|
private |
Definition at line 694 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 787 of file trigger_central.cpp.
Referenced by handleShaftSignal().
expected< float > TriggerCentral::getCurrentEnginePhase | ( | efitick_t | nowNt | ) | const |
Definition at line 68 of file trigger_central.cpp.
Referenced by getAcrState(), handleVvtCamSignal(), isToothExpectedNow(), HpfpController::pinTurnOff(), and HpfpController::pinTurnOn().
int TriggerCentral::getHwEventCounter | ( | int | index | ) | const |
Definition at line 54 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 58 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 809 of file trigger_central.cpp.
Referenced by handleShaftSignal().
Definition at line 648 of file trigger_central.cpp.
Referenced by decodeMapCam().
|
private |
Definition at line 727 of file trigger_central.cpp.
Referenced by handleShaftSignal().
bool TriggerCentral::isTriggerConfigChanged | ( | ) |
Definition at line 1261 of file trigger_central.cpp.
bool TriggerCentral::isTriggerDecoderError | ( | ) |
Definition at line 1293 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 563 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 136 of file trigger_central.cpp.
Referenced by adjustCrankPhase().
void TriggerCentral::validateCamVvtCounters | ( | ) |
Definition at line 1119 of file trigger_central.cpp.
Referenced by rpmShaftPositionCallback().
angle_t TriggerCentral::currentVVTEventPosition[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 166 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(), emulatorApplyPinState(), enableExternalTriggerStimulator(), enableTriggerStimulator(), engineMovedRecently(), hwHandleShaftSignal(), hwHandleVvtCamSignal(), storageAllowWriteID(), 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 205 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 200 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 isMapCamSync().
TriggerNoiseFilter TriggerCentral::noiseFilter |
Definition at line 160 of file trigger_central.h.
Referenced by handleShaftSignal(), onConfigurationChangeTriggerCallback(), RpmCalculator::setStopSpinning(), and TriggerCentral().
int TriggerCentral::prevChangeAtCycle = 0 |
Definition at line 112 of file trigger_central.h.
Referenced by isMapCamSync().
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 197 of file trigger_central.h.
Referenced by findNextTriggerToothAngle(), handleShaftSignal(), prepareTriggerShape(), rpmShaftPositionCallback(), and triggerShapeInfo().
TriggerWaveform TriggerCentral::triggerShape |
Definition at line 176 of file trigger_central.h.
Referenced by applyShapesConfiguration(), applyTriggerGapOverride(), 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 173 of file trigger_central.h.
Referenced by applyShapesConfiguration(), canDashboardHaltech(), extIonCallback(), getAcrState(), getCurrentIgnitionMode(), getLiveData(), getLiveData(), getOutputValueByHash(), handleShaftSignal(), handleVvtCamSignal(), isMapCamSync(), 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().
angle_t TriggerCentral::vvtPosition[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 170 of file trigger_central.h.
Referenced by getVVTPosition(), and handleVvtCamSignal().
TriggerWaveform TriggerCentral::vvtShape[CAMS_PER_BANK] |
Definition at line 195 of file trigger_central.h.
Referenced by applyCamGapOverride(), applyShapesConfiguration(), handleVvtCamSignal(), and startSimulatedTriggerSignal().
VvtTriggerDecoder TriggerCentral::vvtState[BANKS_COUNT][CAMS_PER_BANK] |
Definition at line 178 of file trigger_central.h.
Referenced by getLiveData(), getOutputValueByHash(), 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().