rusEFI
The most advanced open source ECU
Functions | Variables
engine.cpp File Reference

Detailed Description

This might be a http://en.wikipedia.org/wiki/God_object but that's best way I can express myself in C/C++. I am open for suggestions :)

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

Definition in file engine.cpp.

Functions

trigger_type_e getVvtTriggerType (vvt_mode_e vvtMode)
 
static void assertCloseTo (const char *msg, float actual, float expected)
 
static bool getClutchUpState ()
 
static bool getBrakePedalState ()
 
static void assertTimeIsLinear ()
 
injection_mode_e getCurrentInjectionMode ()
 
EngineRotationStategetEngineRotationState ()
 
EngineStategetEngineState ()
 
TunerStudioOutputChannelsgetTunerStudioOutputChannels ()
 
ExecutorInterfacegetExecutorInterface ()
 
TriggerCentralgetTriggerCentral ()
 
LimpManagergetLimpManager ()
 
FuelSchedulegetFuelSchedule ()
 
IgnitionEventListgetIgnitionEvents ()
 

Variables

int waveChartUsedSize
 
WaveChart waveChart
 

Function Documentation

◆ assertCloseTo()

static void assertCloseTo ( const char *  msg,
float  actual,
float  expected 
)
static

Definition at line 137 of file engine.cpp.

137  {
138  if (actual < 0.95f * expected || actual > 1.05f * expected) {
139  criticalError("%s validation failed actual=%f vs expected=%f", msg, actual, expected);
140  }
141 }

Referenced by Engine::periodicSlowCallback().

Here is the caller graph for this function:

◆ assertTimeIsLinear()

static void assertTimeIsLinear ( )
static

This code asserts that we do not have unexpected gaps in time flow with the exception of internal flash burn.

Definition at line 413 of file engine.cpp.

413  {
414  static efitimems_t mostRecentMs = 0;
415  efitimems_t msNow = getTimeNowMs();
417 
418  if (mostRecentMs != 0) {
419  efitimems_t gapInMs = msNow - mostRecentMs;
420  // todo: lower gapInMs threshold?
421  if (gapInMs > 200) {
422  firmwareError(ObdCode::WATCH_DOG_SECONDS, "gap in time: mostRecentMs %dmS, now=%dmS, gap=%dmS",
423  mostRecentMs, msNow, gapInMs);
424  }
425  }
426  }
427  mostRecentMs = msNow;
428 }
Timer configBurnTimer
Definition: engine.h:275
efitimems_t getTimeNowMs()
Returns the 32 bit number of milliseconds since the board initialization.
Definition: efitime.cpp:34
Engine * engine
void firmwareError(ObdCode code, const char *fmt,...)
@ WATCH_DOG_SECONDS
engine_configuration_s * engineConfiguration
uint32_t efitimems_t
Definition: rusefi_types.h:43

Referenced by Engine::efiWatchdog().

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

◆ getBrakePedalState()

static bool getBrakePedalState ( )
static

Definition at line 238 of file engine.cpp.

238  {
241  }
242  // todo: boolean sensors should leverage sensor framework #6342
244 }
EngineState engineState
Definition: engine.h:315
bool efiReadPin(brain_pin_e pin)
Definition: io_pins.cpp:89
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by Engine::updateSwitchInputs().

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

◆ getClutchUpState()

static bool getClutchUpState ( )
static

Definition at line 230 of file engine.cpp.

Referenced by Engine::updateSwitchInputs().

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

◆ getCurrentInjectionMode()

injection_mode_e getCurrentInjectionMode ( )

Definition at line 551 of file engine.cpp.

Referenced by getInjectionModeDurationMultiplier(), and InjectionEvent::update().

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

◆ getEngineRotationState()

EngineRotationState* getEngineRotationState ( )

◆ getEngineState()

EngineState* getEngineState ( )

◆ getExecutorInterface()

ExecutorInterface* getExecutorInterface ( )

Definition at line 586 of file engine.cpp.

586  {
587  return &engine->executor;
588 }
SingleTimerExecutor executor
Definition: engine.h:241

Referenced by handleShaftSignal(), logVvtFront(), PrimeController::onIgnitionStateChanged(), PrimeController::onPrimeStart(), and InjectionEvent::onTriggerTooth().

Here is the caller graph for this function:

◆ getFuelSchedule()

FuelSchedule* getFuelSchedule ( )

Definition at line 601 of file engine.cpp.

601  {
602  return &engine->injectionEvents;
603 }
FuelSchedule injectionEvents
Definition: engine.h:258

Referenced by handleFuel(), and mainTriggerCallback().

Here is the caller graph for this function:

◆ getIgnitionEvents()

IgnitionEventList* getIgnitionEvents ( )

Definition at line 605 of file engine.cpp.

605  {
606  return &engine->ignitionEvents;
607 }
IgnitionEventList ignitionEvents
Definition: engine.h:259

Referenced by mainTriggerCallback().

Here is the caller graph for this function:

◆ getLimpManager()

LimpManager* getLimpManager ( )

Definition at line 597 of file engine.cpp.

597  {
598  return &engine->module<LimpManager>().unmock();
599 }
constexpr auto & module()
Definition: engine.h:177

Referenced by RpmCalculator::checkIfSpinning(), TriggerCentral::decodeMapCam(), doScheduleStopEngine(), firmwareError(), getRunningFuel(), handleFuel(), handleShaftSignal(), onTriggerEventSparkLogic(), EngineState::periodicFastCallback(), processCanRxMessage(), and EtbController::setOutput().

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

◆ getTriggerCentral()

TriggerCentral* getTriggerCentral ( )

◆ getTunerStudioOutputChannels()

TunerStudioOutputChannels* getTunerStudioOutputChannels ( )

Definition at line 582 of file engine.cpp.

582  {
583  return &engine->outputChannels;
584 }
TunerStudioOutputChannels outputChannels
Definition: engine.h:99

Referenced by InjectionEvent::computeInjectionAngle(), EventQueue::EventQueue(), EventQueue::getFreeScheduling(), SensorChecker::onSlowCallback(), InjectorOutputPin::setHigh(), InjectorOutputPin::setLow(), and EventQueue::tryReturnScheduling().

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 69 of file engine.cpp.

69  {
70  switch (vvtMode) {
71  case VVT_INACTIVE:
73  case VVT_TOYOTA_3_TOOTH:
75  case VVT_MIATA_NB:
77  case VVT_BOSCH_QUICK_START:
79  case VVT_HONDA_K_EXHAUST:
81  case VVT_HONDA_K_INTAKE:
82  case VVT_SINGLE_TOOTH:
83  case VVT_MAP_V_TWIN:
85  case VVT_FORD_ST170:
87  case VVT_BARRA_3_PLUS_1:
89  case VVT_FORD_COYOTE:
91  case VVT_MAZDA_SKYACTIV:
93  case VVT_MAZDA_L:
95  case VVT_NISSAN_VQ:
97  case VVT_TOYOTA_4_1:
99  case VVT_MITSUBISHI_4G69:
101  case VVT_MITSUBISHI_3A92:
103  case VVT_MITSUBISHI_6G72:
105  case VVT_HONDA_CBR_600:
107  case VVT_MITSUBISHI_6G75:
108  case VVT_NISSAN_MR:
110  case VVT_MITSUBISHI_4G9x:
112  case VVT_MITSUBISHI_4G63:
114  default:
115  criticalError("Broken VVT mode maybe corrupted calibration %d: %s", vvtMode, getVvt_mode_e(vvtMode));
116  return trigger_type_e::TT_HALF_MOON; // we have to return something for the sake of -Werror=return-type
117  }
118 }
const char * getVvt_mode_e(vvt_mode_e value)

Referenced by VvtTriggerConfiguration::getType().

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

Variable Documentation

◆ waveChart

WaveChart waveChart
extern

Definition at line 33 of file trigger_central.cpp.

Referenced by Engine::resetEngineSnifferIfInTestMode().

◆ waveChartUsedSize

int waveChartUsedSize
extern

Definition at line 60 of file engine_sniffer.cpp.

Go to the source code of this file.