rusEFI
The most advanced open source ECU
engine_controller.cpp
Go to the documentation of this file.
1 /**
2  * @file engine_controller.cpp
3  * @brief Controllers package entry point code
4  *
5  *
6  *
7  * @date Feb 7, 2013
8  * @author Andrey Belomutskiy, (c) 2012-2020
9  *
10  * This file is part of rusEfi - see http://rusefi.com
11  *
12  * rusEfi is free software; you can redistribute it and/or modify it under the terms of
13  * the GNU General Public License as published by the Free Software Foundation; either
14  * version 3 of the License, or (at your option) any later version.
15  *
16  * rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
17  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along with this program.
21  * If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "pch.h"
25 
26 
27 #include "trigger_central.h"
28 #include "script_impl.h"
29 #include "idle_thread.h"
30 #include "hardware.h"
31 #include "advance_map.h"
32 #include "main_trigger_callback.h"
33 #include "flash_main.h"
34 #include "bench_test.h"
35 #include "mmc_card.h"
36 #include "electronic_throttle.h"
37 #include "trigger_emulator_algo.h"
38 #include "map_averaging.h"
40 #include "malfunction_central.h"
41 #include "malfunction_indicator.h"
42 #include "speed_density.h"
43 #include "local_version_holder.h"
44 #include "alternator_controller.h"
45 #include "can_bench_test.h"
46 #include "engine_emulator.h"
47 #include "fuel_math.h"
48 #include "spark_logic.h"
49 #include "status_loop.h"
50 #include "aux_valves.h"
51 #include "accelerometer.h"
52 #include "vvt.h"
53 #include "boost_control.h"
54 #include "launch_control.h"
55 #include "tachometer.h"
56 #include "speedometer.h"
57 #include "gppwm.h"
58 #include "date_stamp.h"
59 #include "rusefi_lua.h"
60 #include "buttonshift.h"
61 #include "start_stop.h"
62 #include "dynoview.h"
63 #include "vr_pwm.h"
64 #include "adc_subscription.h"
65 #include "gc_generic.h"
66 
67 #if EFI_SENSOR_CHART
68 #include "sensor_chart.h"
69 #endif /* EFI_SENSOR_CHART */
70 
71 #if EFI_TUNER_STUDIO
72 #include "tunerstudio.h"
73 #endif /* EFI_TUNER_STUDIO */
74 
75 #if EFI_LOGIC_ANALYZER
76 #include "logic_analyzer.h"
77 #endif /* EFI_LOGIC_ANALYZER */
78 
79 #if defined(EFI_BOOTLOADER_INCLUDE_CODE)
80 #include "bootloader/bootloader.h"
81 #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
82 
83 #include "periodic_task.h"
84 
85 
86 #if ! EFI_UNIT_TEST
87 #include "init.h"
88 #include "mpu_util.h"
89 #endif /* EFI_UNIT_TEST */
90 
91 #if !EFI_UNIT_TEST
92 
93 /**
94  * Would love to pass reference to configuration object into constructor but C++ does allow attributes after parenthesized initializer
95  */
97 
98 #else // EFI_UNIT_TEST
99 
101 
102 #endif /* EFI_UNIT_TEST */
103 
104 
106 #if EFI_ENGINE_CONTROL
107  initFuelMap();
110  for (size_t i=0;i<efi::size(events.elements);i++) {
111  // above-zero value helps distinguish events
112  events.elements[i].sparkCounter = 1;
113  }
114  // above-zero value helps distinguish events
116 #endif // EFI_ENGINE_CONTROL
117 }
118 
119 #if !EFI_UNIT_TEST
120 
121 static void doPeriodicSlowCallback();
122 
123 class PeriodicFastController : public PeriodicTimerController {
124  void PeriodicTask() override {
126  }
127 
128  int getPeriodMs() override {
129  return FAST_CALLBACK_PERIOD_MS;
130  }
131 };
132 
133 class PeriodicSlowController : public PeriodicTimerController {
134  void PeriodicTask() override {
136  }
137 
138  int getPeriodMs() override {
139  // no reason to have this configurable, looks like everyone is happy with 20Hz
140  return SLOW_CALLBACK_PERIOD_MS;
141  }
142 };
143 
144 static PeriodicFastController fastController;
145 static PeriodicSlowController slowController;
146 
147 class EngineStateBlinkingTask : public PeriodicTimerController {
148  int getPeriodMs() override {
149  return 50;
150  }
151 
152  void PeriodicTask() override {
153 #if EFI_SHAFT_POSITION_INPUT
154  bool is_running = engine->rpmCalculator.isRunning();
155 #else
156  bool is_running = false;
157 #endif /* EFI_SHAFT_POSITION_INPUT */
158 
159  if (is_running) {
160  // blink in running mode
162  } else {
163  bool is_cranking = engine->rpmCalculator.isCranking();
164  enginePins.runningLedPin.setValue(is_cranking);
165  }
166  }
167 };
168 
169 static EngineStateBlinkingTask engineStateBlinkingTask;
170 
171 static void resetAccel() {
172  engine->module<TpsAccelEnrichment>()->resetAE();
173 
174 #if EFI_ENGINE_CONTROL
175  for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
176  {
178  }
179 #endif // EFI_ENGINE_CONTROL
180 }
181 
182 static void doPeriodicSlowCallback() {
183 #if EFI_SHAFT_POSITION_INPUT
184  efiAssertVoid(ObdCode::CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
185 
187 
189  if (engine->rpmCalculator.isStopped()) {
190  resetAccel();
191  }
192 #endif /* EFI_SHAFT_POSITION_INPUT */
193 
195 
196 #if EFI_SHAFT_POSITION_INPUT
198  /**
199  * rusEfi usually runs on hardware which halts execution while writing to internal flash, so we
200  * postpone writes to until engine is stopped. Writes in case of self-stimulation are fine.
201  *
202  * todo: allow writing if 2nd bank of flash is used
203  */
204 #if EFI_CONFIGURATION_STORAGE
206 #endif /* EFI_CONFIGURATION_STORAGE */
207  }
208 #else /* if EFI_SHAFT_POSITION_INPUT */
209  #if EFI_CONFIGURATION_STORAGE
211  #endif /* EFI_CONFIGURATION_STORAGE */
212 #endif /* EFI_SHAFT_POSITION_INPUT */
213 
214 #if EFI_TCU
216  if (engine->gearController == NULL) {
220  }
222  }
223 #endif // EFI_TCU
224 
226 }
227 
229  slowController.start();
230  fastController.start();
231 }
232 
233 char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize) {
234 #if HAL_USE_ADC
235  if (!isAdcChannelValid(hwChannel)) {
236  snprintf(buffer, bufferSize, "NONE");
237  } else {
238  const char *name = portname(getAdcChannelPort(msg, hwChannel));
239  snprintf(buffer, bufferSize, "%s%d", name ? name : "null", getAdcChannelPin(hwChannel));
240  }
241 #else
242  snprintf(buffer, bufferSize, "NONE");
243 #endif /* HAL_USE_ADC */
244  return buffer;
245 }
246 
247 #if EFI_PROD_CODE
248 static void printSensorInfo() {
249 #if HAL_USE_ADC
250  // Print info about analog mappings
252 #endif // HAL_USE_ADC
253 
254  // Print info about all sensors
256 }
257 #endif // EFI_PROD_CODE
258 
259 #define isOutOfBounds(offset) ((offset<0) || (offset) >= (int) sizeof(engine_configuration_s))
260 
261 static void getShort(int offset) {
262  if (isOutOfBounds(offset))
263  return;
264  uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
265  uint16_t value = *ptr;
266  /**
267  * this response is part of rusEfi console API
268  */
269  efiPrintf("short%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
270 }
271 
272 static void getByte(int offset) {
273  if (isOutOfBounds(offset))
274  return;
275  uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
276  uint8_t value = *ptr;
277  /**
278  * this response is part of rusEfi console API
279  */
280  efiPrintf("byte%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
281 }
282 
283 static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr) {
284  int offset = atoi(offsetStr);
285  if (absI(offset) == absI(ATOI_ERROR_CODE)) {
286  efiPrintf("invalid offset [%s]", offsetStr);
287  return;
288  }
289  if (isOutOfBounds(offset)) {
290  return;
291  }
292  int bit = atoi(bitStr);
293  if (absI(bit) == absI(ATOI_ERROR_CODE)) {
294  efiPrintf("invalid bit [%s]", bitStr);
295  return;
296  }
297  int value = atoi(valueStr);
298  if (absI(value) == absI(ATOI_ERROR_CODE)) {
299  efiPrintf("invalid value [%s]", valueStr);
300  return;
301  }
302  int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
303  *ptr ^= (-value ^ *ptr) & (1 << bit);
304  /**
305  * this response is part of rusEfi console API
306  */
307  efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
309 }
310 
311 static void setShort(const int offset, const int value) {
312  if (isOutOfBounds(offset))
313  return;
314  uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
315  *ptr = (uint16_t) value;
316  getShort(offset);
318 }
319 
320 static void setByte(const int offset, const int value) {
321  if (isOutOfBounds(offset))
322  return;
323  uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
324  *ptr = (uint8_t) value;
325  getByte(offset);
327 }
328 
329 static void getBit(int offset, int bit) {
330  if (isOutOfBounds(offset))
331  return;
332  int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
333  int value = (*ptr >> bit) & 1;
334  /**
335  * this response is part of rusEfi console API
336  */
337  efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
338 }
339 
340 static void getInt(int offset) {
341  if (isOutOfBounds(offset))
342  return;
343  int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
344  int value = *ptr;
345  /**
346  * this response is part of rusEfi console API
347  */
348  efiPrintf("int%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
349 }
350 
351 static void setInt(const int offset, const int value) {
352  if (isOutOfBounds(offset))
353  return;
354  int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
355  *ptr = value;
356  getInt(offset);
358 }
359 
360 static void getFloat(int offset) {
361  if (isOutOfBounds(offset))
362  return;
363  float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
364  float value = *ptr;
365  /**
366  * this response is part of rusEfi console API
367  */
368  efiPrintf("float%s%d is %.5f", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
369 }
370 
371 static void setFloat(const char *offsetStr, const char *valueStr) {
372  int offset = atoi(offsetStr);
373  if (absI(offset) == absI(ATOI_ERROR_CODE)) {
374  efiPrintf("invalid offset [%s]", offsetStr);
375  return;
376  }
377  if (isOutOfBounds(offset))
378  return;
379  float value = atoff(valueStr);
380  if (std::isnan(value)) {
381  efiPrintf("invalid value [%s]", valueStr);
382  return;
383  }
384  float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
385  *ptr = value;
386  getFloat(offset);
388 }
389 
390 static void initConfigActions() {
392  addConsoleActionII("set_int", (VoidIntInt) setInt);
393  addConsoleActionII("set_short", (VoidIntInt) setShort);
394  addConsoleActionII("set_byte", (VoidIntInt) setByte);
395  addConsoleActionSSS("set_bit", setBit);
396 
397  addConsoleActionI("get_float", getFloat);
398  addConsoleActionI("get_int", getInt);
399  addConsoleActionI("get_short", getShort);
400  addConsoleActionI("get_byte", getByte);
401  addConsoleActionII("get_bit", getBit);
402 }
403 #endif /* EFI_UNIT_TEST */
404 
405 // one-time start-up
406 // this method is used by real firmware and simulator and unit test
408 #if EFI_PROD_CODE
409  addConsoleAction("sensorinfo", printSensorInfo);
410  addConsoleAction("reset_accel", resetAccel);
411 #endif /* EFI_PROD_CODE */
412 
413 #if EFI_SIMULATOR || EFI_UNIT_TEST
414  printf("commonInitEngineController\n");
415 #endif
416 
417 #if !EFI_UNIT_TEST
419 #endif /* EFI_UNIT_TEST */
420 
421 #if EFI_ENGINE_CONTROL
422  /**
423  * This has to go after 'enginePins.startPins()' in order to
424  * properly detect un-assigned output pins
425  */
427 
429 #endif // EFI_ENGINE_CONTROL
430 
431 #if EFI_SENSOR_CHART
432  initSensorChart();
433 #endif /* EFI_SENSOR_CHART */
434 
435 #if EFI_PROD_CODE || EFI_SIMULATOR
436  initSettings();
437 
438  if (hasFirmwareError()) {
439  return;
440  }
441 #endif
442 
443 #if ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL
444  initBenchTest();
445 #endif /* ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL */
446 
447 #if EFI_ALTERNATOR_CONTROL
449 #endif /* EFI_ALTERNATOR_CONTROL */
450 
451 #if EFI_VVT_PID
453 #endif /* EFI_VVT_PID */
454 
455 #if EFI_MALFUNCTION_INDICATOR
457 #endif /* EFI_MALFUNCTION_INDICATOR */
458 
459 #if !EFI_UNIT_TEST
460  // This is tested independently - don't configure sensors for tests.
461  // This lets us selectively mock them for each test.
462  initNewSensors();
463 #endif /* EFI_UNIT_TEST */
464 
465  initSensors();
466 
468 
469  initScriptImpl();
470 
471  initGpPwm();
472 
473 #if EFI_IDLE_CONTROL
474  startIdleThread();
475 #endif /* EFI_IDLE_CONTROL */
476 
477 #if EFI_TCU
479 #endif
480 
482 
483 #if EFI_ELECTRONIC_THROTTLE_BODY
485 #endif /* EFI_ELECTRONIC_THROTTLE_BODY */
486 
487 #if EFI_MAP_AVERAGING
490  }
491 #endif /* EFI_MAP_AVERAGING */
492 
493 #if EFI_BOOST_CONTROL
494  initBoostCtrl();
495 #endif /* EFI_BOOST_CONTROL */
496 
497 #if EFI_LAUNCH_CONTROL
499 #endif
500 
502 
503 #if EFI_UNIT_TEST
505 #endif /* EFI_UNIT_TEST */
506 
507 #if EFI_AUX_VALVES
508  initAuxValves();
509 #endif /* EFI_AUX_VALVES */
510 
511  initTachometer();
512  initSpeedometer();
513 }
514 
515 PUBLIC_API_WEAK bool validateBoardConfig() {
516  return true;
517 }
518 
519 // Returns false if there's an obvious problem with the loaded configuration
521  if (!validateBoardConfig()) {
522  return false;
523  }
524  if (engineConfiguration->cylindersCount > MAX_CYLINDER_COUNT) {
525  criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount);
526  return false;
527  }
528  if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
529  criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
530  return false;
531  }
534  }
535 
537 
538 #if EFI_ENGINE_CONTROL
539  // Fueling
540  {
543 
544  ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
545  ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
546 
547  ensureArrayIsAscending("Fuel CLT mult", config->cltFuelCorrBins);
548  ensureArrayIsAscending("Fuel IAT mult", config->iatFuelCorrBins);
549 
552 
553  ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
554  ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
555 
559 
562 
565 
566  ensureArrayIsAscendingOrDefault("TPS TPS RPM correction", config->tpsTspCorrValuesBins);
567 
570  }
571 
572  // Ignition
573  {
575 
580 
581  ensureArrayIsAscending("Ignition CLT corr", config->cltTimingBins);
582 
583  ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrTempBins);
584  ensureArrayIsAscending("Ignition IAT corr Load", config->ignitionIatCorrLoadBins);
585  }
586 
589 #endif // EFI_ENGINE_CONTROL
590 
597 
598 // todo: huh? why does this not work on CI? ensureArrayIsAscendingOrDefault("Dwell Correction Voltage", engineConfiguration->dwellVoltageCorrVoltBins);
599 
600  ensureArrayIsAscending("MAF transfer function", config->mafDecodingBins);
601 
602  // Cranking tables
603  ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
604  ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
607 
608  // Idle tables
609  ensureArrayIsAscending("Idle target RPM", config->cltIdleRpmBins);
610  ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins);
615 
616  for (size_t index = 0; index < efi::size(engineConfiguration->vrThreshold); index++) {
617  auto& cfg = engineConfiguration->vrThreshold[index];
618 
619  if (cfg.pin == Gpio::Unassigned) {
620  continue;
621  }
622  ensureArrayIsAscending("VR threshold", cfg.rpmBins);
623  }
624 
625 #if EFI_BOOST_CONTROL
626  // Boost
627  ensureArrayIsAscending("Boost control Load", config->boostLoadBins);
628  ensureArrayIsAscending("Boost control RPM", config->boostRpmBins);
629 #endif // EFI_BOOST_CONTROL
630 
631 #if EFI_ANTILAG_SYSTEM
632  // ALS
637 #endif // EFI_ANTILAG_SYSTEM
638 
639 #if EFI_ELECTRONIC_THROTTLE_BODY
640  // ETB
643 #endif // EFI_ELECTRONIC_THROTTLE_BODY
644 
645  if (isGdiEngine()) {
649  ensureArrayIsAscending("HPFP target rpm", config->hpfpTargetRpmBins);
650  ensureArrayIsAscending("HPFP target load", config->hpfpTargetLoadBins);
651  }
652 
653  // VVT
655  ensureArrayIsAscending("VVT intake load", config->vvtTable1LoadBins);
656  ensureArrayIsAscending("VVT intake RPM", config->vvtTable1RpmBins);
657  }
658 
659 #if CAM_INPUTS_COUNT != 1
661  ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
662  ensureArrayIsAscending("VVT exhaust RPM", config->vvtTable2RpmBins);
663  }
664 #endif
665 
667  ensureArrayIsAscending("Oil pressure protection", config->minimumOilPressureBins);
668  }
669 
670  return true;
671 }
672 
673 #if !EFI_UNIT_TEST
674 
676  // Start this early - it will start LED blinking and such
678 
679 #if EFI_SHAFT_POSITION_INPUT
680  // todo: figure out better startup logic
682 #endif /* EFI_SHAFT_POSITION_INPUT */
683 
684  /**
685  * Initialize hardware drivers
686  */
687  initHardware();
688 
690 
691 #if EFI_FILE_LOGGING
692  initMmcCard();
693 #endif /* EFI_FILE_LOGGING */
694 
695 #if EFI_ENGINE_EMULATOR
697 #endif
698 
699 #if EFI_LUA
700  startLua();
701 #endif // EFI_LUA
702 
703 #if EFI_CAN_SERIAL
704  // needs to be called after initCan() inside initHardware()
705  startCanConsole();
706 #endif /* EFI_CAN_SERIAL */
707 
708 #if HW_CHECK_ALWAYS_STIMULATE
709  // we need a special binary for final assembly check. We cannot afford to require too much software or too many steps
710  // to be executed at the place of assembly
711  enableTriggerStimulator(/*incGlobalConfiguration*/false);
712 #endif // HW_CHECK_ALWAYS_STIMULATE
713 }
714 
715 // one-time start-up
719 
720 #if EFI_LOGIC_ANALYZER
723  }
724 #endif /* EFI_LOGIC_ANALYZER */
725 
726  if (hasFirmwareError()) {
727  return;
728  }
729 
730  engineStateBlinkingTask.start();
731 
733 }
734 
735 /**
736  * these two variables are here only to let us know how much RAM is available, also these
737  * help to notice when RAM usage goes up - if a code change adds to RAM usage these variables would fail
738  * linking process which is the way to raise the alarm
739  *
740  * You get "cannot move location counter backwards" linker error when you run out of RAM. When you run out of RAM you shall reduce these
741  * UNUSED_SIZE constants.
742  */
743 #ifndef RAM_UNUSED_SIZE
744 #define RAM_UNUSED_SIZE 17400
745 #endif
746 #ifndef CCM_UNUSED_SIZE
747 #define CCM_UNUSED_SIZE 512
748 #endif
749 static volatile char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE];
750 static volatile char UNUSED_CCM_SIZE[CCM_UNUSED_SIZE] CCM_OPTIONAL;
751 
752 /**
753  * See also SIGNATURE_HASH
754  */
756  if (UNUSED_RAM_SIZE[0] != 0)
757  return 123; // this is here to make the compiler happy about the unused array
758  if (UNUSED_CCM_SIZE[0] * 0 != 0)
759  return 3211; // this is here to make the compiler happy about the unused array
760 #if defined(EFI_BOOTLOADER_INCLUDE_CODE)
761  // make bootloader code happy too
762  if (initBootloader() != 0)
763  return 123;
764 #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
765  return VCS_DATE;
766 }
767 #endif /* EFI_UNIT_TEST */
void initAccelEnrichment()
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition: adc_inputs.h:20
void initIgnitionAdvanceControl()
void initSensors()
Definition: allsensors.cpp:14
void initAlternatorCtrl()
alternator controller
void tryResetWatchdog()
void initAuxValves()
Definition: aux_valves.cpp:56
void initBenchTest()
Definition: bench_test.cpp:640
Utility methods related to bench testing.
void initBoostCtrl()
void initQcBenchControls()
static void PrintInfo()
Definition: engine.h:91
TriggerCentral triggerCentral
Definition: engine.h:291
GearControllerBase * gearController
Definition: engine.h:186
FuelSchedule injectionEvents
Definition: engine.h:263
IgnitionEventList ignitionEvents
Definition: engine.h:264
void periodicFastCallback()
Definition: engine.cpp:579
EngineState engineState
Definition: engine.h:317
void periodicSlowCallback()
Definition: engine.cpp:148
RpmCalculator rpmCalculator
Definition: engine.h:280
constexpr auto & module()
Definition: engine.h:181
OutputPin runningLedPin
Definition: efi_gpio.h:106
InjectionEvent elements[MAX_CYLINDER_COUNT]
Definition: fuel_schedule.h:82
void addFuelEvents()
virtual void update()
virtual GearControllerMode getMode() const
WallFuel & getWallFuel()
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition: efi_gpio.cpp:588
void toggle()
Definition: efi_gpio.cpp:555
virtual int getPeriodMs()=0
virtual void PeriodicTask()=0
bool isStopped() const override
bool isRunning() const
bool isCranking() const override
bool Register()
Definition: sensor.cpp:131
static void showAllSensorInfo()
Definition: sensor.cpp:237
bool directSelfStimulation
void resetWF()
Definition: wall_fuel.cpp:10
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void addConsoleActionII(const char *token, VoidIntInt callback)
Register a console command with two Integer parameters.
void addConsoleActionSS(const char *token, VoidCharPtrCharPtr callback)
void addConsoleActionSSS(const char *token, VoidCharPtrCharPtrCharPtr callback)
void addConsoleActionI(const char *token, VoidInt callback)
Register a console command with one Integer parameter.
void(* VoidCharPtrCharPtr)(const char *, const char *)
Definition: cli_registry.h:68
void(* VoidIntInt)(int, int)
Definition: cli_registry.h:61
@ Unassigned
int getAdcChannelPin(adc_channel_e hwChannel)
ioportid_t getAdcChannelPort(const char *msg, adc_channel_e hwChannel)
void initButtonDebounce()
EnginePins enginePins
Definition: efi_gpio.cpp:24
const char * portname(ioportid_t GPIOx)
void ensureArrayIsAscendingOrDefault(const char *msg, const TValue(&values)[TSize])
void ensureArrayIsAscending(const char *msg, const TValue(&values)[TSize])
void initElectronicThrottle()
void prepareOutputSignals()
Engine ___engine
void incrementGlobalConfigurationVersion(const char *msg)
bool validateConfigOnStartUpOrBurn()
static PeriodicFastController fastController
Engine * engine
static void setFloat(const char *offsetStr, const char *valueStr)
PUBLIC_API_WEAK bool validateBoardConfig()
static void getShort(int offset)
static void printSensorInfo()
Engine ___engine CCM_OPTIONAL
static volatile char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE]
static void getFloat(int offset)
static PeriodicSlowController slowController
static void setByte(const int offset, const int value)
static EngineStateBlinkingTask engineStateBlinkingTask
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize)
static void setInt(const int offset, const int value)
void commonEarlyInit()
static void initConfigActions()
static void getByte(int offset)
void initPeriodicEvents()
static void doPeriodicSlowCallback()
void initDataStructures()
static void getBit(int offset, int bit)
static void setShort(const int offset, const int value)
static void getInt(int offset)
void initRealHardwareEngineController()
static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr)
void commonInitEngineController()
int getRusEfiVersion()
static void resetAccel()
void slowStartStopButtonCallback()
Definition: start_stop.cpp:56
void initEngineEmulator()
void writeToFlashIfPending()
Definition: flash_main.cpp:116
void initFuelMap()
Initialize fuel map data structure.
Definition: fuel_math.cpp:352
void initGearController()
void initGpPwm()
Definition: gppwm.cpp:31
void initHardware()
Definition: hardware.cpp:550
bool isGdiEngine()
Idle Valve Control thread.
void startIdleThread()
void initNewSensors()
void initLaunchControl()
void initWaveAnalyzer()
void startLua()
Definition: lua.cpp:386
Main logic header.
This data structure holds current malfunction codes.
void initMalfunctionIndicator(void)
We can blink out OBD-II error codes using Malfunction Indicator Light (MIL)
void initMapAveraging()
void initMmcCard()
Definition: mmc_card.cpp:636
@ CUSTOM_ERR_6661
persistent_config_s * config
engine_configuration_s * engineConfiguration
bool isBrainPinValid(brain_pin_e brainPin)
adc_channel_e
void initScriptImpl()
Definition: script_impl.cpp:82
void initSensorChart(void)
void initSettings()
Definition: settings.cpp:629
void initSpeedDensity()
void initSpeedometer()
Definition: speedometer.cpp:25
void startStatusThreads()
void initWarningRunningPins()
scaled_channel< uint16_t, 100, 1 > tractionControlSlipBins[TRACTION_CONTROL_ETB_DROP_SIZE]
uint8_t tractionControlSpeedBins[TRACTION_CONTROL_ETB_DROP_SIZE]
float battLagCorrBins[VBAT_INJECTOR_CURVE_SIZE]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileQuantityBins[HPFP_LOBE_PROFILE_SIZE]
scaled_channel< uint8_t, 1, 100 > iacCoastingRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint8_t, 1, 10 > idleVeRpmBins[IDLE_VE_SIZE]
scaled_channel< uint16_t, 1000, 1 > fuelLevelBins[FUEL_LEVEL_TABLE_COUNT]
scaled_channel< uint8_t, 1, 100 > pedalToTpsRpmBins[PEDAL_TO_TPS_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpTargetRpmBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 1, 50 > tpsTspCorrValuesBins[TPS_TPS_ACCEL_CLT_CORR_TABLE]
scaled_channel< int8_t, 1, 2 > cltIdleRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint8_t, 1, 100 > boostRpmBins[BOOST_RPM_COUNT]
scaled_channel< uint16_t, 100, 1 > mapEstimateTpsBins[FUEL_LOAD_COUNT]
scaled_channel< uint8_t, 1, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_SIZE]
scaled_channel< uint8_t, 1, 50 > idleAdvanceBins[IDLE_ADVANCE_CURVE_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpTargetLoadBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 1, 100 > minimumOilPressureBins[8]
scaled_channel< uint8_t, 1, 5 > ignitionIatCorrLoadBins[8]
void initTachometer()
Definition: tachometer.cpp:67
composite packet size
static std::vector< CompositeEvent > events
void initTriggerCentral()
void enableTriggerStimulator(bool incGlobalConfiguration)
static BigBufferHandle buffer
void startCanConsole()
printf("\n")
void initVrThresholdPwm()
Definition: vr_pwm.cpp:39
void initVvtActuators()
Definition: vvt.cpp:183