rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
engine.h File Reference

Detailed Description

Date
May 21, 2014
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file engine.h.

Data Structures

class  Engine
 
struct  EngineAccessor
 

Functions

trigger_type_e getVvtTriggerType (vvt_mode_e vvtMode)
 
void applyNonPersistentConfiguration ()
 
void prepareOutputSignals ()
 
void scheduleReboot ()
 
bool isLockedFromUser ()
 
void unlockEcu (int password)
 

Variables

Engine ___engine
 
static constexpr Engineengine_ptr = &___engine
 
static EngineAccessor engine
 

Function Documentation

◆ applyNonPersistentConfiguration()

void applyNonPersistentConfiguration ( )

Definition at line 693 of file engine_configuration.cpp.

693 {
694#if EFI_PROD_CODE
695 efiAssertVoid(ObdCode::CUSTOM_APPLY_STACK, hasLotsOfRemainingStack(), "apply c");
696 efiPrintf("applyNonPersistentConfiguration()");
697#endif
698
699#if EFI_ENGINE_CONTROL
701#endif // EFI_ENGINE_CONTROL
702}
void updateTriggerConfiguration()
Definition engine.cpp:133
static EngineAccessor engine
Definition engine.h:413
@ CUSTOM_APPLY_STACK

Referenced by readFromFlash(), and resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVvtTriggerType()

trigger_type_e getVvtTriggerType ( vvt_mode_e  vvtMode)

VVT decoding delegates to universal trigger decoder. Here we map vvt_mode_e into corresponding trigger_type_e

Definition at line 72 of file engine.cpp.

72 {
73 switch (vvtMode) {
74 case VVT_CUSTOM_1:
75 case VVT_CUSTOM_2:
76 case VVT_INACTIVE:
77 // hold on, what? 'VVT_INACTIVE' means TT_HALF_MOON?!
79 case VVT_TOYOTA_3_TOOTH:
81 case VVT_MIATA_NB:
83 case VVT_BOSCH_QUICK_START:
85 case VVT_HONDA_K_EXHAUST:
87 case VVT_HONDA_K_INTAKE:
88 case VVT_SINGLE_TOOTH:
89 case VVT_MAP_V_TWIN:
91 case VVT_FORD_ST170:
93 case VVT_BARRA_3_PLUS_1:
95 case VVT_FORD_COYOTE:
97 case VVT_DEV:
99 case VVT_MAZDA_SKYACTIV:
101 case VVT_MAZDA_L:
103 case VVT_NISSAN_VQ:
105 case VVT_TOYOTA_4_1:
107 case VVT_MITSUBISHI_4G69:
109 case VVT_MITSUBISHI_3A92:
111 case VVT_MITSUBISHI_6G72:
113 case VVT_HONDA_CBR_600:
115 case VVT_CHRYSLER_PHASER:
117 case VVT_TOYOTA_3TOOTH_UZ:
119 case VVT_NISSAN_MR:
121 case VVT_UNUSED_17:
122 case VVT_MITSUBISHI_4G63:
124 case VVT_HR12DDR_IN:
126 case VVT_SUBARU_7TOOTH:
128 default:
129 return getCustomVvtTriggerType(vvtMode);
130 }
131}
PUBLIC_API_WEAK trigger_type_e getCustomVvtTriggerType(vvt_mode_e vvtMode)
Definition engine.cpp:63

Referenced by VvtTriggerConfiguration::getType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLockedFromUser()

bool isLockedFromUser ( )

Definition at line 310 of file engine2.cpp.

310 {
312 bool isLocked = lock > 0;
313 if (isLocked) {
314 criticalError("Tune is password protected. Please use console to unlock tune.");
315 }
316 return isLocked;
317}
static constexpr engine_configuration_s * engineConfiguration
static bool isLocked
Definition flash_int.cpp:22

Referenced by TunerStudio::handlePageReadCommand(), and TunerStudio::handleWriteChunkCommand().

Here is the caller graph for this function:

◆ prepareOutputSignals()

void prepareOutputSignals ( )

This heavy method is only invoked in case of a configuration change or initialization.

Definition at line 99 of file engine_math.cpp.

99 {
100 auto operationMode = getEngineRotationState()->getOperationMode();
101 getEngineState()->engineCycle = getEngineCycle(operationMode);
102
103 bool isOddFire = false;
104 for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
106 isOddFire = true;
107 break;
108 }
109 }
110
112
113 // Use odd fire wasted spark logic if not two stroke, and an odd fire or odd cylinder # engine
115 && (isOddFire | (engineConfiguration->cylindersCount % 2 == 1));
116
117#if EFI_UNIT_TEST
118 if (verboseMode) {
120 }
121#endif /* EFI_UNIT_TEST */
122
123#if EFI_SHAFT_POSITION_INPUT
125#endif // EFI_SHAFT_POSITION_INPUT
126
127 // Fuel schedule may now be completely wrong, force a reset
129}
const char * getIgnition_mode_e(ignition_mode_e value)
TriggerCentral triggerCentral
Definition engine.h:318
FuelSchedule injectionEvents
Definition engine.h:288
virtual operation_mode_e getOperationMode() const =0
bool useOddFireWastedSpark
angle_t engineCycle
void prepareTriggerShape()
EngineRotationState * getEngineRotationState()
Definition engine.cpp:573
EngineState * getEngineState()
Definition engine.cpp:577
bool verboseMode
void updateCylinders(void)
@ TWO_STROKE
angle_t getEngineCycle(operation_mode_e operationMode)
printf("\n")

Referenced by commonInitEngineController(), setIgnitionMode(), and Engine::updateTriggerConfiguration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scheduleReboot()

void scheduleReboot ( )

Some configuration changes require full firmware reset. Once day we will write graceful shutdown, but that would be one day.

Definition at line 158 of file rusefi.cpp.

158 {
159 efiPrintf("Rebooting in 3 seconds...");
160 chibios_rt::CriticalSectionLocker csl;
161 chVTSetI(&resetTimer, TIME_MS2I(3000), (vtfunc_t) rebootNow, NULL);
162}
static virtual_timer_t resetTimer
Definition rusefi.cpp:147
void rebootNow()
Definition rusefi.cpp:150

Referenced by processCanQcBenchTest(), runRusEfi(), and unlockEcu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unlockEcu()

void unlockEcu ( int  password)

Definition at line 319 of file engine2.cpp.

319 {
320 if (password != engineConfiguration->tuneHidingKey) {
321 efiPrintf("Nope rebooting...");
322#if EFI_PROD_CODE
324#endif // EFI_PROD_CODE
325 } else {
326 efiPrintf("Unlocked! Burning...");
328 requestBurn();
329 }
330}
void scheduleReboot()
Definition rusefi.cpp:158
void requestBurn()

Referenced by initSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ___engine

Engine ___engine
extern

◆ engine

Engine * engine
static

Definition at line 413 of file engine.h.

Referenced by adcOnchipSlowUpdate(), WallFuel::adjust(), LimpManager::allowElectronicThrottle(), alphax_2chan_ConfigOverrides(), applyIACposition(), applyNonPersistentConfiguration(), applyPidSettings(), applyPinState(), TriggerCentral::applyShapesConfiguration(), assertTimeIsLinear(), RpmCalculator::assignRpmValue(), attachMsdSdCard(), auxPlainPinTurnOn(), baseMCUInit(), blinkEtbErrorCodes(), HpfpQuantity::calcFuelPercent(), canDashboardHaltech(), canInfo(), RpmCalculator::checkIfSpinning(), TriggerCentral::checkIfTriggerConfigChanged(), checkIfTuningVeNow(), EtbController::checkJam(), EtbController::checkStatus(), TunerStudio::cmdOutputChannels(), completionCallback(), configureRusefiLuaHooks(), deattachMsdSdCard(), TriggerCentral::decodeMapCam(), deinitMmc(), detectHellenBoardType(), IdleController::determinePhase(), disableTriggerStimulator(), disengageStarterIfNeeded(), doInitElectronicThrottle(), doStartCranking(), emulatorApplyPinState(), enableExternalTriggerStimulator(), enableOrDisable(), enableTriggerStimulator(), endAveraging(), etbPidReset(), executeTSCommand(), executorStatistics(), extIonCallback(), f407_discovery_boardInitHardware(), fastAdcDoneCB(), fastAdcErrorCB(), HpfpLobe::findNextLobe(), finishIdleTestIfNeeded(), fireSparkAndPrepareNextSchedule(), firmwareErrorV(), getAcrState(), IgnitionState::getAdvance(), getAdvanceCorrections(), SpeedDensityAirmass::getAirmass(), getAirmassModel(), AngleBasedEvent::getAngleFromNow(), getBaseFuelMass(), getBoardId(), getBrakePedalState(), VvtController::getClosedLoop(), BoostController::getClosedLoop(), IdleController::getClosedLoop(), EtbController::getClosedLoopAutotune(), getClutchDownState(), getClutchUpState(), getCoilDutyCycle(), ShortTermFuelTrim::getCorrectionState(), getCrankingFuel(), getCrankingFuel3(), IdleController::getCrankingTaperFraction(), TriggerCentral::getCurrentEnginePhase(), getCurrentIgnitionMode(), getDynoviewHP(), getDynoviewTorque(), getEngineRotationState(), getEngineState(), getFuelALSCorrection(), getFuelSchedule(), getIdlePosition(), IdleController::getIdlePosition(), IdleController::getIdleTimingAdjustment(), getIgnitionEvents(), getInjectionMass(), getInjectorDutyCycle(), getInjectorDutyCycleStage2(), ClosedLoopFuelCellImpl::getLambdaError(), ShortTermFuelTrim::getLearningState(), getLimpManager(), getLiveData(), getLiveData(), LambdaMonitor::getMaxAllowedLambda(), getMultiSparkCount(), AlternatorController::getOpenLoop(), BoostController::getOpenLoop(), RpmCalculator::getOperationMode(), getOutputValueByHash(), getPerCylinderFiringOrderOffset(), getPostCrankingFuelCorrection(), SpeedDensityAirmass::getPredictiveMap(), PrimeController::getPrimeDuration(), getRunningAdvance(), getRunningFuel(), IdleController::getRunningOpenLoop(), getScheduler(), BoostController::getSetpoint(), VvtController::getSetpoint(), EtbController::getSetpointEtb(), IgnitionState::getSparkHardwareLatencyCorrection(), DfcoController::getState(), FanController::getState(), FuelComputer::getTargetLambda(), IdleController::getTargetRpm(), getTriggerCentral(), getTunerStudioOutputChannels(), AirmassVeModelBase::getVe(), handleCommandX14(), handleFuel(), handleGetConfigErorr(), handleGetDataRequest(), handleShaftSignal(), TriggerCentral::handleShaftSignal(), handleTestCommand(), handleVvtCamSignal(), handleWidebandCan(), hellen154_hyundai_boardConfigOverrides(), hellen_MiataNB2_boardConfigOverrides(), incrementGlobalConfigurationVersion(), IdleController::init(), TachometerModule::init(), Generic4TransmissionController::init(), Gm4l6xTransmissionController::init(), initAccelEnrichment(), initAlternatorCtrl(), initAuxValves(), initBoostCtrl(), initDcMotor(), initDcMotor(), initElectronicThrottle(), initGearController(), initGpPwm(), initializeIgnitionActions(), initMmc(), initSoftwareKnock(), initSpeedometer(), initStartStopButton(), initStft(), initVrThresholdPwm(), initVvtActuators(), is_F_OrOlder(), LambdaMonitorBase::isCurrentlyGood(), AemXSeriesWideband::isHeaterAllowed(), TriggerCentral::isMapCamSync(), isMegaModuleRevision(), isTriggerErrorNow(), LtftState::load(), SpeedDensityAirmass::logAndGetFallback(), lua_getDigital(), lua_setDebug(), luaHeapAlloc(), mainTriggerCallback(), mapAveragingAdcCallback(), mountMmc(), needToTriggerTsRefresh(), obdOnCanPacketRx(), VvtController::observePlant(), onApplyPreset(), onConfigurationChangeTriggerCallback(), onEcuStartDoSomethingTriggerInputPins(), MapAveragingModule::onEnginePhase(), onFastAdcComplete(), HpfpController::onFastCallback(), AlternatorController::onFastCallback(), VvtController::onFastCallback(), WallFuelController::onFastCallback(), MapAveragingModule::onFastCallback(), IdleController::onFastCallback(), IdleController::onIgnitionStateChanged(), KnockControllerBase::onKnockSenseCompleted(), PrimeController::onPrimeStart(), RpmCalculator::onSlowCallback(), HarleyAcr::onSlowCallback(), MainRelayController::onSlowCallback(), IgnitionController::onSlowCallback(), FanController::onSlowCallback(), FuelPumpController::onSlowCallback(), TripOdometer::onSlowCallback(), SensorChecker::onSlowCallback(), Engine::onSparkFireKnockSense(), onTdcCallback(), onTransitionEvent(), PrimaryTriggerDecoder::onTriggerError(), onTriggerEventSparkLogic(), Engine::OnTriggerSynchronization(), InjectionEvent::onTriggerTooth(), overFireSparkAndPrepareNextSchedule(), EngineState::periodicFastCallback(), Engine::periodicSlowCallback(), CanWrite::PeriodicTask(), pingWideband(), pokeAuxDigital(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), populateFrame(), StepperMotorBase::postCurrentPosition(), GearControllerBase::postState(), Engine::preCalculate(), prepareCylinderIgnitionSchedule(), prepareIgnitionSchedule(), prepareOutputSignals(), printConfiguration(), printErrorCounters(), printFullAdcReport(), printUid(), processCanRxImu_BoschM5_10_RollX(), processCanRxImu_BoschM5_10_YawY(), processCanRxImu_BoschM5_10_Z(), processLastKnockEvent(), StepDirectionStepper::pulse(), readFromFlash(), readGppwmChannel(), recalculateAuxValveTiming(), CanStreamerState::receiveFrame(), WarningCodeState::refreshTs(), reportLogicAnalyzerToTS(), resetLua(), rpmShaftPositionCallback(), runBench(), runOneLua(), runRusEfi(), sayHello(), scheduleByAngle(), TriggerScheduler::scheduleEventsUntilNextTriggerTooth(), HpfpController::scheduleNextCycle(), scheduleOpen(), scheduleSparkEvent(), sdFormat(), sdLoggerCreateFile(), sendQcBenchAuxDigitalCounters(), sendQcBenchButtonCounters(), sendQcBenchEventCounters(), sendWidebandInfo(), SentDecoderThread(), setDefaultBaseEngine(), setEngineType(), setEtbIdlePosition(), setEtbWastegatePosition(), IgnitionOutputPin::setHigh(), StepperMotorBase::setInitialPosition(), IgnitionOutputPin::setLow(), SetNextCompositeEntry(), EtbController::setOutput(), Generic4TransmissionController::setPcState(), RpmCalculator::setRpmValue(), RpmCalculator::setSpinningUp(), setStatus(), RpmCalculator::setStopSpinning(), setToothLogReady(), setTriggerEmulatorRPM(), setTriggerType(), setValue(), setWholeTimingMapCmd(), slowAdcErrorCB(), slowStartStopButtonCallback(), startAveraging(), startBoostPin(), AdcDevice::startConversionI(), startDwellByTurningSparkPinHigh(), startIdleBench(), startIdleThread(), startKnockSampling(), startLua(), startPwm(), startSimulatedTriggerSignal(), startStopButtonToggle(), startTriggerInputPins(), MapAverager::stop(), ShutdownController::stopEngine(), storageAllowWriteID(), storageReadID(), storageWriteID(), tdcMarkCallback(), THD_FUNCTION(), tle8888PostState(), tle8888startup(), triggerScopeDisable(), triggerScopeGetBuffer(), tsCalibrationIsIdle(), tsCalibrationSetData(), tsCalibrationSetIdle(), turnSparkPinHighStartCharging(), turnVvtPidOn(), unmountMmc(), InjectionEvent::update(), LongTermIdleTrim::update(), SimpleTransmissionController::update(), OneCylinder::updateCylinderNumber(), EngineCylinders::updateCylinders(), updateDevConsoleState(), updateDynoView(), updateEgtSensors(), updateFlags(), updateFuelCorrections(), updateFuelInfo(), updateFuelResults(), updateFuelSensors(), updateGppwm(), updateIgnition(), updateLambda(), IdleController::updateLtit(), updateMiscSensors(), updatePressures(), updateRawSensors(), updateSdCardLiveFlags(), Engine::updateSlowSensors(), EngineState::updateSparkSkip(), LimpManager::updateState(), Engine::updateSwitchInputs(), EngineState::updateTChargeK(), updateTempSensors(), updateThrottles(), Engine::updateTriggerConfiguration(), ShiftTorqueReductionController::updateTriggerPinState(), updateTriggerWaveformIfNeeded(), updateTunerStudioState(), updateVehicleSpeed(), updateVvtSensors(), validateHardwareTimer(), warningVA(), watchDogBuddyCallback(), MLG::writeSdBlock(), writeToFlashNowImpl(), and CanTxMessage::~CanTxMessage().

◆ engine_ptr

constexpr Engine* engine_ptr = &___engine
staticconstexpr

Go to the source code of this file.