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 687 of file engine_configuration.cpp.

687 {
688#if EFI_PROD_CODE
689 efiAssertVoid(ObdCode::CUSTOM_APPLY_STACK, hasLotsOfRemainingStack(), "apply c");
690 efiPrintf("applyNonPersistentConfiguration()");
691#endif
692
693#if EFI_ENGINE_CONTROL
695#endif // EFI_ENGINE_CONTROL
696}
void updateTriggerConfiguration()
Definition engine.cpp:127
static EngineAccessor engine
Definition engine.h:410
@ 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 71 of file engine.cpp.

71 {
72 switch (vvtMode) {
73 case VVT_INACTIVE:
75 case VVT_TOYOTA_3_TOOTH:
77 case VVT_MIATA_NB:
79 case VVT_BOSCH_QUICK_START:
81 case VVT_HONDA_K_EXHAUST:
83 case VVT_HONDA_K_INTAKE:
84 case VVT_SINGLE_TOOTH:
85 case VVT_MAP_V_TWIN:
87 case VVT_FORD_ST170:
89 case VVT_BARRA_3_PLUS_1:
91 case VVT_FORD_COYOTE:
93 case VVT_DEV:
95 case VVT_MAZDA_SKYACTIV:
97 case VVT_MAZDA_L:
99 case VVT_NISSAN_VQ:
101 case VVT_TOYOTA_4_1:
103 case VVT_MITSUBISHI_4G69:
105 case VVT_MITSUBISHI_3A92:
107 case VVT_MITSUBISHI_6G72:
109 case VVT_HONDA_CBR_600:
111 case VVT_CHRYSLER_PHASER:
113 case VVT_TOYOTA_3TOOTH_UZ:
115 case VVT_NISSAN_MR:
117 case VVT_UNUSED_17:
118 case VVT_MITSUBISHI_4G63:
120 case VVT_HR12DDR_IN:
122 default:
123 return getCustomVvtTriggerType(vvtMode);
124 }
125}
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 256 of file engine2.cpp.

256 {
258 bool isLocked = lock > 0;
259 if (isLocked) {
260 criticalError("Tune is password protected. Please use console to unlock tune.");
261 }
262 return isLocked;
263}
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:316
FuelSchedule injectionEvents
Definition engine.h:286
virtual operation_mode_e getOperationMode() const =0
bool useOddFireWastedSpark
angle_t engineCycle
void prepareTriggerShape()
EngineRotationState * getEngineRotationState()
Definition engine.cpp:551
EngineState * getEngineState()
Definition engine.cpp:555
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 265 of file engine2.cpp.

265 {
266 if (password != engineConfiguration->tuneHidingKey) {
267 efiPrintf("Nope rebooting...");
268#if EFI_PROD_CODE
270#endif // EFI_PROD_CODE
271 } else {
272 efiPrintf("Unlocked! Burning...");
274 requestBurn();
275 }
276}
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 410 of file engine.h.

Referenced by WallFuel::adjust(), LimpManager::allowElectronicThrottle(), 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(), flashAllowWriteID(), flashWriteID(), fuelClosedLoopCorrection(), getAcrState(), IgnitionState::getAdvance(), getAdvanceCorrections(), SpeedDensityAirmass::getAirmass(), getAirmassModel(), AngleBasedEvent::getAngleFromNow(), getBaseFuelMass(), getBoardId(), getBrakePedalState(), VvtController::getClosedLoop(), BoostController::getClosedLoop(), IdleController::getClosedLoop(), EtbController::getClosedLoopAutotune(), getClutchDownState(), getClutchUpState(), getCoilDutyCycle(), getCrankingFuel(), getCrankingFuel3(), IdleController::getCrankingTaperFraction(), TriggerCentral::getCurrentEnginePhase(), getCurrentIgnitionMode(), getDynoviewHP(), getDynoviewTorque(), getEngineRotationState(), getEngineState(), getFuelALSCorrection(), getFuelSchedule(), getIdlePosition(), IdleController::getIdlePosition(), IdleController::getIdleTimingAdjustment(), getIgnitionEvents(), getInjectionMass(), getInjectorDutyCycle(), getInjectorDutyCycleStage2(), ClosedLoopFuelCellImpl::getLambdaError(), 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(), grabPedalIsUp(), grabPedalIsWideOpen(), handleCommandX14(), handleFuel(), handleGetDataRequest(), handleShaftSignal(), TriggerCentral::handleShaftSignal(), handleTestCommand(), handleVvtCamSignal(), handleWidebandCan(), incrementGlobalConfigurationVersion(), IdleController::init(), TachometerModule::init(), Generic4TransmissionController::init(), Gm4l6xTransmissionController::init(), initAccelEnrichment(), initAlternatorCtrl(), initAuxValves(), initBoostCtrl(), initDcMotor(), initDcMotor(), initElectronicThrottle(), initGearController(), initGpPwm(), initializeIgnitionActions(), initMmc(), initSoftwareKnock(), initSpeedometer(), initStartStopButton(), 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(), IdleController::onFastCallback(), HpfpController::onFastCallback(), AlternatorController::onFastCallback(), VvtController::onFastCallback(), WallFuelController::onFastCallback(), MapAveragingModule::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(), 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(), reportLogicAnalyzerToTS(), resetLua(), rpmShaftPositionCallback(), runBench(), runOneLua(), runRusEfi(), sayHello(), scheduleByAngle(), TriggerScheduler::scheduleEventsUntilNextTriggerTooth(), HpfpController::scheduleNextCycle(), scheduleOpen(), scheduleSparkEvent(), sdFormat(), sendQcBenchAuxDigitalCounters(), sendQcBenchButtonCounters(), sendQcBenchEventCounters(), sendWidebandInfo(), SentDecoderThread(), setBoardConfigOverrides(), setDefaultBaseEngine(), setEngineType(), setEtbIdlePosition(), setEtbWastegatePosition(), IgnitionOutputPin::setHigh(), StepperMotorBase::setInitialPosition(), IgnitionOutputPin::setLow(), SetNextCompositeEntry(), EtbController::setOutput(), Generic4TransmissionController::setPcState(), RpmCalculator::setRpmValue(), RpmCalculator::setSpinningUp(), setStatus(), RpmCalculator::setStopped(), setToothLogReady(), setTriggerEmulatorRPM(), setTriggerType(), setValue(), setWholeTimingMapCmd(), shouldUpdateCorrection(), slowAdcErrorCB(), slowStartStopButtonCallback(), startAveraging(), startBoostPin(), AdcDevice::startConversionI(), startDwellByTurningSparkPinHigh(), startIdleBench(), startIdleThread(), startKnockSampling(), startLua(), startPwm(), startSimulatedTriggerSignal(), startStopButtonToggle(), startTriggerInputPins(), MapAverager::stop(), ShutdownController::stopEngine(), tdcMarkCallback(), THD_FUNCTION(), tle8888PostState(), tle8888startup(), triggerScopeDisable(), triggerScopeGetBuffer(), 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(), updateSlowAdc(), Engine::updateSlowSensors(), EngineState::updateSparkSkip(), LimpManager::updateState(), Engine::updateSwitchInputs(), EngineState::updateTChargeK(), updateTempSensors(), updateThrottles(), Engine::updateTriggerConfiguration(), ShiftTorqueReductionController::updateTriggerPinState(), updateTriggerWaveformIfNeeded(), updateTunerStudioState(), updateVehicleSpeed(), updateVvtSensors(), updateWarningCodes(), validateHardwareTimer(), warning(), watchDogBuddyCallback(), writeSdBlock(), writeToFlashNowImpl(), and CanTxMessage::~CanTxMessage().

◆ engine_ptr

constexpr Engine* engine_ptr = &___engine
staticconstexpr

Go to the source code of this file.