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"
63
64#if EFI_TUNER_STUDIO
65#include "tunerstudio.h"
66#endif /* EFI_TUNER_STUDIO */
67
68#if EFI_LOGIC_ANALYZER
69#include "logic_analyzer.h"
70#endif /* EFI_LOGIC_ANALYZER */
71
72#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
73#include "bootloader/bootloader.h"
74#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
75
76#include "periodic_task.h"
77
78#ifdef MODULE_MAP_AVERAGING
79#include "map_averaging.h"
80#endif
81
82#if ! EFI_UNIT_TEST
83#include "init.h"
84#include "mpu_util.h"
85#endif /* EFI_UNIT_TEST */
86
87#if !EFI_UNIT_TEST
88
89/**
90 * Would love to pass reference to configuration object into constructor but C++ does allow attributes after parenthesized initializer
91 */
93
94#else // EFI_UNIT_TEST
95
97
98#endif /* EFI_UNIT_TEST */
99
100using namespace rusefi::stringutil;
101
103#if EFI_ENGINE_CONTROL
104 initFuelMap();
107 for (size_t i=0;i<efi::size(events.elements);i++) {
108 // above-zero value helps distinguish events
110 }
111 // above-zero value helps distinguish events
113#endif // EFI_ENGINE_CONTROL
114}
115
116#if !EFI_UNIT_TEST
117
118static void doPeriodicSlowCallback();
119
120class PeriodicFastController : public PeriodicTimerController {
121 void PeriodicTask() override {
123 }
124
125 int getPeriodMs() override {
126 return FAST_CALLBACK_PERIOD_MS;
127 }
128};
129
130class PeriodicSlowController : public PeriodicTimerController {
131 void PeriodicTask() override {
133 }
134
135 int getPeriodMs() override {
136 // no reason to have this configurable, looks like everyone is happy with 20Hz
137 return SLOW_CALLBACK_PERIOD_MS;
138 }
139};
140
141static PeriodicFastController fastController;
142static PeriodicSlowController slowController;
143
144class EngineStateBlinkingTask : public PeriodicTimerController {
145 int getPeriodMs() override {
146 return 50;
147 }
148
149 void PeriodicTask() override {
150#if EFI_SHAFT_POSITION_INPUT
151 bool is_running = engine->rpmCalculator.isRunning();
152#else
153 bool is_running = false;
154#endif /* EFI_SHAFT_POSITION_INPUT */
155
156 if (is_running) {
157 // blink in running mode
159 } else {
160 bool is_cranking = engine->rpmCalculator.isCranking();
161 enginePins.runningLedPin.setValue(is_cranking);
162 }
163 }
164};
165
166static EngineStateBlinkingTask engineStateBlinkingTask;
167
168static void resetAccel() {
169 engine->module<TpsAccelEnrichment>()->resetAE();
170
171#if EFI_ENGINE_CONTROL
172 for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
173 {
175 }
176#endif // EFI_ENGINE_CONTROL
177}
178
180#if EFI_SHAFT_POSITION_INPUT
181 efiAssertVoid(ObdCode::CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
182
184
187 resetAccel();
188 }
189#endif /* EFI_SHAFT_POSITION_INPUT */
190
192
193#if EFI_TCU
195 if (engine->gearController == NULL) {
199 }
201 }
202#endif // EFI_TCU
203
205}
206
208 slowController.start();
209 fastController.start();
210}
211
212char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize) {
213#if HAL_USE_ADC
214 if (!isAdcChannelValid(hwChannel)) {
215 snprintf(buffer, bufferSize, "NONE");
216 } else {
217 const char *name = portname(getAdcChannelPort(msg, hwChannel));
218 snprintf(buffer, bufferSize, "%s%d", name ? name : "null", getAdcChannelPin(hwChannel));
219 }
220#else
221 snprintf(buffer, bufferSize, "NONE");
222#endif /* HAL_USE_ADC */
223 return buffer;
224}
225
226#if EFI_PROD_CODE
227static void printSensorInfo() {
228#if HAL_USE_ADC
229 // Print info about analog mappings
231#endif // HAL_USE_ADC
232
233 // Print info about all sensors
235}
236#endif // EFI_PROD_CODE
237
238#define isOutOfBounds(offset) ((offset<0) || (offset) >= (int) sizeof(engine_configuration_s))
239
240static void getShort(int offset) {
241 if (isOutOfBounds(offset))
242 return;
243 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
244 uint16_t value = *ptr;
245 /**
246 * this response is part of rusEfi console API
247 */
248 efiPrintf("short%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
249}
250
251static void getByte(int offset) {
252 if (isOutOfBounds(offset))
253 return;
254 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
255 uint8_t value = *ptr;
256 /**
257 * this response is part of rusEfi console API
258 */
259 efiPrintf("byte%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
260}
261
262static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr) {
263 int offset = atoi(offsetStr);
264 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
265 efiPrintf("invalid offset [%s]", offsetStr);
266 return;
267 }
268 if (isOutOfBounds(offset)) {
269 return;
270 }
271 int bit = atoi(bitStr);
272 if (absI(bit) == absI(ATOI_ERROR_CODE)) {
273 efiPrintf("invalid bit [%s]", bitStr);
274 return;
275 }
276 int value = atoi(valueStr);
277 if (absI(value) == absI(ATOI_ERROR_CODE)) {
278 efiPrintf("invalid value [%s]", valueStr);
279 return;
280 }
281 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
282 *ptr ^= (-value ^ *ptr) & (1 << bit);
283 /**
284 * this response is part of rusEfi console API
285 */
286 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
288}
289
290static void setShort(const int offset, const int value) {
291 if (isOutOfBounds(offset))
292 return;
293 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
294 *ptr = (uint16_t) value;
297}
298
299static void setByte(const int offset, const int value) {
300 if (isOutOfBounds(offset))
301 return;
302 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
303 *ptr = (uint8_t) value;
306}
307
308static void getBit(int offset, int bit) {
309 if (isOutOfBounds(offset))
310 return;
311 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
312 int value = (*ptr >> bit) & 1;
313 /**
314 * this response is part of rusEfi console API
315 */
316 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
317}
318
319static void getInt(int offset) {
320 if (isOutOfBounds(offset))
321 return;
322 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
323 int value = *ptr;
324 /**
325 * this response is part of rusEfi console API
326 */
327 efiPrintf("int%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
328}
329
330static void setInt(const int offset, const int value) {
331 if (isOutOfBounds(offset))
332 return;
333 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
334 *ptr = value;
335 getInt(offset);
337}
338
339static void getFloat(int offset) {
340 if (isOutOfBounds(offset))
341 return;
342 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
343 float value = *ptr;
344 /**
345 * this response is part of rusEfi console API
346 */
347 efiPrintf("float%s%d is %.5f", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
348}
349
350static void setFloat(const char *offsetStr, const char *valueStr) {
351 int offset = atoi(offsetStr);
352 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
353 efiPrintf("invalid offset [%s]", offsetStr);
354 return;
355 }
356 if (isOutOfBounds(offset))
357 return;
358 float value = atoff(valueStr);
359 if (std::isnan(value)) {
360 efiPrintf("invalid value [%s]", valueStr);
361 return;
362 }
363 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
364 *ptr = value;
367}
368
369static void initConfigActions() {
372 addConsoleActionII("set_short", (VoidIntInt) setShort);
374 addConsoleActionSSS("set_bit", setBit);
375
376 addConsoleActionI("get_float", getFloat);
377 addConsoleActionI("get_int", getInt);
378 addConsoleActionI("get_short", getShort);
379 addConsoleActionI("get_byte", getByte);
380 addConsoleActionII("get_bit", getBit);
381}
382#endif /* EFI_UNIT_TEST */
383
384// one-time start-up
385// this method is used by real firmware and simulator and unit test
387#if EFI_PROD_CODE
388 addConsoleAction("sensorinfo", printSensorInfo);
389 addConsoleAction("reset_accel", resetAccel);
390#endif /* EFI_PROD_CODE */
391
392#if EFI_SIMULATOR || EFI_UNIT_TEST
393 printf("commonInitEngineController\n");
394#endif
395
396#if !EFI_UNIT_TEST
398#endif /* EFI_UNIT_TEST */
399
400#if EFI_ENGINE_CONTROL
401 /**
402 * This has to go after 'enginePins.startPins()' in order to
403 * properly detect un-assigned output pins
404 */
406
408#endif // EFI_ENGINE_CONTROL
409
410
411#if EFI_PROD_CODE || EFI_SIMULATOR
412 initSettings();
413
414 if (hasFirmwareError()) {
415 return;
416 }
417#endif
418
419#if ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL
421#endif /* ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL */
422
423#if EFI_ALTERNATOR_CONTROL
425#endif /* EFI_ALTERNATOR_CONTROL */
426
427#if EFI_VVT_PID
429#endif /* EFI_VVT_PID */
430
431#if EFI_MALFUNCTION_INDICATOR
433#endif /* EFI_MALFUNCTION_INDICATOR */
434
435#if !EFI_UNIT_TEST
436 // This is tested independently - don't configure sensors for tests.
437 // This lets us selectively mock them for each test.
439#endif /* EFI_UNIT_TEST */
440
441 initSensors();
442
444
446
447 initGpPwm();
448
449#if EFI_IDLE_CONTROL
451#endif /* EFI_IDLE_CONTROL */
452
453#if EFI_TCU
455#endif
456
458
459#if EFI_ELECTRONIC_THROTTLE_BODY
461#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
462
463#if EFI_MAP_AVERAGING && defined (MODULE_MAP_AVERAGING)
464 engine->module<MapAveragingModule>()->init();
465#else
466 efiPrintf("No MapAveraging support!");
467#endif /* EFI_MAP_AVERAGING */
468
469#if EFI_BOOST_CONTROL
471#endif /* EFI_BOOST_CONTROL */
472
473#if EFI_LAUNCH_CONTROL
475#endif
476
478
479#if EFI_UNIT_TEST
481#endif /* EFI_UNIT_TEST */
482
483#if EFI_AUX_VALVES
485#endif /* EFI_AUX_VALVES */
486
487#ifdef MODULE_TACHOMETER
488 engine->module<TachometerModule>()->init();
489#endif
490
492
493 initStft();
494#if EFI_LTFT_CONTROL
495 initLtft();
496#endif
497}
498
499PUBLIC_API_WEAK bool validateBoardConfig() {
500 return true;
501}
502
503static bool validateGdi() {
504 auto lobes = engineConfiguration->hpfpCamLobes;
505 if (!lobes) {
506 return true;
507 }
508 int expectedLastLobeProfileAngle = 360 / lobes;
509 float actualLastAngle = config->hpfpLobeProfileAngle[efi::size(config->hpfpLobeProfileAngle) - 1];
510 if (expectedLastLobeProfileAngle != actualLastAngle) {
511 criticalError("Last HPFP angle expected %d got %f", expectedLastLobeProfileAngle, actualLastAngle);
512 return false;
513 }
514
515 return true;
516}
517
518// Returns false if there's an obvious problem with the loaded configuration
520 if (!validateBoardConfig()) {
521 return false;
522 }
523#if defined(HW_HELLEN_UAEFI)
524 // todo: make this board-specific validation callback!
526#endif
527 if (!validateGdi()) {
528 return false;
529 }
531 criticalError("Broken ETB min/max %d %d",
534 return false;
535 }
536
538 if (engineConfiguration->cylindersCount > MAX_CYLINDER_COUNT) {
539 criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount);
540 return false;
541 }
542#if EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
543 float maxConfiguredCorr = config->dwellVoltageCorrValues[0];
544 for (size_t i = 0;i<efi::size(config->dwellVoltageCorrValues);i++) {
545 maxConfiguredCorr = std::max(maxConfiguredCorr, (float)config->dwellVoltageCorrValues[i]);
546 }
547 float maxConfiguredDwell = config->sparkDwellValues[0];
548 for (size_t i = 0;i<efi::size(config->sparkDwellValues);i++) {
549 maxConfiguredDwell = std::max(maxConfiguredDwell, (float)config->sparkDwellValues[i]);
550 }
552 if (maxConfiguredCorr * maxConfiguredDwell > maxAllowedDwell) {
553 criticalError("Dwell=%.2f/corr=%.2f while 33810 limit %d", maxConfiguredDwell, maxConfiguredCorr, maxAllowedDwell);
554 }
555
556#endif // EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
557 if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
558 criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
559 return false;
560 }
561
564
565#if EFI_ENGINE_CONTROL
566 // Fueling
567 {
570
571 ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
572 ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
573
576
579
580 ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
581 ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
582
584
587
590
593
596
598
601 }
602
603 // Ignition
604 {
606
611
612 ensureArrayIsAscending("Ignition CLT corr CLT", config->ignitionCltCorrTempBins);
613 ensureArrayIsAscending("Ignition CLT corr Load", config->ignitionCltCorrLoadBins);
614
615 ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrTempBins);
616 ensureArrayIsAscending("Ignition IAT corr Load", config->ignitionIatCorrLoadBins);
617 }
618
621#endif // EFI_ENGINE_CONTROL
622
629
630// todo: huh? why does this not work on CI? ensureArrayIsAscendingOrDefault("Dwell Correction Voltage", engineConfiguration->dwellVoltageCorrVoltBins);
631
632 ensureArrayIsAscending("MAF transfer function", config->mafDecodingBins);
633
634 // Cranking tables
635 ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
636 ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
639
640 // Idle tables
641 ensureArrayIsAscending("Idle target RPM", config->cltIdleRpmBins);
642 ensureArrayIsAscending("Idle warmup mult CLT", config->cltIdleCorrBins);
643 ensureArrayIsAscending("Idle warmup mult RPM", config->rpmIdleCorrBins);
648
649 for (size_t index = 0; index < efi::size(engineConfiguration->vrThreshold); index++) {
650 auto& cfg = engineConfiguration->vrThreshold[index];
651
652 if (cfg.pin == Gpio::Unassigned) {
653 continue;
654 }
655 ensureArrayIsAscending("VR threshold", cfg.rpmBins);
656 }
657
658#if EFI_BOOST_CONTROL
659 // Boost
660 ensureArrayIsAscending("Boost control Load [open loop]", config->boostOpenLoopLoadBins);
661 ensureArrayIsAscending("Boost control Load [closed loop]", config->boostClosedLoopLoadBins);
662 ensureArrayIsAscending("Boost control RPM [open+closed loop]", config->boostRpmBins);
663#endif // EFI_BOOST_CONTROL
664
665#if EFI_ANTILAG_SYSTEM
666 // ALS
671#endif // EFI_ANTILAG_SYSTEM
672
673#if EFI_ELECTRONIC_THROTTLE_BODY
674 // ETB
677#endif // EFI_ELECTRONIC_THROTTLE_BODY
678
679 if (isGdiEngine()) {
685
686 ensureArrayIsAscending("HPFP fuel mass compensation fuel pressure", config->hpfpFuelMassCompensationFuelPressure);
687 ensureArrayIsAscending("HPFP fuel mass compensation fuel mass", config->hpfpFuelMassCompensationFuelMass);
688
689 }
690
691 // VVT
695 }
696
697#if CAM_INPUTS_COUNT != 1
699 ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
701 }
702#endif
703
705 ensureArrayIsAscending("Oil pressure protection", config->minimumOilPressureBins);
706 }
707
708
709 return true;
710}
711
712bool validateConfigOnStartUpOrBurn(bool isRunningOnBurn) {
715}
716
717#if !EFI_UNIT_TEST
718
720 // Start this early - it will start LED blinking and such
722
723#if EFI_SHAFT_POSITION_INPUT
724 // todo: figure out better startup logic
726#endif /* EFI_SHAFT_POSITION_INPUT */
727
728 /**
729 * Initialize hardware drivers
730 */
731 initHardware();
732
734
735#if EFI_FILE_LOGGING
736 initMmcCard();
737#endif /* EFI_FILE_LOGGING */
738
739#if EFI_ENGINE_EMULATOR
741#endif
742
743#if EFI_LUA
744 startLua();
745#endif // EFI_LUA
746
747#if EFI_CAN_SERIAL
748 // needs to be called after initCan() inside initHardware()
750#endif /* EFI_CAN_SERIAL */
751
752}
753
754// one-time start-up
758
759#if EFI_LOGIC_ANALYZER
762 }
763#endif /* EFI_LOGIC_ANALYZER */
764
765 if (hasFirmwareError()) {
766 return;
767 }
768
770
772}
773
774/**
775 * See also SIGNATURE_HASH
776 */
778#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
779 // make bootloader code happy too
780 if (initBootloader() != 0)
781 return 123;
782#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
783 return VCS_DATE;
784}
785#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()
static void onConfigOnStartUpOrBurn(bool isRunningOnBurn)
GearControllerBase * gearController
Definition engine.h:210
FuelSchedule injectionEvents
Definition engine.h:288
IgnitionEventList ignitionEvents
Definition engine.h:289
void periodicFastCallback()
Definition engine.cpp:567
EngineState engineState
Definition engine.h:344
void periodicSlowCallback()
Definition engine.cpp:159
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 pickEtbOrStepper()
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:540
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:1009
void initMmcCard()
@ CUSTOM_ERR_6661
bool isBrainPinValid(brain_pin_e brainPin)
void initScriptImpl()
void initSettings()
Definition settings.cpp:637
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, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_RPM_SIZE]
scaled_channel< uint16_t, 1000, 1 > fuelLevelBins[FUEL_LEVEL_TABLE_COUNT]
scaled_channel< uint8_t, 1, 10 > idleVeRpmBins[IDLE_VE_SIZE_RPM]
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, 5 > ignitionCltCorrLoadBins[CLT_TIMING_LOAD_AXIS_SIZE]
scaled_channel< int16_t, 1, 1 > ignitionCltCorrTempBins[CLT_TIMING_TEMP_AXIS_SIZE]
scaled_channel< uint8_t, 1, 100 > boostRpmBins[BOOST_RPM_COUNT]
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, 100 > maxKnockRetardRpmBins[KNOCK_TABLE_RPM_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]
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:190