rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
engine_controller.cpp File Reference

Detailed Description

Controllers package entry point code.

Date
Feb 7, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file engine_controller.cpp.

Functions

void initDataStructures ()
 
static void doPeriodicSlowCallback ()
 
static void resetAccel ()
 
void initPeriodicEvents ()
 
chargetPinNameByAdcChannel (const char *msg, adc_channel_e hwChannel, char *buffer, size_t bufferSize)
 
static void printSensorInfo ()
 
static void getShort (int offset)
 
static void getByte (int offset)
 
static void setBit (const char *offsetStr, const char *bitStr, const char *valueStr)
 
static void setShort (const int offset, const int value)
 
static void setByte (const int offset, const int value)
 
static void getBit (int offset, int bit)
 
static void getInt (int offset)
 
static void setInt (const int offset, const int value)
 
static void getFloat (int offset)
 
static void setFloat (const char *offsetStr, const char *valueStr)
 
static void initConfigActions ()
 
void commonInitEngineController ()
 
PUBLIC_API_WEAK bool validateBoardConfig ()
 
bool validateConfigOnStartUpOrBurn ()
 
void commonEarlyInit ()
 
void initRealHardwareEngineController ()
 
int getRusEfiVersion ()
 

Variables

Engine ___engine CCM_OPTIONAL
 
Engineengine
 
static PeriodicFastController fastController
 
static PeriodicSlowController slowController
 
static EngineStateBlinkingTask engineStateBlinkingTask
 
static volatile char UNUSED_RAM_SIZE [RAM_UNUSED_SIZE]
 

Function Documentation

◆ commonEarlyInit()

void commonEarlyInit ( )

Initialize hardware drivers

Definition at line 699 of file engine_controller.cpp.

699 {
700 // Start this early - it will start LED blinking and such
702
703#if EFI_SHAFT_POSITION_INPUT
704 // todo: figure out better startup logic
706#endif /* EFI_SHAFT_POSITION_INPUT */
707
708 /**
709 * Initialize hardware drivers
710 */
711 initHardware();
712
714
715#if EFI_FILE_LOGGING
716 initMmcCard();
717#endif /* EFI_FILE_LOGGING */
718
719#if EFI_ENGINE_EMULATOR
721#endif
722
723#if EFI_LUA
724 startLua();
725#endif // EFI_LUA
726
727#if EFI_CAN_SERIAL
728 // needs to be called after initCan() inside initHardware()
730#endif /* EFI_CAN_SERIAL */
731
732}
void initQcBenchControls()
void initEngineEmulator()
void initHardware()
Definition hardware.cpp:553
void startLua()
Definition lua.cpp:396
void initMmcCard()
Definition mmc_card.cpp:596
void startStatusThreads()
void initTriggerCentral()
void startCanConsole()

Referenced by initEfiWithConfig().

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

◆ commonInitEngineController()

void commonInitEngineController ( )

This has to go after 'enginePins.startPins()' in order to properly detect un-assigned output pins

Definition at line 405 of file engine_controller.cpp.

405 {
406#if EFI_PROD_CODE
407 addConsoleAction("sensorinfo", printSensorInfo);
408 addConsoleAction("reset_accel", resetAccel);
409#endif /* EFI_PROD_CODE */
410
411#if EFI_SIMULATOR || EFI_UNIT_TEST
412 printf("commonInitEngineController\n");
413#endif
414
415#if !EFI_UNIT_TEST
417#endif /* EFI_UNIT_TEST */
418
419#if EFI_ENGINE_CONTROL
420 /**
421 * This has to go after 'enginePins.startPins()' in order to
422 * properly detect un-assigned output pins
423 */
425
427#endif // EFI_ENGINE_CONTROL
428
429#if EFI_SENSOR_CHART
431#endif /* EFI_SENSOR_CHART */
432
433#if EFI_PROD_CODE || EFI_SIMULATOR
434 initSettings();
435
436 if (hasFirmwareError()) {
437 return;
438 }
439#endif
440
441#if ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL
443#endif /* ! EFI_UNIT_TEST && EFI_ENGINE_CONTROL */
444
445#if EFI_ALTERNATOR_CONTROL
447#endif /* EFI_ALTERNATOR_CONTROL */
448
449#if EFI_VVT_PID
451#endif /* EFI_VVT_PID */
452
453#if EFI_MALFUNCTION_INDICATOR
455#endif /* EFI_MALFUNCTION_INDICATOR */
456
457#if !EFI_UNIT_TEST
458 // This is tested independently - don't configure sensors for tests.
459 // This lets us selectively mock them for each test.
461#endif /* EFI_UNIT_TEST */
462
463 initSensors();
464
466
468
469 initGpPwm();
470
471#if EFI_IDLE_CONTROL
473#endif /* EFI_IDLE_CONTROL */
474
475#if EFI_TCU
477#endif
478
480
481#if EFI_ELECTRONIC_THROTTLE_BODY
483#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
484
485#if EFI_MAP_AVERAGING
488 }
489#endif /* EFI_MAP_AVERAGING */
490
491#if EFI_BOOST_CONTROL
493#endif /* EFI_BOOST_CONTROL */
494
495#if EFI_LAUNCH_CONTROL
497#endif
498
500
501#if EFI_UNIT_TEST
503#endif /* EFI_UNIT_TEST */
504
505#if EFI_AUX_VALVES
507#endif /* EFI_AUX_VALVES */
508
511
512#if EFI_LTFT_CONTROL
513 initLtft();
514#endif
515}
void initAccelEnrichment()
void initIgnitionAdvanceControl()
void initSensors()
void initAlternatorCtrl()
void initAuxValves()
void initBenchTest()
void initBoostCtrl()
FuelSchedule injectionEvents
Definition engine.h:269
RpmCalculator rpmCalculator
Definition engine.h:287
bool Register()
Definition sensor.cpp:131
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void initButtonDebounce()
void initElectronicThrottle()
void prepareOutputSignals()
static constexpr engine_configuration_s * engineConfiguration
Engine * engine
static void printSensorInfo()
static void initConfigActions()
static void resetAccel()
void initGearController()
void initGpPwm()
Definition gppwm.cpp:31
void startIdleThread()
void initNewSensors()
void initLaunchControl()
void initLtft(void)
void initMalfunctionIndicator(void)
void initMapAveraging()
void initScriptImpl()
void initSensorChart(void)
void initSettings()
Definition settings.cpp:631
void initSpeedometer()
void initTachometer()
printf("\n")
void initVvtActuators()
Definition vvt.cpp:183

Referenced by initRealHardwareEngineController().

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

◆ doPeriodicSlowCallback()

static void doPeriodicSlowCallback ( )
static

rusEfi usually runs on hardware which halts execution while writing to internal flash, so we postpone writes to until engine is stopped. Writes in case of self-stimulation are fine.

todo: allow writing if 2nd bank of flash is used

Definition at line 180 of file engine_controller.cpp.

180 {
181#if EFI_SHAFT_POSITION_INPUT
182 efiAssertVoid(ObdCode::CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
183
185
188 resetAccel();
189 }
190#endif /* EFI_SHAFT_POSITION_INPUT */
191
193
194#if EFI_SHAFT_POSITION_INPUT
196 /**
197 * rusEfi usually runs on hardware which halts execution while writing to internal flash, so we
198 * postpone writes to until engine is stopped. Writes in case of self-stimulation are fine.
199 *
200 * todo: allow writing if 2nd bank of flash is used
201 */
202#if EFI_CONFIGURATION_STORAGE
204#endif /* EFI_CONFIGURATION_STORAGE */
205 }
206#else /* if EFI_SHAFT_POSITION_INPUT */
207 #if EFI_CONFIGURATION_STORAGE
209 #endif /* EFI_CONFIGURATION_STORAGE */
210#endif /* EFI_SHAFT_POSITION_INPUT */
211
212#if EFI_TCU
214 if (engine->gearController == NULL) {
218 }
220 }
221#endif // EFI_TCU
222
224}
void tryResetWatchdog()
TriggerCentral triggerCentral
Definition engine.h:299
GearControllerBase * gearController
Definition engine.h:192
void periodicSlowCallback()
Definition engine.cpp:141
virtual void update()
virtual GearControllerMode getMode() const
bool isStopped() const override
void slowStartStopButtonCallback()
void writeToFlashIfPending()
@ CUSTOM_ERR_6661
Here is the call graph for this function:

◆ getBit()

static void getBit ( int  offset,
int  bit 
)
static

this response is part of rusEfi console API

Definition at line 327 of file engine_controller.cpp.

327 {
328 if (isOutOfBounds(offset))
329 return;
330 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
331 int value = (*ptr >> bit) & 1;
332 /**
333 * this response is part of rusEfi console API
334 */
335 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
336}

Referenced by initConfigActions().

Here is the caller graph for this function:

◆ getByte()

static void getByte ( int  offset)
static

this response is part of rusEfi console API

Definition at line 270 of file engine_controller.cpp.

270 {
271 if (isOutOfBounds(offset))
272 return;
273 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
274 uint8_t value = *ptr;
275 /**
276 * this response is part of rusEfi console API
277 */
278 efiPrintf("byte%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
279}

Referenced by initConfigActions(), and setByte().

Here is the caller graph for this function:

◆ getFloat()

static void getFloat ( int  offset)
static

this response is part of rusEfi console API

Definition at line 358 of file engine_controller.cpp.

358 {
359 if (isOutOfBounds(offset))
360 return;
361 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
362 float value = *ptr;
363 /**
364 * this response is part of rusEfi console API
365 */
366 efiPrintf("float%s%d is %.5f", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
367}

Referenced by initConfigActions(), and setFloat().

Here is the caller graph for this function:

◆ getInt()

static void getInt ( int  offset)
static

this response is part of rusEfi console API

Definition at line 338 of file engine_controller.cpp.

338 {
339 if (isOutOfBounds(offset))
340 return;
341 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
342 int value = *ptr;
343 /**
344 * this response is part of rusEfi console API
345 */
346 efiPrintf("int%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
347}

Referenced by initConfigActions(), and setInt().

Here is the caller graph for this function:

◆ getPinNameByAdcChannel()

char * getPinNameByAdcChannel ( const char msg,
adc_channel_e  hwChannel,
char buffer,
size_t  bufferSize 
)

Definition at line 231 of file engine_controller.cpp.

231 {
232#if HAL_USE_ADC
233 if (!isAdcChannelValid(hwChannel)) {
234 snprintf(buffer, bufferSize, "NONE");
235 } else {
236 const char *name = portname(getAdcChannelPort(msg, hwChannel));
237 snprintf(buffer, bufferSize, "%s%d", name ? name : "null", getAdcChannelPin(hwChannel));
238 }
239#else
240 snprintf(buffer, bufferSize, "NONE");
241#endif /* HAL_USE_ADC */
242 return buffer;
243}
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:20
int getAdcChannelPin(adc_channel_e hwChannel)
ioportid_t getAdcChannelPort(const char *msg, adc_channel_e hwChannel)
const char * portname(ioportid_t GPIOx)
static BigBufferHandle buffer

Referenced by AdcSubscription::PrintInfo(), and printMAPInfo().

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

◆ getRusEfiVersion()

int getRusEfiVersion ( )

See also SIGNATURE_HASH

Definition at line 774 of file engine_controller.cpp.

774 {
775 if (UNUSED_RAM_SIZE[0] != 0)
776 return 123; // this is here to make the compiler happy about the unused array
777 if (UNUSED_CCM_SIZE[0] * 0 != 0)
778 return 3211; // this is here to make the compiler happy about the unused array
779#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
780 // make bootloader code happy too
781 if (initBootloader() != 0)
782 return 123;
783#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
784 return VCS_DATE;
785}
static volatile char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE]

Referenced by errorHandlerInit(), firmwareError(), handleGetVersion(), printVersionForConsole(), readFromFlash(), sayHello(), and updateTunerStudioState().

Here is the caller graph for this function:

◆ getShort()

static void getShort ( int  offset)
static

this response is part of rusEfi console API

Definition at line 259 of file engine_controller.cpp.

259 {
260 if (isOutOfBounds(offset))
261 return;
262 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
263 uint16_t value = *ptr;
264 /**
265 * this response is part of rusEfi console API
266 */
267 efiPrintf("short%s%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, value);
268}

Referenced by initConfigActions(), and setShort().

Here is the caller graph for this function:

◆ initConfigActions()

static void initConfigActions ( )
static

Definition at line 388 of file engine_controller.cpp.

388 {
391 addConsoleActionII("set_short", (VoidIntInt) setShort);
393 addConsoleActionSSS("set_bit", setBit);
394
395 addConsoleActionI("get_float", getFloat);
396 addConsoleActionI("get_int", getInt);
397 addConsoleActionI("get_short", getShort);
398 addConsoleActionI("get_byte", getByte);
399 addConsoleActionII("get_bit", getBit);
400}
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)
static void setFloat(const char *offsetStr, const char *valueStr)
static void getShort(int offset)
static void getFloat(int offset)
static void setByte(const int offset, const int value)
static void setInt(const int offset, const int value)
static void getByte(int offset)
static void getBit(int offset, int bit)
static void setShort(const int offset, const int value)
static void getInt(int offset)
static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr)

Referenced by commonInitEngineController().

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

◆ initDataStructures()

void initDataStructures ( )

Definition at line 103 of file engine_controller.cpp.

103 {
104#if EFI_ENGINE_CONTROL
105 initFuelMap();
108 for (size_t i=0;i<efi::size(events.elements);i++) {
109 // above-zero value helps distinguish events
111 }
112 // above-zero value helps distinguish events
114#endif // EFI_ENGINE_CONTROL
115}
IgnitionEventList ignitionEvents
Definition engine.h:270
EngineState engineState
Definition engine.h:325
IgnitionEvent elements[MAX_CYLINDER_COUNT]
void initFuelMap()
Initialize fuel map data structure.
void initSpeedDensity()
static std::vector< CompositeEvent > events

Referenced by runRusEfi().

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

◆ initPeriodicEvents()

void initPeriodicEvents ( )

Definition at line 226 of file engine_controller.cpp.

226 {
227 slowController.start();
228 fastController.start();
229}
static PeriodicFastController fastController
static PeriodicSlowController slowController

Referenced by runRusEfi().

Here is the caller graph for this function:

◆ initRealHardwareEngineController()

void initRealHardwareEngineController ( )

Definition at line 735 of file engine_controller.cpp.

735 {
738
739#if EFI_LOGIC_ANALYZER
742 }
743#endif /* EFI_LOGIC_ANALYZER */
744
745 if (hasFirmwareError()) {
746 return;
747 }
748
750
752}
static EngineStateBlinkingTask engineStateBlinkingTask
void commonInitEngineController()
void initWaveAnalyzer()
void initWarningRunningPins()
void initVrThresholdPwm()
Definition vr_pwm.cpp:39

Referenced by initEfiWithConfig().

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

◆ printSensorInfo()

static void printSensorInfo ( )
static

Definition at line 246 of file engine_controller.cpp.

246 {
247#if HAL_USE_ADC
248 // Print info about analog mappings
250#endif // HAL_USE_ADC
251
252 // Print info about all sensors
254}
static void PrintInfo()
static void showAllSensorInfo()
Definition sensor.cpp:237

Referenced by commonInitEngineController().

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

◆ resetAccel()

static void resetAccel ( )
static

Definition at line 169 of file engine_controller.cpp.

169 {
170 engine->module<TpsAccelEnrichment>()->resetAE();
171
172#if EFI_ENGINE_CONTROL
173 for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
174 {
176 }
177#endif // EFI_ENGINE_CONTROL
178}
constexpr auto & module()
Definition engine.h:187
InjectionEvent elements[MAX_CYLINDER_COUNT]
WallFuel & getWallFuel()
void resetWF()
Definition wall_fuel.cpp:10

Referenced by commonInitEngineController(), and doPeriodicSlowCallback().

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

◆ setBit()

static void setBit ( const char offsetStr,
const char bitStr,
const char valueStr 
)
static

this response is part of rusEfi console API

Definition at line 281 of file engine_controller.cpp.

281 {
282 int offset = atoi(offsetStr);
283 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
284 efiPrintf("invalid offset [%s]", offsetStr);
285 return;
286 }
287 if (isOutOfBounds(offset)) {
288 return;
289 }
290 int bit = atoi(bitStr);
291 if (absI(bit) == absI(ATOI_ERROR_CODE)) {
292 efiPrintf("invalid bit [%s]", bitStr);
293 return;
294 }
295 int value = atoi(valueStr);
296 if (absI(value) == absI(ATOI_ERROR_CODE)) {
297 efiPrintf("invalid value [%s]", valueStr);
298 return;
299 }
300 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
301 *ptr ^= (-value ^ *ptr) & (1 << bit);
302 /**
303 * this response is part of rusEfi console API
304 */
305 efiPrintf("bit%s%d/%d is %d", CONSOLE_DATA_PROTOCOL_TAG, offset, bit, value);
307}
void incrementGlobalConfigurationVersion(const char *msg)

Referenced by initConfigActions().

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

◆ setByte()

static void setByte ( const int  offset,
const int  value 
)
static

Definition at line 318 of file engine_controller.cpp.

318 {
319 if (isOutOfBounds(offset))
320 return;
321 uint8_t *ptr = (uint8_t *) (&((char *) engineConfiguration)[offset]);
322 *ptr = (uint8_t) value;
323 getByte(offset);
325}

Referenced by initConfigActions().

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

◆ setFloat()

static void setFloat ( const char offsetStr,
const char valueStr 
)
static

Definition at line 369 of file engine_controller.cpp.

369 {
370 int offset = atoi(offsetStr);
371 if (absI(offset) == absI(ATOI_ERROR_CODE)) {
372 efiPrintf("invalid offset [%s]", offsetStr);
373 return;
374 }
375 if (isOutOfBounds(offset))
376 return;
377 float value = atoff(valueStr);
378 if (std::isnan(value)) {
379 efiPrintf("invalid value [%s]", valueStr);
380 return;
381 }
382 float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
383 *ptr = value;
384 getFloat(offset);
386}

Referenced by initConfigActions().

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

◆ setInt()

static void setInt ( const int  offset,
const int  value 
)
static

Definition at line 349 of file engine_controller.cpp.

349 {
350 if (isOutOfBounds(offset))
351 return;
352 int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
353 *ptr = value;
354 getInt(offset);
356}

Referenced by initConfigActions().

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

◆ setShort()

static void setShort ( const int  offset,
const int  value 
)
static

Definition at line 309 of file engine_controller.cpp.

309 {
310 if (isOutOfBounds(offset))
311 return;
312 uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
313 *ptr = (uint16_t) value;
314 getShort(offset);
316}

Referenced by initConfigActions().

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

◆ validateBoardConfig()

PUBLIC_API_WEAK bool validateBoardConfig ( )

Definition at line 517 of file engine_controller.cpp.

517 {
518 return true;
519}

Referenced by validateConfigOnStartUpOrBurn().

Here is the caller graph for this function:

◆ validateConfigOnStartUpOrBurn()

bool validateConfigOnStartUpOrBurn ( )

Definition at line 522 of file engine_controller.cpp.

522 {
523 if (!validateBoardConfig()) {
524 return false;
525 }
526 if (engineConfiguration->cylindersCount > MAX_CYLINDER_COUNT) {
527 criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount);
528 return false;
529 }
530#if EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
531 float maxConfiguredCorr = config->dwellVoltageCorrValues[0];
532 for (size_t i = 0;i<efi::size(config->dwellVoltageCorrValues);i++) {
533 maxConfiguredCorr = std::max(maxConfiguredCorr, (float)config->dwellVoltageCorrValues[i]);
534 }
535 float maxConfiguredDwell = config->sparkDwellValues[0];
536 for (size_t i = 0;i<efi::size(config->sparkDwellValues);i++) {
537 maxConfiguredDwell = std::max(maxConfiguredDwell, (float)config->sparkDwellValues[i]);
538 }
540 if (maxConfiguredCorr * maxConfiguredDwell > maxAllowedDwell) {
541 criticalError("Dwell=%.2f/corr=%.2f while 33810 limit %d", maxConfiguredDwell, maxConfiguredCorr, maxAllowedDwell);
542 }
543
544#endif // EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
545 if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
546 criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
547 return false;
548 }
551 }
552
555 }
558 }
559
561
562#if EFI_ENGINE_CONTROL
563 // Fueling
564 {
567
568 ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
569 ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
570
573
576
577 ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
578 ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
579
583
586
589
591
594 }
595
596 // Ignition
597 {
599
604
605 ensureArrayIsAscending("Ignition CLT corr", config->cltTimingBins);
606
607 ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrTempBins);
608 ensureArrayIsAscending("Ignition IAT corr Load", config->ignitionIatCorrLoadBins);
609 }
610
613#endif // EFI_ENGINE_CONTROL
614
621
622// todo: huh? why does this not work on CI? ensureArrayIsAscendingOrDefault("Dwell Correction Voltage", engineConfiguration->dwellVoltageCorrVoltBins);
623
624 ensureArrayIsAscending("MAF transfer function", config->mafDecodingBins);
625
626 // Cranking tables
627 ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
628 ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
631
632 // Idle tables
633 ensureArrayIsAscending("Idle target RPM", config->cltIdleRpmBins);
634 ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins);
639
640 for (size_t index = 0; index < efi::size(engineConfiguration->vrThreshold); index++) {
641 auto& cfg = engineConfiguration->vrThreshold[index];
642
643 if (cfg.pin == Gpio::Unassigned) {
644 continue;
645 }
646 ensureArrayIsAscending("VR threshold", cfg.rpmBins);
647 }
648
649#if EFI_BOOST_CONTROL
650 // Boost
651 ensureArrayIsAscending("Boost control Load", config->boostLoadBins);
652 ensureArrayIsAscending("Boost control RPM", config->boostRpmBins);
653#endif // EFI_BOOST_CONTROL
654
655#if EFI_ANTILAG_SYSTEM
656 // ALS
661#endif // EFI_ANTILAG_SYSTEM
662
663#if EFI_ELECTRONIC_THROTTLE_BODY
664 // ETB
667#endif // EFI_ELECTRONIC_THROTTLE_BODY
668
669 if (isGdiEngine()) {
675 }
676
677 // VVT
681 }
682
683#if CAM_INPUTS_COUNT != 1
685 ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
687 }
688#endif
689
691 ensureArrayIsAscending("Oil pressure protection", config->minimumOilPressureBins);
692 }
693
694 return true;
695}
@ Unassigned
void ensureArrayIsAscendingOrDefault(const char *msg, const TValue(&values)[TSize])
void ensureArrayIsAscending(const char *msg, const TValue(&values)[TSize])
static constexpr persistent_config_s * config
PUBLIC_API_WEAK bool validateBoardConfig()
bool isGdiEngine()
int getMc33810maxDwellTimer(mc33810maxDwellTimer_e value)
Definition mc33810.cpp:848
bool isBrainPinValid(brain_pin_e brainPin)
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, 5 > ignitionIatCorrLoadBins[IAT_IGN_CORR_COUNT]
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, 50, 1 > dwellVoltageCorrValues[DWELL_CURVE_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< uint16_t, 100, 1 > sparkDwellValues[DWELL_CURVE_SIZE]

Referenced by handleBurnCommand(), and initEfiWithConfig().

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

Variable Documentation

◆ CCM_OPTIONAL

volatile char UNUSED_CCM_SIZE [CCM_UNUSED_SIZE] CCM_OPTIONAL

Would love to pass reference to configuration object into constructor but C++ does allow attributes after parenthesized initializer

Definition at line 94 of file engine_controller.cpp.

◆ engine

Engine* engine

◆ engineStateBlinkingTask

EngineStateBlinkingTask engineStateBlinkingTask
static

Definition at line 167 of file engine_controller.cpp.

Referenced by initRealHardwareEngineController().

◆ fastController

PeriodicFastController fastController
static

Definition at line 142 of file engine_controller.cpp.

Referenced by initPeriodicEvents().

◆ slowController

PeriodicSlowController slowController
static

Definition at line 143 of file engine_controller.cpp.

Referenced by initPeriodicEvents().

◆ UNUSED_RAM_SIZE

volatile char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE]
static

Definition at line 768 of file engine_controller.cpp.

Referenced by getRusEfiVersion().

Go to the source code of this file.