rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
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"
31#include "flash_main.h"
32#include "bench_test.h"
33#include "mmc_card.h"
34#include "electronic_throttle.h"
37#include "malfunction_central.h"
39#include "speed_density.h"
42#include "can_bench_test.h"
43#include "engine_emulator.h"
44#include "fuel_math.h"
45#include "defaults.h"
46#include "spark_logic.h"
47#include "status_loop.h"
48#include "aux_valves.h"
49#include "accelerometer.h"
50#include "vvt.h"
51#include "boost_control.h"
52#include "launch_control.h"
53#include "speedometer.h"
54#include "gppwm.h"
55#include "date_stamp.h"
56#include "rusefi_lua.h"
57#include "buttonshift.h"
58#include "start_stop.h"
59#include "dynoview.h"
60#include "vr_pwm.h"
61#include "adc_subscription.h"
62#include "gc_generic.h"
64
65
66#if EFI_TUNER_STUDIO
67#include "tunerstudio.h"
68#endif /* EFI_TUNER_STUDIO */
69
70#if EFI_LOGIC_ANALYZER
71#include "logic_analyzer.h"
72#endif /* EFI_LOGIC_ANALYZER */
73
74#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
75#include "bootloader/bootloader.h"
76#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
77
78#include "periodic_task.h"
79
80#ifdef MODULE_MAP_AVERAGING
81#include "map_averaging.h"
82#endif
83
84#if ! EFI_UNIT_TEST
85#include "init.h"
86#include "mpu_util.h"
87#endif /* EFI_UNIT_TEST */
88
89#if !EFI_UNIT_TEST
90
91/**
92 * Would love to pass reference to configuration object into constructor but C++ does allow attributes after parenthesized initializer
93 */
95
96#else // EFI_UNIT_TEST
97
99
100#endif /* EFI_UNIT_TEST */
101
102using namespace rusefi::stringutil;
103
105#if EFI_ENGINE_CONTROL
106 initFuelMap();
109 for (size_t i=0;i<efi::size(events.elements);i++) {
110 // above-zero value helps distinguish events
112 }
113 // above-zero value helps distinguish events
115#endif // EFI_ENGINE_CONTROL
116}
117
118#if !EFI_UNIT_TEST
119
120static void doPeriodicSlowCallback();
121
122class PeriodicFastController : public PeriodicTimerController {
123 void PeriodicTask() override {
125 }
126
127 int getPeriodMs() override {
128 return FAST_CALLBACK_PERIOD_MS;
129 }
130};
131
132class PeriodicSlowController : public PeriodicTimerController {
133 void PeriodicTask() override {
135 }
136
137 int getPeriodMs() override {
138 // no reason to have this configurable, looks like everyone is happy with 20Hz
139 return SLOW_CALLBACK_PERIOD_MS;
140 }
141};
142
143static PeriodicFastController fastController;
144static PeriodicSlowController slowController;
145
146class EngineStateBlinkingTask : public PeriodicTimerController {
147 int getPeriodMs() override {
148 return 50;
149 }
150
151 void PeriodicTask() override {
152#if EFI_SHAFT_POSITION_INPUT
153 bool is_running = engine->rpmCalculator.isRunning();
154#else
155 bool is_running = false;
156#endif /* EFI_SHAFT_POSITION_INPUT */
157
158 if (is_running) {
159 // blink in running mode
161 } else {
162 bool is_cranking = engine->rpmCalculator.isCranking();
163 enginePins.runningLedPin.setValue(is_cranking);
164 }
165 }
166};
167
168static EngineStateBlinkingTask engineStateBlinkingTask;
169
170static void resetAccel() {
171 engine->module<TpsAccelEnrichment>()->resetAE();
172
173#if EFI_ENGINE_CONTROL
174 for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
175 {
177 }
178#endif // EFI_ENGINE_CONTROL
179}
180
182#if EFI_SHAFT_POSITION_INPUT
183 efiAssertVoid(ObdCode::CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
184
186
189 resetAccel();
190 }
191#endif /* EFI_SHAFT_POSITION_INPUT */
192
194
195#if EFI_TCU
197 if (engine->gearController == NULL) {
201 }
203 }
204#endif // EFI_TCU
205
207}
208
210 slowController.start();
211 fastController.start();
212}
213
214char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize) {
215#if HAL_USE_ADC
216 if (!isAdcChannelValid(hwChannel)) {
217 snprintf(buffer, bufferSize, "NONE");
218 } else {
219 const char *name = portname(getAdcChannelPort(msg, hwChannel));
220 snprintf(buffer, bufferSize, "%s%d", name ? name : "null", getAdcChannelPin(hwChannel));
221 }
222#else
223 snprintf(buffer, bufferSize, "NONE");
224#endif /* HAL_USE_ADC */
225 return buffer;
226}
227
228#if EFI_PROD_CODE
229static void printSensorInfo() {
230#if HAL_USE_ADC
231 // Print info about analog mappings
233#endif // HAL_USE_ADC
234
235 // Print info about all sensors
237}
238#endif // EFI_PROD_CODE
239
240#define isOutOfBounds(offset) ((offset<0) || (offset) >= (int) sizeof(engine_configuration_s))
241
242static void getShort(int offset) {
243 if (isOutOfBounds(offset))
244 return;
245 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
246 uint16_t value = *ptr;
247 /**
248 * this response is part of rusEfi console API
249 */
250 efiPrintf("short%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
251}
252
253static void getByte(int offset) {
254 if (isOutOfBounds(offset))
255 return;
256 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
257 uint8_t value = *ptr;
258 /**
259 * this response is part of rusEfi console API
260 */
261 efiPrintf("byte%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
262}
263
264static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr) {
265 int offset = atoi(offsetStr);
266 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
267 efiPrintf("invalid offset [%s]", offsetStr);
268 return;
269 }
270 if (isOutOfBounds(offset)) {
271 return;
272 }
273 int bit = atoi(bitStr);
274 if (absI(bit) == absI(ATOI_ERROR_CODE)) {
275 efiPrintf("invalid bit [%s]", bitStr);
276 return;
277 }
278 int value = atoi(valueStr);
279 if (absI(value) == absI(ATOI_ERROR_CODE)) {
280 efiPrintf("invalid value [%s]", valueStr);
281 return;
282 }
283 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
284 *ptr ^= (-value ^ *ptr) & (1 << bit);
285 /**
286 * this response is part of rusEfi console API
287 */
288 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
290}
291
292static void setShort(const int offset, const int value) {
293 if (isOutOfBounds(offset))
294 return;
295 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
296 *ptr = (uint16_t) value;
299}
300
301static void setByte(const int offset, const int value) {
302 if (isOutOfBounds(offset))
303 return;
304 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
305 *ptr = (uint8_t) value;
308}
309
310static void getBit(int offset, int bit) {
311 if (isOutOfBounds(offset))
312 return;
313 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
314 int value = (*ptr >> bit) & 1;
315 /**
316 * this response is part of rusEfi console API
317 */
318 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
319}
320
321static void getInt(int offset) {
322 if (isOutOfBounds(offset))
323 return;
324 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
325 int value = *ptr;
326 /**
327 * this response is part of rusEfi console API
328 */
329 efiPrintf("int%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
330}
331
332static void setInt(const int offset, const int value) {
333 if (isOutOfBounds(offset))
334 return;
335 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
336 *ptr = value;
337 getInt(offset);
339}
340
341static void getFloat(int offset) {
342 if (isOutOfBounds(offset))
343 return;
344 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
345 float value = *ptr;
346 /**
347 * this response is part of rusEfi console API
348 */
349 efiPrintf("float%s%d is %.5f", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
350}
351
352static void setFloat(const char *offsetStr, const char *valueStr) {
353 int offset = atoi(offsetStr);
354 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
355 efiPrintf("invalid offset [%s]", offsetStr);
356 return;
357 }
358 if (isOutOfBounds(offset))
359 return;
360 float value = atoff(valueStr);
361 if (std::isnan(value)) {
362 efiPrintf("invalid value [%s]", valueStr);
363 return;
364 }
365 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
366 *ptr = value;
369}
370
371static void initConfigActions() {
374 addConsoleActionII("set_short", (VoidIntInt) setShort);
376 addConsoleActionSSS("set_bit", setBit);
377
378 addConsoleActionI("get_float", getFloat);
379 addConsoleActionI("get_int", getInt);
380 addConsoleActionI("get_short", getShort);
381 addConsoleActionI("get_byte", getByte);
382 addConsoleActionII("get_bit", getBit);
383}
384#endif /* EFI_UNIT_TEST */
385
386// one-time start-up
387// this method is used by real firmware and simulator and unit test
389#if EFI_PROD_CODE
390 addConsoleAction("sensorinfo", printSensorInfo);
391 addConsoleAction("reset_accel", resetAccel);
392#endif /* EFI_PROD_CODE */
393
394#if EFI_SIMULATOR || EFI_UNIT_TEST
395 printf("commonInitEngineController\n");
396#endif
397
398#if !EFI_UNIT_TEST
400#endif /* EFI_UNIT_TEST */
401
402#if EFI_ENGINE_CONTROL
403 /**
404 * This has to go after 'enginePins.startPins()' in order to
405 * properly detect un-assigned output pins
406 */
408
410#endif // EFI_ENGINE_CONTROL
411
412
413#if EFI_PROD_CODE || EFI_SIMULATOR
414 initSettings();
415
416 if (hasFirmwareError()) {
417 return;
418 }
419#endif
420
421#if ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL
423#endif /* ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL */
424
425#if EFI_ALTERNATOR_CONTROL
427#endif /* EFI_ALTERNATOR_CONTROL */
428
429#if EFI_VVT_PID
431#endif /* EFI_VVT_PID */
432
433#if EFI_MALFUNCTION_INDICATOR
435#endif /* EFI_MALFUNCTION_INDICATOR */
436
437#if !EFI_UNIT_TEST
438 // This is tested independently - don't configure sensors for tests.
439 // This lets us selectively mock them for each test.
441#endif /* EFI_UNIT_TEST */
442
443 initSensors();
444
446
448
449 initGpPwm();
450
451#if EFI_IDLE_CONTROL
453#endif /* EFI_IDLE_CONTROL */
454
455#if EFI_TCU
457#endif
458
460
461#if EFI_ELECTRONIC_THROTTLE_BODY
463#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
464
465#if EFI_MAP_AVERAGING && defined (MODULE_MAP_AVERAGING)
466 engine->module<MapAveragingModule>()->init();
467#else
468 efiPrintf("No MapAveraging support!");
469#endif /* EFI_MAP_AVERAGING */
470
471#if EFI_BOOST_CONTROL
473#endif /* EFI_BOOST_CONTROL */
474
475#if EFI_LAUNCH_CONTROL
477#endif
478
480
481#if EFI_UNIT_TEST
483#endif /* EFI_UNIT_TEST */
484
485#if EFI_AUX_VALVES
487#endif /* EFI_AUX_VALVES */
488
489#ifdef MODULE_TACHOMETER
490 engine->module<TachometerModule>()->init();
491#endif
492
494
495 initStft();
496#if EFI_LTFT_CONTROL
497 initLtft();
498#endif
499}
500
501PUBLIC_API_WEAK bool validateBoardConfig() {
502 return true;
503}
504
505static bool validateGdi() {
506 auto lobes = engineConfiguration->hpfpCamLobes;
507 if (!lobes) {
508 return true;
509 }
510 int expectedLastLobeProfileAngle = 360 / lobes;
511 float actualLastAngle = config->hpfpLobeProfileAngle[efi::size(config->hpfpLobeProfileAngle) - 1];
512 if (expectedLastLobeProfileAngle != actualLastAngle) {
513 criticalError("Last HPFP angle expected %d got %f", expectedLastLobeProfileAngle, actualLastAngle);
514 return false;
515 }
516
517 return true;
518}
519
520// Returns false if there's an obvious problem with the loaded configuration
522 if (!validateBoardConfig()) {
523 return false;
524 }
525 if (!validateGdi()) {
526 return false;
527 }
529 criticalError("Broken ETB min/max %d %d",
532 return false;
533 }
534
536 if (engineConfiguration->cylindersCount > MAX_CYLINDER_COUNT) {
537 criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount);
538 return false;
539 }
540#if EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
541 float maxConfiguredCorr = config->dwellVoltageCorrValues[0];
542 for (size_t i = 0;i<efi::size(config->dwellVoltageCorrValues);i++) {
543 maxConfiguredCorr = std::max(maxConfiguredCorr, (float)config->dwellVoltageCorrValues[i]);
544 }
545 float maxConfiguredDwell = config->sparkDwellValues[0];
546 for (size_t i = 0;i<efi::size(config->sparkDwellValues);i++) {
547 maxConfiguredDwell = std::max(maxConfiguredDwell, (float)config->sparkDwellValues[i]);
548 }
550 if (maxConfiguredCorr * maxConfiguredDwell > maxAllowedDwell) {
551 criticalError("Dwell=%.2f/corr=%.2f while 33810 limit %d", maxConfiguredDwell, maxConfiguredCorr, maxAllowedDwell);
552 }
553
554#endif // EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
555 if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
556 criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
557 return false;
558 }
559
562
563#if EFI_ENGINE_CONTROL
564 // Fueling
565 {
568
569 ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
570 ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
571
574
577
578 ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
579 ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
580
582
585
588
591
593
596 }
597
598 // Ignition
599 {
601
606
607 ensureArrayIsAscending("Ignition CLT corr CLT", config->ignitionCltCorrTempBins);
608 ensureArrayIsAscending("Ignition CLT corr Load", config->ignitionCltCorrLoadBins);
609
610 ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrTempBins);
611 ensureArrayIsAscending("Ignition IAT corr Load", config->ignitionIatCorrLoadBins);
612 }
613
616#endif // EFI_ENGINE_CONTROL
617
624
625// todo: huh? why does this not work on CI? ensureArrayIsAscendingOrDefault("Dwell Correction Voltage", engineConfiguration->dwellVoltageCorrVoltBins);
626
627 ensureArrayIsAscending("MAF transfer function", config->mafDecodingBins);
628
629 // Cranking tables
630 ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
631 ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
634
635 // Idle tables
636 ensureArrayIsAscending("Idle target RPM", config->cltIdleRpmBins);
637 ensureArrayIsAscending("Idle warmup mult CLT", config->cltIdleCorrBins);
638 ensureArrayIsAscending("Idle warmup mult RPM", config->rpmIdleCorrBins);
643
644 for (size_t index = 0; index < efi::size(engineConfiguration->vrThreshold); index++) {
645 auto& cfg = engineConfiguration->vrThreshold[index];
646
647 if (cfg.pin == Gpio::Unassigned) {
648 continue;
649 }
650 ensureArrayIsAscending("VR threshold", cfg.rpmBins);
651 }
652
653#if EFI_BOOST_CONTROL
654 // Boost
655 ensureArrayIsAscending("Boost control Load [open loop]", config->boostOpenLoopLoadBins);
656 ensureArrayIsAscending("Boost control Load [closed loop]", config->boostClosedLoopLoadBins);
657 ensureArrayIsAscending("Boost control RPM [open+closed loop]", config->boostRpmBins);
658#endif // EFI_BOOST_CONTROL
659
660#if EFI_ANTILAG_SYSTEM
661 // ALS
666#endif // EFI_ANTILAG_SYSTEM
667
668#if EFI_ELECTRONIC_THROTTLE_BODY
669 // ETB
672#endif // EFI_ELECTRONIC_THROTTLE_BODY
673
674 if (isGdiEngine()) {
680
681 ensureArrayIsAscending("HPFP fuel mass compensation fuel pressure", config->hpfpFuelMassCompensationFuelPressure);
682 ensureArrayIsAscending("HPFP fuel mass compensation fuel mass", config->hpfpFuelMassCompensationFuelMass);
683
684 }
685
686 // VVT
690 }
691
692#if CAM_INPUTS_COUNT != 1
694 ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
696 }
697#endif
698
700 ensureArrayIsAscending("Oil pressure protection", config->minimumOilPressureBins);
701 }
702
703 return true;
704}
705
706#if !EFI_UNIT_TEST
707
709 // Start this early - it will start LED blinking and such
711
712#if EFI_SHAFT_POSITION_INPUT
713 // todo: figure out better startup logic
715#endif /* EFI_SHAFT_POSITION_INPUT */
716
717 /**
718 * Initialize hardware drivers
719 */
720 initHardware();
721
723
724#if EFI_FILE_LOGGING
725 initMmcCard();
726#endif /* EFI_FILE_LOGGING */
727
728#if EFI_ENGINE_EMULATOR
730#endif
731
732#if EFI_LUA
733 startLua();
734#endif // EFI_LUA
735
736#if EFI_CAN_SERIAL
737 // needs to be called after initCan() inside initHardware()
739#endif /* EFI_CAN_SERIAL */
740
741}
742
743// one-time start-up
747
748#if EFI_LOGIC_ANALYZER
751 }
752#endif /* EFI_LOGIC_ANALYZER */
753
754 if (hasFirmwareError()) {
755 return;
756 }
757
759
761}
762
763/**
764 * See also SIGNATURE_HASH
765 */
767#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
768 // make bootloader code happy too
769 if (initBootloader() != 0)
770 return 123;
771#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
772 return VCS_DATE;
773}
774#endif /* EFI_UNIT_TEST */
void initAccelEnrichment()
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
void initIgnitionAdvanceControl()
void initSensors()
void initAlternatorCtrl()
alternator controller
void tryResetWatchdog()
void initAuxValves()
void initBenchTest()
Utility methods related to bench testing.
void initBoostCtrl()
void initQcBenchControls()
static void PrintInfo()
GearControllerBase * gearController
Definition engine.h:210
FuelSchedule injectionEvents
Definition engine.h:288
IgnitionEventList ignitionEvents
Definition engine.h:289
void periodicFastCallback()
Definition engine.cpp:556
EngineState engineState
Definition engine.h:344
void periodicSlowCallback()
Definition engine.cpp:150
RpmCalculator rpmCalculator
Definition engine.h:306
constexpr auto & module()
Definition engine.h:200
OutputPin runningLedPin
Definition efi_gpio.h:108
InjectionEvent elements[MAX_CYLINDER_COUNT]
virtual void update()
virtual GearControllerMode getMode() const
uint32_t sparkCounter
IgnitionEvent elements[MAX_CYLINDER_COUNT]
WallFuel & getWallFuel()
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
void toggle()
Definition efi_gpio.cpp:571
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
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 *)
void(* VoidIntInt)(int, int)
void initStft(void)
@ Unassigned
int getAdcChannelPin(adc_channel_e hwChannel)
ioportid_t getAdcChannelPort(const char *msg, adc_channel_e hwChannel)
void initButtonDebounce()
void defaultsOrFixOnBurn()
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)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
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()
static void getFloat(int offset)
static PeriodicSlowController slowController
static void setByte(const int offset, const int value)
static EngineStateBlinkingTask engineStateBlinkingTask
static void setInt(const int offset, const int value)
void commonEarlyInit()
static void initConfigActions()
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize)
static void getByte(int offset)
void initPeriodicEvents()
static void doPeriodicSlowCallback()
void initDataStructures()
static bool validateGdi()
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()
Engine ___engine CCM_OPTIONAL
void slowStartStopButtonCallback()
void initEngineEmulator()
void initFuelMap()
Initialize fuel map data structure.
void initGearController()
void initGpPwm()
Definition gppwm.cpp:31
void initHardware()
Definition hardware.cpp:538
bool isGdiEngine()
Idle Valve Control thread.
void startIdleThread()
void initNewSensors()
void initLaunchControl()
void initWaveAnalyzer()
void initLtft()
void startLua()
Definition lua.cpp:281
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)
int getMc33810maxDwellTimer(mc33810maxDwellTimer_e value)
Definition mc33810.cpp:1003
void initMmcCard()
@ CUSTOM_ERR_6661
bool isBrainPinValid(brain_pin_e brainPin)
void initScriptImpl()
void initSettings()
Definition settings.cpp:633
void initSpeedDensity()
void initSpeedometer()
void startStatusThreads()
void initWarningRunningPins()
uint8_t tractionControlSpeedBins[TRACTION_CONTROL_ETB_DROP_SPEED_SIZE]
scaled_channel< uint16_t, 100, 1 > tractionControlSlipBins[TRACTION_CONTROL_ETB_DROP_SLIP_SIZE]
scaled_channel< int16_t, 100, 1 > battLagCorrBattBins[VBAT_INJECTOR_CURVE_SIZE]
scaled_channel< uint32_t, 10, 1 > battLagCorrPressBins[VBAT_INJECTOR_CURVE_PRESSURE_SIZE]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileQuantityBins[HPFP_LOBE_PROFILE_SIZE]
scaled_channel< int16_t, 1, 1 > cltIdleRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint8_t, 1, 100 > iacCoastingRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpFuelMassCompensationFuelPressure[HPFP_FUEL_MASS_COMPENSATION_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, 50 > hpfpTargetRpmBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 50, 1 > dwellVoltageCorrValues[DWELL_CURVE_SIZE]
scaled_channel< uint8_t, 1, 50 > tpsTspCorrValuesBins[TPS_TPS_ACCEL_CLT_CORR_TABLE]
scaled_channel< uint16_t, 100, 1 > mapEstimateTpsBins[MAP_EST_LOAD_COUNT]
scaled_channel< uint8_t, 1, 100 > boostRpmBins[BOOST_RPM_COUNT]
scaled_channel< int16_t, 1, 1 > ignitionCltCorrTempBins[CLT_TIMING_CURVE_SIZE]
scaled_channel< uint8_t, 1, 100 > rpmIdleCorrBins[CLT_IDLE_TABLE_RPM_SIZE]
scaled_channel< uint8_t, 1, 100 > pedalToTpsRpmBins[PEDAL_TO_TPS_RPM_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_SIZE]
scaled_channel< uint8_t, 1, 50 > idleAdvanceBins[IDLE_ADVANCE_CURVE_SIZE]
scaled_channel< uint8_t, 1, 5 > ignitionIatCorrLoadBins[IAT_IGN_CORR_LOAD_COUNT]
scaled_channel< uint16_t, 100, 1 > hpfpFuelMassCompensationFuelMass[HPFP_FUEL_MASS_COMPENSATION_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpTargetLoadBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 1, 100 > minimumOilPressureBins[8]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileAngle[HPFP_LOBE_PROFILE_SIZE]
scaled_channel< uint16_t, 100, 1 > sparkDwellValues[DWELL_CURVE_SIZE]
scaled_channel< uint8_t, 1, 5 > ignitionCltCorrLoadBins[CLT_TIMING_CURVE_SIZE]
static std::vector< CompositeEvent > events
void initTriggerCentral()
static BigBufferHandle buffer
void startCanConsole()
uint16_t offset
Definition tunerstudio.h:0
printf("\n")
void initVrThresholdPwm()
Definition vr_pwm.cpp:39
void initVvtActuators()
Definition vvt.cpp:192