rusEFI
The most advanced open source ECU
engine.cpp
Go to the documentation of this file.
1 /**
2  * @file engine.cpp
3  *
4  *
5  * This might be a http://en.wikipedia.org/wiki/God_object but that's best way I can
6  * express myself in C/C++. I am open for suggestions :)
7  *
8  * @date May 21, 2014
9  * @author Andrey Belomutskiy, (c) 2012-2020
10  */
11 
12 #include "pch.h"
13 
14 #include "trigger_central.h"
15 #include "fuel_math.h"
16 #include "advance_map.h"
17 #include "speed_density.h"
18 #include "advance_map.h"
19 #include "init.h"
20 
21 #include "aux_valves.h"
22 #include "map_averaging.h"
23 #include "perf_trace.h"
24 #include "backup_ram.h"
25 #include "idle_thread.h"
26 #include "idle_hardware.h"
27 #include "gppwm.h"
28 #include "tachometer.h"
29 #include "speedometer.h"
30 #include "dynoview.h"
31 #include "boost_control.h"
32 #include "fan_control.h"
33 #include "ac_control.h"
34 #include "vr_pwm.h"
35 #include "max3185x.h"
36 #if EFI_MC33816
37  #include "mc33816.h"
38 #endif // EFI_MC33816
39 
40 #include "bench_test.h"
41 
42 #if EFI_PROD_CODE
43 #include "trigger_emulator_algo.h"
44 #endif /* EFI_PROD_CODE */
45 
46 #if (BOARD_TLE8888_COUNT > 0)
47 #include "gpio/tle8888.h"
48 #endif
49 
50 #if EFI_ENGINE_SNIFFER
51 #include "engine_sniffer.h"
52 extern int waveChartUsedSize;
53 extern WaveChart waveChart;
54 #endif /* EFI_ENGINE_SNIFFER */
55 
57 #if EFI_ENGINE_SNIFFER
59  // TODO: what is the exact reasoning for the exact engine sniffer pause time I wonder
61  waveChart.reset();
62  }
63 #endif /* EFI_ENGINE_SNIFFER */
64 }
65 
66 /**
67  * VVT decoding delegates to universal trigger decoder. Here we map vvt_mode_e into corresponding trigger_type_e
68  */
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 }
121 
123 
124 
125 #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
126  // we have a confusing threading model so some synchronization would not hurt
127  chibios_rt::CriticalSectionLocker csl;
128 
130 
131 
134  }
135 #endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
136 }
137 
138 #if ANALOG_HW_CHECK_MODE
139 static void assertCloseTo(const char* msg, float actual, float expected) {
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 }
144 #endif // ANALOG_HW_CHECK_MODE
145 
148 
149 #if EFI_SHAFT_POSITION_INPUT
150  // Re-read config in case it's changed
152  for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
154  }
155 
157  enginePins.o2heater.setValue(getEngineState()->heaterControlEnabled);
159 #endif // EFI_SHAFT_POSITION_INPUT
160 
161  efiWatchdog();
163  checkShutdown();
164 
166 
168 
169  updateGppwm();
170 
171  engine->engineModules.apply_all([](auto & m) { m.onSlowCallback(); });
172 
173 #if (BOARD_TLE8888_COUNT > 0)
174  tle8888startup();
175 #endif
176 
177 #if EFI_DYNO_VIEW
178  updateDynoView();
179 #endif
180 
181  slowCallBackWasInvoked = true;
182 
183 #if EFI_PROD_CODE
184  void baroLps25Update();
185  baroLps25Update();
186 #endif // EFI_PROD_CODE
187 
188 #if ANALOG_HW_CHECK_MODE
189  criticalAssertVoid(isAdcChannelValid(engineConfiguration->clt.adcChannel), "No CLT setting");
190  efitimesec_t secondsNow = getTimeNowS();
191 
192 #if ! HW_CHECK_ALWAYS_STIMULATE
193  fail("HW_CHECK_ALWAYS_STIMULATE required to have self-stimulation")
194 #endif
195 
196  int hwCheckRpm = 204;
197  if (secondsNow > 2 && secondsNow < 180) {
198  assertCloseTo("RPM", Sensor::get(SensorType::Rpm).Value, hwCheckRpm);
199  } else if (!hasFirmwareError() && secondsNow > 180) {
200  static bool isHappyTest = false;
201  if (!isHappyTest) {
202  setTriggerEmulatorRPM(5 * hwCheckRpm);
203  efiPrintf("TEST PASSED");
204  isHappyTest = true;
205  }
206  }
207 
212 #endif // ANALOG_HW_CHECK_MODE
213 }
214 
215 /**
216  * We are executing these heavy (logarithm) methods from outside the trigger callbacks for performance reasons.
217  * See also periodicFastCallback
218  */
221 
222 #if EFI_SHAFT_POSITION_INPUT
226 
228 #endif // EFI_SHAFT_POSITION_INPUT
229 }
230 
232 #if EFI_GPIO_HARDWARE
235  }
236 #endif // EFI_GPIO_HARDWARE
237  // todo: boolean sensors should leverage sensor framework #6342
239 }
240 
241 static bool getClutchUpState() {
242 #if EFI_GPIO_HARDWARE
245  }
246 #endif // EFI_GPIO_HARDWARE
247  // todo: boolean sensors should leverage sensor framework #6342
249 }
250 
252 #if EFI_GPIO_HARDWARE
255  }
256 #endif // EFI_GPIO_HARDWARE
257  // todo: boolean sensors should leverage sensor framework #6342
259 }
260 
261 
263  // this value is not used yet
267 #if EFI_GPIO_HARDWARE
268  {
269  bool currentState;
270  if (hasAcToggle()) {
271  currentState = getAcToggle();
272 #ifdef EFI_KLINE
273  } else if (engineConfiguration->hondaK) {
274 extern bool kAcRequestState;
275  currentState = kAcRequestState;
276 #endif // EFI_KLINE
277  } else {
278  currentState = engine->engineState.lua.acRequestState;
279  }
280  AcController & acController = engine->module<AcController>().unmock();
281  if (engine->acButtonSwitchedState.update(currentState)) {
282  acController.acSwitchLastChangeTimeMs = US2MS(getTimeNowUs());
283  }
284  }
285 
286 #if EFI_IDLE_CONTROL
289  }
290 #endif // EFI_IDLE_CONTROL
291 
292  pokeAuxDigital();
293 
294 #endif // EFI_GPIO_HARDWARE
295 }
296 
298  : clutchUpSwitchedState(&engineState.clutchUpState),
299  brakePedalSwitchedState(&engineState.brakePedalState),
300  acButtonSwitchedState(&module<AcController>().unmock().acButtonState)
301 
302 #if EFI_LAUNCH_CONTROL
303 
304  , softSparkLimiter(false), hardSparkLimiter(true)
305 
306 #if EFI_ANTILAG_SYSTEM
307 // , ALSsoftSparkLimiter(false)
308 #endif /* EFI_ANTILAG_SYSTEM */
309 
310 #endif // EFI_LAUNCH_CONTROL
311 {
312  reset();
313 }
314 
317 }
318 
320  /**
321  * it's important for wrapAngle() that engineCycle field never has zero
322  */
324  resetLua();
325 }
326 
328  // todo: https://github.com/rusefi/rusefi/issues/4308
329  engineState.lua = {};
330  engineState.lua.fuelAdd = 0;
332  engineState.lua.luaDisableEtb = false;
333  engineState.lua.luaIgnCut = false;
334  engineState.lua.luaFuelCut = false;
336 #if EFI_BOOST_CONTROL
337  module<BoostController>().unmock().resetLua();
338 #endif // EFI_BOOST_CONTROL
341 #if EFI_IDLE_CONTROL
342  module<IdleController>().unmock().luaAdd = 0;
343 #endif // EFI_IDLE_CONTROL
344 }
345 
346 /**
347  * Here we have a bunch of stuff which should invoked after configuration change
348  * so that we can prepare some helper structures
349  */
351 #if EFI_TUNER_STUDIO
352  // we take 2 bytes of crc32, no idea if it's right to call it crc16 or not
353  // we have a hack here - we rely on the fact that engineMake is the first of three relevant fields
355 
356  // we need and can empty warning message for CRC purposes
357  memset(config->warning_message, 0, sizeof(config->warning_message));
359 #endif /* EFI_TUNER_STUDIO */
360 }
361 
362 #if EFI_SHAFT_POSITION_INPUT
363 void Engine::OnTriggerStateProperState(efitick_t nowNt) {
365 }
366 
368  // Needed for early instant-RPM detection
370 
373 
374  for (size_t i = 0; i < efi::size(triggerCentral.vvtState); i++) {
375  for (size_t j = 0; j < efi::size(triggerCentral.vvtState[0]); j++) {
377  }
378  }
379 }
380 
381 void Engine::OnTriggerSynchronization(bool wasSynchronized, bool isDecodingError) {
382  // TODO: this logic probably shouldn't be part of engine.cpp
383 
384  // We only care about trigger shape once we have synchronized trigger. Anything could happen
385  // during first revolution and it's fine
386  if (wasSynchronized) {
387  enginePins.triggerDecoderErrorPin.setValue(isDecodingError);
388 
389  // 'triggerStateListener is not null' means we are running a real engine and now just preparing trigger shape
390  // that's a bit of a hack, a sweet OOP solution would be a real callback or at least 'needDecodingErrorLogic' method?
391  if (isDecodingError) {
392 #if EFI_PROD_CODE
394  efiPrintf("error: synchronizationPoint @ index %lu expected %d/%d got %d/%d",
400  }
401 #endif /* EFI_PROD_CODE */
402  }
403 
404  engine->triggerCentral.triggerErrorDetection.add(isDecodingError);
405  }
406 
407 }
408 #endif
409 
411 #if EFI_SHAFT_POSITION_INPUT
413  for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
415  }
416 #endif // EFI_SHAFT_POSITION_INPUT
417 }
418 
420 #if !EFI_UNIT_TEST
421 // huh should this be happy? static_assert(config != nullptr);
422 #endif
423  efi::clear(config);
424 
426 }
427 
428 /**
429  * This code asserts that we do not have unexpected gaps in time flow with the exception of internal flash burn.
430  */
431 static void assertTimeIsLinear() {
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 }
447 
450  if (isRunningPwmTest)
451  return;
452 
453 #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
454  if (module<PrimeController>()->isPriming() || triggerCentral.engineMovedRecently()) {
455  // do not invoke check in priming or if engine moved recently, no need to assert safe pin state.
456  return;
457  }
458 
460  if (!isRunningBenchTest() && enginePins.stopPins()) {
461  // todo: make this a firmwareError assuming functional tests would run
462  warning(ObdCode::CUSTOM_ERR_2ND_WATCHDOG, "Some pins were turned off by 2nd pass watchdog");
463  }
464  return;
465  }
466 
467  /**
468  * todo: better watch dog implementation should be implemented - see
469  * http://sourceforge.net/p/rusefi/tickets/96/
470  */
473 #endif // EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
474 }
475 
477 #if EFI_ENGINE_CONTROL
478  ignitionEvents.isReady = false;
479 #endif // EFI_ENGINE_CONTROL
480 
481 #if EFI_PROD_CODE || EFI_SIMULATOR
482  efiPrintf("Engine has stopped spinning.");
483 #endif
484 
485  // this invocation should be the last layer of defence in terms of making sure injectors/coils are not active
487 }
488 
490 #if EFI_MAIN_RELAY_CONTROL
491  // if we are already in the "ignition_on" mode, then do nothing
492 /* this logic is not alive
493  if (ignitionOnTimeNt > 0) {
494  return;
495  }
496 todo: move to shutdown_controller.cpp
497 */
498 
499  // here we are in the shutdown (the ignition is off) or initial mode (after the firmware fresh start)
500 /* this needs work or tests
501  const efitick_t engineStopWaitTimeoutUs = 500000LL; // 0.5 sec
502  // in shutdown mode, we need a small cooldown time between the ignition off and on
503 todo: move to shutdown_controller.cpp
504  if (stopEngineRequestTimeNt == 0 || (getTimeNowNt() - stopEngineRequestTimeNt) > US2NT(engineStopWaitTimeoutUs)) {
505  // if the ignition key is turned on again,
506  // we cancel the shutdown mode, but only if all shutdown procedures are complete
507  const float vBattThresholdOn = 8.0f;
508  // we fallback into zero instead of VBAT_FALLBACK_VALUE because it's not safe to false-trigger the "ignition on" event,
509  // and we want to turn on the main relay only when 100% sure.
510  if ((Sensor::getOrZero(SensorType::BatteryVoltage) > vBattThresholdOn) && !isInShutdownMode()) {
511  ignitionOnTimeNt = getTimeNowNt();
512  efiPrintf("Ignition voltage detected!");
513  if (stopEngineRequestTimeNt != 0) {
514  efiPrintf("Cancel the engine shutdown!");
515  stopEngineRequestTimeNt = 0;
516  }
517  }
518  }
519 */
520 #endif /* EFI_MAIN_RELAY_CONTROL */
521 }
522 
524  // TODO: this logic is currently broken
525 #if 0 && EFI_MAIN_RELAY_CONTROL && EFI_PROD_CODE
526  // if we are in "ignition_on" mode and not in shutdown mode
527  if (stopEngineRequestTimeNt == 0 && ignitionOnTimeNt > 0) {
528  const float vBattThresholdOff = 5.0f;
529  // start the shutdown process if the ignition voltage dropped low
530  if (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) <= vBattThresholdOff) {
532  }
533  }
534 
535  // we are not in the shutdown mode?
536  if (stopEngineRequestTimeNt == 0) {
537  return false;
538  }
539 
540  const efitick_t turnOffWaitTimeoutNt = NT_PER_SECOND;
541  // We don't want any transients to step in, so we wait at least 1 second whatever happens.
542  // Also it's good to give the stepper motor some time to start moving to the initial position (or parking)
543  if ((getTimeNowNt() - stopEngineRequestTimeNt) < turnOffWaitTimeoutNt)
544  return true;
545 
546  const efitick_t engineSpinningWaitTimeoutNt = 5 * NT_PER_SECOND;
547  // The engine is still spinning! Give it some time to stop (but wait no more than 5 secs)
548  if (isSpinning && (getTimeNowNt() - stopEngineRequestTimeNt) < engineSpinningWaitTimeoutNt)
549  return true;
550 
551  // The idle motor valve is still moving! Give it some time to park (but wait no more than 10 secs)
552  // Usually it can move to the initial 'cranking' position or zero 'parking' position.
553  const efitick_t idleMotorWaitTimeoutNt = 10 * NT_PER_SECOND;
554  if (isIdleMotorBusy() && (getTimeNowNt() - stopEngineRequestTimeNt) < idleMotorWaitTimeoutNt)
555  return true;
556 #endif /* EFI_MAIN_RELAY_CONTROL */
557  return false;
558 }
559 
561 #if EFI_MAIN_RELAY_CONTROL
563 #else
564  // if no main relay control, we assume it's always turned on
565  return true;
566 #endif /* EFI_MAIN_RELAY_CONTROL */
567 }
568 
571 }
572 
573 /**
574  * The idea of this method is to execute all heavy calculations in a lower-priority thread,
575  * so that trigger event handler/IO scheduler tasks are faster.
576  */
579 
580 #if EFI_MAP_AVERAGING
582 #endif
583 
585 
586  tachUpdate();
587  speedoUpdate();
588 
589  engine->engineModules.apply_all([](auto & m) { m.onFastCallback(); });
590 }
591 
593  return &engine->rpmCalculator;
594 }
595 
597  return &engine->engineState;
598 }
599 
601  return &engine->outputChannels;
602 }
603 
605  return &engine->executor;
606 }
607 
608 #if EFI_SHAFT_POSITION_INPUT
610  return &engine->triggerCentral;
611 }
612 #endif // EFI_SHAFT_POSITION_INPUT
613 
614 #if EFI_ENGINE_CONTROL
616  return &engine->module<LimpManager>().unmock();
617 }
618 
620  return &engine->injectionEvents;
621 }
622 
624  return &engine->ignitionEvents;
625 }
626 #endif // EFI_ENGINE_CONTROL
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition: adc_inputs.h:20
bool getAcToggle()
Definition: allsensors.cpp:19
bool hasAcToggle()
Definition: allsensors.cpp:23
const char * getVvt_mode_e(vvt_mode_e value)
Non-volatile backup-RAM registers support.
bool isRunningBenchTest()
Definition: bench_test.cpp:28
Utility methods related to bench testing.
TriggerCentral triggerCentral
Definition: engine.h:286
void resetLua()
Definition: engine.cpp:327
void updateSlowSensors()
Definition: engine.cpp:219
bool isFunctionalTestMode
Definition: engine.h:308
FuelSchedule injectionEvents
Definition: engine.h:258
IgnitionEventList ignitionEvents
Definition: engine.h:259
void onEngineHasStopped()
Definition: engine.cpp:476
IgnitionState ignitionState
Definition: engine.h:210
void periodicFastCallback()
Definition: engine.cpp:577
void checkShutdown()
Definition: engine.cpp:489
void preCalculate()
Definition: engine.cpp:350
int getGlobalConfigurationVersion(void) const
Definition: engine.cpp:315
bool slowCallBackWasInvoked
Definition: engine.h:271
bool isInShutdownMode() const
Definition: engine.cpp:523
void efiWatchdog()
Definition: engine.cpp:448
bool isMainRelayEnabled() const
Definition: engine.cpp:560
EngineState engineState
Definition: engine.h:312
void periodicSlowCallback()
Definition: engine.cpp:146
SwitchedState brakePedalSwitchedState
Definition: engine.h:187
void OnTriggerStateProperState(efitick_t nowNt) override
Definition: engine.cpp:363
RpmCalculator rpmCalculator
Definition: engine.h:273
void resetEngineSnifferIfInTestMode()
Definition: engine.cpp:56
SwitchedState clutchUpSwitchedState
Definition: engine.h:186
Engine()
Definition: engine.cpp:297
constexpr auto & module()
Definition: engine.h:177
SingleTimerExecutor executor
Definition: engine.h:241
int globalConfigurationVersion
Definition: engine.h:281
SwitchedState acButtonSwitchedState
Definition: engine.h:188
void setConfig()
Definition: engine.cpp:419
void OnTriggerSynchronization(bool wasSynchronized, bool isDecodingError) override
Definition: engine.cpp:381
void injectEngineReferences()
Definition: engine.cpp:410
type_list< Mockable< InjectorModelPrimary >, Mockable< InjectorModelSecondary >,#if EFI_IDLE_CONTROL Mockable< IdleController >,#endif TriggerScheduler,#if EFI_HPFP &&EFI_ENGINE_CONTROL HpfpController,#endif #if EFI_ENGINE_CONTROL Mockable< ThrottleModel >,#endif #if EFI_ALTERNATOR_CONTROL AlternatorController,#endif FuelPumpController, MainRelayController, IgnitionController, Mockable< AcController >, FanControl1, FanControl2, PrimeController, DfcoController,#if EFI_HD_ACR HarleyAcr,#endif Mockable< WallFuelController >,#if EFI_VEHICLE_SPEED GearDetector, TripOdometer,#endif KnockController, SensorChecker,#if EFI_ENGINE_CONTROL LimpManager,#endif #if EFI_VVT_PID VvtController1, VvtController2, VvtController3, VvtController4,#endif #if EFI_BOOST_CONTROL BoostController,#endif EngineModule > engineModules
Definition: engine.h:171
TunerStudioOutputChannels outputChannels
Definition: engine.h:99
void updateSwitchInputs()
Definition: engine.cpp:262
void reset()
Definition: engine.cpp:319
TpsAccelEnrichment tpsAccelEnrichment
Definition: engine.h:283
void updateTriggerWaveform()
Definition: engine.cpp:122
void OnTriggerSynchronizationLost() override
Definition: engine.cpp:367
Timer configBurnTimer
Definition: engine.h:275
bool isRunningPwmTest
Definition: engine.h:302
RegisteredOutputPin mainRelay
Definition: efi_gpio.h:76
OutputPin o2heater
Definition: efi_gpio.h:97
RegisteredOutputPin triggerDecoderErrorPin
Definition: efi_gpio.h:119
RegisteredOutputPin starterRelayDisable
Definition: efi_gpio.h:84
bool stopPins()
Definition: efi_gpio.cpp:215
virtual bool isCranking() const =0
angle_t engineCycle
Definition: engine_state.h:27
void updateSlowSensors()
Definition: engine2.cpp:84
void periodicFastCallback()
Definition: engine2.cpp:104
sensor_chart_e sensorChartMode
Definition: engine_state.h:32
bool getLogicValue() const
Definition: efi_gpio.cpp:645
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition: efi_gpio.cpp:581
void resetState() override
void setSpinningUp(efitick_t nowNt)
bool isRunning() const
virtual SensorResult get() const =0
virtual float getRaw() const
Definition: sensor.h:157
static float getOrZero(SensorType type)
Definition: sensor.h:92
bool update(bool newState)
Definition: efi_output.cpp:10
void onNewValue(float currentValue)
VvtTriggerDecoder vvtState[BANKS_COUNT][CAMS_PER_BANK]
InstantRpmCalculator instantRpm
PrimaryTriggerDecoder triggerState
bool engineMovedRecently(efitick_t nowNt) const
bool isSpinningJustForWatchdog
TriggerWaveform triggerShape
cyclic_buffer< int > triggerErrorDetection
VvtTriggerConfiguration vvtTriggerConfiguration[CAMS_PER_BANK]
PrimaryTriggerConfiguration primaryTriggerConfiguration
virtual void resetState()
current_cycle_state_s currentCycle
bool someSortOfTriggerError() const
size_t getExpectedEventCount(TriggerWheel channelIndex) const
rusEfi console sniffer data buffer
efitick_t pauseEngineSnifferUntilNt
void updateDynoView()
Definition: dynoview.cpp:147
EnginePins enginePins
Definition: efi_gpio.cpp:24
efitick_t getTimeNowNt()
Definition: efitime.cpp:19
efitimeus_t getTimeNowUs()
Definition: efitime.cpp:26
efitimesec_t getTimeNowS()
Current system time in seconds (32 bits)
Definition: efitime.cpp:42
efitimems_t getTimeNowMs()
Returns the 32 bit number of milliseconds since the board initialization.
Definition: efitime.cpp:34
int waveChartUsedSize
EngineRotationState * getEngineRotationState()
Definition: engine.cpp:592
bool getBrakePedalState()
Definition: engine.cpp:251
FuelSchedule * getFuelSchedule()
Definition: engine.cpp:619
LimpManager * getLimpManager()
Definition: engine.cpp:615
TunerStudioOutputChannels * getTunerStudioOutputChannels()
Definition: engine.cpp:600
static void assertTimeIsLinear()
Definition: engine.cpp:431
IgnitionEventList * getIgnitionEvents()
Definition: engine.cpp:623
static bool getClutchUpState()
Definition: engine.cpp:241
static void assertCloseTo(const char *msg, float actual, float expected)
Definition: engine.cpp:139
injection_mode_e getCurrentInjectionMode()
Definition: engine.cpp:569
trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode)
Definition: engine.cpp:69
bool getClutchDownState()
Definition: engine.cpp:231
ExecutorInterface * getExecutorInterface()
Definition: engine.cpp:604
EngineState * getEngineState()
Definition: engine.cpp:596
TriggerCentral * getTriggerCentral()
Definition: engine.cpp:609
WaveChart waveChart
void prepareOutputSignals()
Engine * engine
rusEfi console wave sniffer
trigger_type_e
Definition: engine_types.h:286
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
void updateGppwm()
Definition: gppwm.cpp:58
Idle Air Control valve hardware.
bool isIdleMotorBusy()
Idle Valve Control thread.
void pokeAuxDigital()
void baroLps25Update()
Definition: init_baro.cpp:19
bool efiReadPin(brain_pin_e pin)
Definition: io_pins.cpp:89
bool kAcRequestState
Definition: kline.cpp:31
void refreshMapAveragingPreCalc()
@ CUSTOM_ERR_2ND_WATCHDOG
@ WATCH_DOG_SECONDS
@ EnginePeriodicSlowCallback
@ EnginePeriodicFastCallback
persistent_config_s * config
engine_configuration_s * engineConfiguration
bool isBrainPinValid(brain_pin_e brainPin)
vvt_mode_e
Definition: rusefi_enums.h:124
@ FOUR_STROKE_CRANK_SENSOR
Definition: rusefi_enums.h:258
injection_mode_e
Definition: rusefi_enums.h:335
uint32_t efitimems_t
Definition: rusefi_types.h:44
acButtonState("AC switch", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1080, 1.0, -1.0, -1.0, "")
brakePedalState("Brake switch", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1164, 1.0, -1.0, -1.0, "")
clutchUpState("Clutch: up", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1162, 1.0, -1.0, -1.0, "")
void scheduleStopEngine()
Definition: settings.cpp:586
void tle8888startup()
Definition: smart_gpio.cpp:338
void speedoUpdate()
Definition: speedometer.cpp:9
size_t eventCount[PWM_PHASE_MAX_WAVE_PER_PWM]
void apply_all(func_t const &f)
Definition: type_list.h:43
void tachUpdate()
Definition: tachometer.cpp:31
composite packet size
fail("EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS") static_assert(sizeof(composite_logger_s)
void setTriggerEmulatorRPM(int rpm)
angle_t getEngineCycle(operation_mode_e operationMode)
static void updateVrThresholdPwm(int rpm, size_t index)
Definition: vr_pwm.cpp:13