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)
 
bool getClutchDownState ()
 
static bool getClutchUpState ()
 
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 139 of file engine.cpp.

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

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

431  {
432  static efitimems_t mostRecentMs = 0;
433  efitimems_t msNow = getTimeNowMs();
435 
436  if (mostRecentMs != 0) {
437  efitimems_t gapInMs = msNow - mostRecentMs;
438  // todo: lower gapInMs threshold?
439  if (gapInMs > 200) {
440  firmwareError(ObdCode::WATCH_DOG_SECONDS, "gap in time: mostRecentMs %lumS, now=%lumS, gap=%lumS",
441  mostRecentMs, msNow, gapInMs);
442  }
443  }
444  }
445  mostRecentMs = msNow;
446 }
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:44

Referenced by Engine::efiWatchdog().

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

◆ getBrakePedalState()

bool getBrakePedalState ( )

Definition at line 251 of file engine.cpp.

251  {
252 #if EFI_GPIO_HARDWARE
255  }
256 #endif // EFI_GPIO_HARDWARE
257  // todo: boolean sensors should leverage sensor framework #6342
259 }
EngineState engineState
Definition: engine.h:312
bool efiReadPin(brain_pin_e pin)
Definition: io_pins.cpp:89
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by LaunchControlBase::isInsideSwitchCondition(), and Engine::updateSwitchInputs().

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

◆ getClutchDownState()

bool getClutchDownState ( )

Definition at line 231 of file engine.cpp.

231  {
232 #if EFI_GPIO_HARDWARE
235  }
236 #endif // EFI_GPIO_HARDWARE
237  // todo: boolean sensors should leverage sensor framework #6342
239 }

Referenced by LaunchControlBase::isInsideSwitchCondition(), and 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 241 of file engine.cpp.

241  {
242 #if EFI_GPIO_HARDWARE
245  }
246 #endif // EFI_GPIO_HARDWARE
247  // todo: boolean sensors should leverage sensor framework #6342
249 }

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

604  {
605  return &engine->executor;
606 }
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 619 of file engine.cpp.

619  {
620  return &engine->injectionEvents;
621 }
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 623 of file engine.cpp.

623  {
624  return &engine->ignitionEvents;
625 }
IgnitionEventList ignitionEvents
Definition: engine.h:259

Referenced by mainTriggerCallback().

Here is the caller graph for this function:

◆ getLimpManager()

LimpManager* getLimpManager ( )

Definition at line 615 of file engine.cpp.

615  {
616  return &engine->module<LimpManager>().unmock();
617 }
constexpr auto & module()
Definition: engine.h:177

Referenced by RpmCalculator::checkIfSpinning(), configureRusefiLuaHooks(), 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 600 of file engine.cpp.

600  {
601  return &engine->outputChannels;
602 }
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_DEV:
93  case VVT_MAZDA_SKYACTIV:
95  case VVT_MAZDA_L:
97  case VVT_NISSAN_VQ:
99  case VVT_TOYOTA_4_1:
101  case VVT_MITSUBISHI_4G69:
103  case VVT_MITSUBISHI_3A92:
105  case VVT_MITSUBISHI_6G72:
107  case VVT_HONDA_CBR_600:
109  case VVT_MITSUBISHI_6G75:
110  case VVT_NISSAN_MR:
112  case VVT_MITSUBISHI_4G9x:
114  case VVT_MITSUBISHI_4G63:
116  default:
117  criticalError("Broken VVT mode maybe corrupted calibration %d: %s", vvtMode, getVvt_mode_e(vvtMode));
118  return trigger_type_e::TT_HALF_MOON; // we have to return something for the sake of -Werror=return-type
119  }
120 }
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.