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

Detailed Description

Utility method related to the engine configuration data structure.

Date
Nov 22, 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_configuration.cpp.

Functions

void rememberCurrentConfiguration ()
 
static void fillAfterString (char *string, int size)
 
static void wipeStrings ()
 
void onBurnRequest ()
 
PUBLIC_API_WEAK void boardBeforeTuneDefaults ()
 
PUBLIC_API_WEAK void boardOnConfigurationChange (engine_configuration_s *)
 
void incrementGlobalConfigurationVersion (const char *msg)
 
void setConstantDwell (floatms_t dwellMs)
 Sets the same dwell time across the whole getRpm() range set dwell X.
 
void setFuelTablesLoadBin (float minValue, float maxValue)
 
void setWholeIatCorrTimingTable (float value)
 
void setWholeTimingTable (angle_t value)
 
void prepareVoidConfiguration (engine_configuration_s *p_engineConfiguration)
 
void setDefaultBasePins ()
 
void setDefaultSdCardParameters ()
 
static void setDefaultIdleSpeedTarget ()
 
void setTargetRpmCurve (float rpm)
 
static void setDefaultGppwmParameters ()
 
static void setDefaultBoostOpenLoopParameters ()
 
static void setDefaultEngineNoiseTable ()
 
static void setDefaultCanSettings ()
 
static void setDefaultScriptParameters ()
 
static void setDefaultIdleOpenLoopParameters ()
 
static void setDefaultEngineConfiguration ()
 Global default engine configuration This method sets the global engine configuration defaults. These default values are then overridden by engine-specific defaults and the settings are saved in flash memory.
 
void loadConfiguration ()
 
void resetConfigurationExt (configuration_callback_t boardCallback, engine_type_e engineType)
 
void emptyCallbackWithConfiguration (engine_configuration_s *p_engineConfiguration)
 
void resetConfigurationExt (engine_type_e engineType)
 
void applyNonPersistentConfiguration ()
 
void setCamOperationMode ()
 
void setCrankOperationMode ()
 
void commonFrankensoAnalogInputs ()
 
void setBoardDefaultConfiguration ()
 Board-specific configuration defaults.
 
void setBoardConfigOverrides ()
 
PUBLIC_API_WEAK int hackHellenBoardId (int detectedId)
 
PUBLIC_API_WEAK void onBoardStandBy ()
 
PUBLIC_API_WEAK_SOMETHING_WEIRD int getBoardMetaOutputsCount ()
 
PUBLIC_API_WEAK int getBoardMetaLowSideOutputsCount ()
 
PUBLIC_API_WEAK GpiogetBoardMetaOutputs ()
 
PUBLIC_API_WEAK int getBoardMetaDcOutputsCount ()
 

Variables

std::optional< setup_custom_board_overrides_typecustom_board_DefaultConfiguration
 
std::optional< setup_custom_board_overrides_typecustom_board_ConfigOverrides
 
std::optional< setup_custom_board_config_typecustom_board_OnConfigurationChange
 
static bool hasRememberedConfiguration = false
 
engine_configuration_sactiveConfiguration = reinterpret_cast<persistent_config_container_s*>(getFlashAddrFirstCopy())->persistentConfiguration.engineConfiguration
 
bool isActiveConfigurationVoid = true
 
static engine_configuration_s activeConfigurationLocalStorage
 

Function Documentation

◆ applyNonPersistentConfiguration()

void applyNonPersistentConfiguration ( )

Definition at line 698 of file engine_configuration.cpp.

698 {
699#if EFI_PROD_CODE
700 efiAssertVoid(ObdCode::CUSTOM_APPLY_STACK, hasLotsOfRemainingStack(), "apply c");
701 efiPrintf("applyNonPersistentConfiguration()");
702#endif
703
704#if EFI_ENGINE_CONTROL
706#endif // EFI_ENGINE_CONTROL
707}
void updateTriggerConfiguration()
Definition engine.cpp:133
static EngineAccessor engine
Definition engine.h:413
@ CUSTOM_APPLY_STACK

Referenced by readFromFlash(), and resetConfigurationExt().

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

◆ boardBeforeTuneDefaults()

PUBLIC_API_WEAK void boardBeforeTuneDefaults ( )

this hook is about https://github.com/rusefi/rusefi/wiki/Custom-Firmware and https://github.com/rusefi/rusefi/wiki/Canned-Tune-Process todo: why two hooks? is one already dead?

Definition at line 125 of file engine_configuration.cpp.

125{ }

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ boardOnConfigurationChange()

PUBLIC_API_WEAK void boardOnConfigurationChange ( engine_configuration_s previousConfiguration)

Definition at line 128 of file engine_configuration.cpp.

128{ }

Referenced by incrementGlobalConfigurationVersion().

Here is the caller graph for this function:

◆ commonFrankensoAnalogInputs()

void commonFrankensoAnalogInputs ( )

VBatt

Definition at line 718 of file engine_configuration.cpp.

718 {
719 /**
720 * VBatt
721 */
723}
static constexpr engine_configuration_s * engineConfiguration

Referenced by setDodgeNeonNGCEngineConfiguration(), and setFrankensoConfiguration().

Here is the caller graph for this function:

◆ emptyCallbackWithConfiguration()

void emptyCallbackWithConfiguration ( engine_configuration_s p_engineConfiguration)

Definition at line 690 of file engine_configuration.cpp.

690 {
691 UNUSED(p_engineConfiguration);
692}
UNUSED(samplingTimeSeconds)

Referenced by resetConfigurationExt().

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

◆ fillAfterString()

static void fillAfterString ( char string,
int  size 
)
static

Definition at line 101 of file engine_configuration.cpp.

101 {
102 // we have to reset bytes after \0 symbol in order to calculate correct tune CRC from MSQ file
103 for (int i = std::strlen(string) + 1; i < size; i++) {
104 string[i] = 0;
105 }
106}
composite packet size

Referenced by wipeStrings().

Here is the caller graph for this function:

◆ getBoardMetaDcOutputsCount()

PUBLIC_API_WEAK int getBoardMetaDcOutputsCount ( )

Definition at line 740 of file engine_configuration.cpp.

740{ return 0; }

◆ getBoardMetaLowSideOutputsCount()

PUBLIC_API_WEAK int getBoardMetaLowSideOutputsCount ( )

Definition at line 738 of file engine_configuration.cpp.

738{ return getBoardMetaOutputsCount(); }
PUBLIC_API_WEAK_SOMETHING_WEIRD int getBoardMetaOutputsCount()
Here is the call graph for this function:

◆ getBoardMetaOutputs()

PUBLIC_API_WEAK Gpio * getBoardMetaOutputs ( )

Definition at line 739 of file engine_configuration.cpp.

739{ return nullptr; }

◆ getBoardMetaOutputsCount()

PUBLIC_API_WEAK_SOMETHING_WEIRD int getBoardMetaOutputsCount ( )

Definition at line 736 of file engine_configuration.cpp.

736{ return 0; }

Referenced by getBoardMetaLowSideOutputsCount().

Here is the caller graph for this function:

◆ hackHellenBoardId()

PUBLIC_API_WEAK int hackHellenBoardId ( int  detectedId)

Definition at line 732 of file engine_configuration.cpp.

732{ return detectedId; }

◆ incrementGlobalConfigurationVersion()

void incrementGlobalConfigurationVersion ( const char msg)

this is the top-level method which should be called in case of any changes to engine configuration online tuning of most values in the maps does not count as configuration change, but 'Burn' command does

this method is NOT currently invoked on ECU start - actual user input has to happen! See 'preCalculate' or 'startHardware' which are invoked BOTH on start and configuration change

Definition at line 137 of file engine_configuration.cpp.

137 {
139 assertStackVoid("increment", ObdCode::STACK_USAGE_MISC, EXPECTED_REMAINING_STACK);
141 criticalError("too early to invoke incrementGlobalConfigurationVersion %s", msg);
142 }
144#if EFI_DETAILED_LOGGING
145 efiPrintf("set globalConfigurationVersion=%d", globalConfigurationVersion);
146#endif /* EFI_DETAILED_LOGGING */
147
149
152
154
155#if EFI_ELECTRONIC_THROTTLE_BODY
157#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
158
159#if EFI_ENGINE_CONTROL && EFI_PROD_CODE
161#endif
162
163#if EFI_SHAFT_POSITION_INPUT
165#endif /* EFI_SHAFT_POSITION_INPUT */
166#if EFI_EMULATE_POSITION_SENSORS && ! EFI_UNIT_TEST
168#endif /* EFI_EMULATE_POSITION_SENSORS */
169
170 engine->engineModules.apply_all([](auto & m) {
171 m.onConfigurationChange(&activeConfiguration);
172 });
174}
void onConfigurationChangeBenchTest()
static bool call_board_override(std::optional< FuncType > board_override, Args &&... args)
void preCalculate()
Definition engine.cpp:324
int globalConfigurationVersion
Definition engine.h:315
type_list< Mockable< InjectorModelPrimary >, Mockable< InjectorModelSecondary >,#if EFI_IDLE_CONTROL Mockable< IdleController >,#endif TriggerScheduler,#if EFI_HPFP &&EFI_ENGINE_CONTROL Mockable< HpfpController >,#endif #if EFI_ENGINE_CONTROL Mockable< ThrottleModel >,#endif #if EFI_ALTERNATOR_CONTROL AlternatorController,#endif MainRelayController, Mockable< IgnitionController >, Mockable< AcController >, PrimeController, DfcoController,#if EFI_HD_ACR HarleyAcr,#endif Mockable< WallFuelController >, KnockController, SensorChecker,#if EFI_ENGINE_CONTROL Mockable< LimpManager >,#endif #if EFI_VVT_PID VvtController1, VvtController2, VvtController3, VvtController4,#endif #if EFI_BOOST_CONTROL BoostController,#endif TpsAccelEnrichment,#if EFI_LAUNCH_CONTROL NitrousController,#endif #if EFI_LTFT_CONTROL LongTermFuelTrim,#endif ShortTermFuelTrim,#include "modules_list_generated.h" EngineModule > engineModules
Definition engine.h:194
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration)
static bool hasRememberedConfiguration
void rememberCurrentConfiguration()
PUBLIC_API_WEAK void boardOnConfigurationChange(engine_configuration_s *)
std::optional< setup_custom_board_config_type > custom_board_OnConfigurationChange
engine_configuration_s & activeConfiguration
void applyNewHardwareSettings()
Definition hardware.cpp:311
@ STACK_USAGE_MISC
void onTransitionEvent(TransitionEvent event)
void onConfigurationChangeTriggerCallback()
void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousConfiguration)

Referenced by configureRusefiLuaHooks(), disableTriggerStimulator(), enableExternalTriggerStimulator(), enableOrDisable(), enableTriggerStimulator(), onBurnRequest(), setAnalogInputPin(), setBit(), setByte(), setCrankingInjectionMode(), setCrankingTimingAngle(), setEngineType(), setFloat(), setGlobalTriggerAngleOffset(), setIdleSolenoidFrequency(), setIgnitionMode(), setIgnitionPin(), setIndividualPin(), setInjectionMode(), setInt(), setLogicInputPin(), setShort(), setTriggerInputPin(), setTriggerSimulatorPin(), and setTriggerType().

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

◆ loadConfiguration()

void loadConfiguration ( )

Definition at line 632 of file engine_configuration.cpp.

632 {
633
634#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
635 // Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly
637#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
638
639 /* If board have any storage */
640#if EFI_CONFIGURATION_STORAGE
641 if (IGNORE_FLASH_CONFIGURATION) {
642 engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
645 } else {
646 // this call reads configuration from flash memory or sets default configuration
647 // if flash state does not look right.
649 }
650#else
651 // This board doesn't load configuration, initialize the default
652 engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
654#endif /* EFI_CONFIGURATION_STORAGE */
655
656 // Force any board configuration options that humans shouldn't be able to change
658}
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e engineType)
void prepareVoidConfiguration(engine_configuration_s *p_engineConfiguration)
void readFromFlash()
void writeToFlashNow()

Referenced by runRusEfi().

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

◆ onBoardStandBy()

PUBLIC_API_WEAK void onBoardStandBy ( )

Definition at line 734 of file engine_configuration.cpp.

734{ }

◆ onBurnRequest()

void onBurnRequest ( )

Definition at line 114 of file engine_configuration.cpp.

114 {
116 wipeStrings();
117
119}
void incrementGlobalConfigurationVersion(const char *msg)
static void wipeStrings()

Referenced by requestBurn().

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

◆ prepareVoidConfiguration()

void prepareVoidConfiguration ( engine_configuration_s p_engineConfiguration)

Definition at line 226 of file engine_configuration.cpp.

226 {
227 criticalAssertVoid(p_engineConfiguration != nullptr, "ec NULL");
228 efi::clear(p_engineConfiguration);
229
230 p_engineConfiguration->clutchDownPinMode = PI_PULLUP;
231 p_engineConfiguration->clutchUpPinMode = PI_PULLUP;
232 p_engineConfiguration->brakePedalPinMode = PI_PULLUP;
233}

Referenced by loadConfiguration(), and setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ rememberCurrentConfiguration()

void rememberCurrentConfiguration ( )

Definition at line 92 of file engine_configuration.cpp.

92 {
93#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
95#else
97#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
99}
bool isActiveConfigurationVoid

Referenced by incrementGlobalConfigurationVersion(), and initEfiWithConfig().

Here is the caller graph for this function:

◆ resetConfigurationExt() [1/2]

void resetConfigurationExt ( configuration_callback_t  boardCallback,
engine_type_e  engineType 
)

boardCallback is invoked after configuration reset but before specific engineType configuration

Let's apply global defaults first

custom board engine defaults. Yes, this overlaps with (older) engine_type_e approach.

Definition at line 660 of file engine_configuration.cpp.

660 {
661 enginePins.reset(); // that's mostly important for functional tests
662 /**
663 * Let's apply global defaults first
664 */
666
667 /**
668 * custom board engine defaults. Yes, this overlaps with (older) engine_type_e approach.
669 */
671
672 // set initial pin groups
674
675 if (boardCallback != nullptr) {
676 boardCallback(engineConfiguration);
677 }
678
679#if EFI_PROD_CODE
680 // call board-specific configuration setup, if needed (for custom boards only)
683#endif // EFI_PROD_CODE
684
685 engineConfiguration->engineType = engineType;
686 applyEngineType(engineType);
688}
void reset()
Definition efi_gpio.cpp:275
EnginePins enginePins
Definition efi_gpio.cpp:24
static void setDefaultEngineConfiguration()
Global default engine configuration This method sets the global engine configuration defaults....
void setDefaultBasePins()
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
PUBLIC_API_WEAK void boardBeforeTuneDefaults()
void applyNonPersistentConfiguration()
void applyEngineType(engine_type_e engineType)

Referenced by doResetConfiguration(), loadConfiguration(), readFromFlash(), resetConfigurationExt(), and setEngineType().

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

◆ resetConfigurationExt() [2/2]

void resetConfigurationExt ( engine_type_e  engineType)

Definition at line 694 of file engine_configuration.cpp.

694 {
696}
void emptyCallbackWithConfiguration(engine_configuration_s *p_engineConfiguration)
Here is the call graph for this function:

◆ setBoardConfigOverrides()

void setBoardConfigOverrides ( )

Definition at line 728 of file engine_configuration.cpp.

728 {
729 // time to force migration to custom_board_ConfigOverrides
730}

◆ setBoardDefaultConfiguration()

void setBoardDefaultConfiguration ( )

Board-specific configuration defaults.

Definition at line 725 of file engine_configuration.cpp.

725 {
726 // custom_board_DefaultConfiguration
727}

◆ setCamOperationMode()

void setCamOperationMode ( )

Definition at line 709 of file engine_configuration.cpp.

Referenced by setFordInline6(), setSubaruEG33Defaults(), and setTestCamEngineConfiguration().

Here is the caller graph for this function:

◆ setConstantDwell()

void setConstantDwell ( floatms_t  dwellMs)

Sets the same dwell time across the whole getRpm() range set dwell X.

Definition at line 180 of file engine_configuration.cpp.

180 {
181 for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
182 config->sparkDwellRpmBins[i] = 1000 * i;
183 }
185}
static constexpr persistent_config_s * config
scaled_channel< uint16_t, 100, 1 > sparkDwellValues[DWELL_CURVE_SIZE]
void setArrayValues(TValue(&array)[TSize], float value)

Referenced by setDefaultIgnition(), setFordInline6(), setTestCamEngineConfiguration(), and setValue().

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

◆ setCrankOperationMode()

void setCrankOperationMode ( )

◆ setDefaultBasePins()

void setDefaultBasePins ( )

Definition at line 235 of file engine_configuration.cpp.

235 {
236#if EFI_PROD_CODE
237 // call overrided board-specific serial configuration setup, if needed (for custom boards only)
238 // needed also by bootloader code
240#endif /* EFI_PROD_CODE */
241
242 // set UART pads configuration based on the board
243// needed also by bootloader code
244#ifdef TS_SECONDARY_UxART_PORT
247#endif // TS_SECONDARY_UxART_PORT
248
251}
void setPinConfigurationOverrides()

Referenced by resetConfigurationExt().

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

◆ setDefaultBoostOpenLoopParameters()

static void setDefaultBoostOpenLoopParameters ( )
static

Definition at line 313 of file engine_configuration.cpp.

Referenced by setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ setDefaultCanSettings()

static void setDefaultCanSettings ( )
static

Definition at line 328 of file engine_configuration.cpp.

328 {
329 // OBD-II default rate is 500kbps
332#if (EFI_CAN_BUS_COUNT >= 3)
334#endif
335
340
341 // Don't enable, but set default address
342 engineConfiguration->verboseCanBaseAddress = CAN_DEFAULT_BASE;
343}

Referenced by setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ setDefaultEngineConfiguration()

static void setDefaultEngineConfiguration ( )
static

Global default engine configuration This method sets the global engine configuration defaults. These default values are then overridden by engine-specific defaults and the settings are saved in flash memory.

This method is invoked only when new configuration is needed:

  • recently re-flashed chip
  • flash version of configuration failed CRC check or appears to be older then FLASH_DATA_VERSION
  • 'rewriteconfig' command
  • 'set engine_type X' command

This method should only change the state of the configuration data structure but should NOT change the state of anything else.

This method should NOT be setting any default pinout

Idle control defaults

between variation between different sensor and weather and fabrication tolerance five percent looks like a safer default

Definition at line 380 of file engine_configuration.cpp.

380 {
381#if (! EFI_UNIT_TEST)
383#endif
385
386#if EFI_BOOST_CONTROL
388#endif
389
391
393
397
398#if EFI_ENGINE_CONTROL
403
404 // VVT closed loop, totally random values!
411
412 engineConfiguration->vvtOutputFrequency = DEFAULT_SOLENOID_FREQUENCY; // VVT solenoid control
413
415
420
422
423#if EFI_IDLE_CONTROL
425#endif /* EFI_IDLE_CONTROL */
426
427#if EFI_ELECTRONIC_THROTTLE_BODY
430#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
431
433
436
438
442
443 initTemperatureCurve(IAT_FUEL_CORRECTION_CURVE, 1);
444
445 initBoostTemperatureCurve(config->cltBoostCorrBins, config->cltBoostCorr, 1.0f);
446 initBoostTemperatureCurve(config->iatBoostCorrBins, config->iatBoostCorr, 1.0f);
447 initBoostTemperatureCurve(config->cltBoostAdderBins, config->cltBoostAdder, 0.0f);
448 initBoostTemperatureCurve(config->iatBoostAdderBins, config->iatBoostAdder, 0.0f);
449
452
455
456 setLinearCurve(config->scriptCurve2Bins, 0, 100, /*precision*/1);
457 setLinearCurve(config->scriptCurve2, 30, 170, 1);
458
463
464 setLinearCurve(config->alsIgnRetardLoadBins, 2, 10, /*precision*/1);
466 setLinearCurve(config->alsFuelAdjustmentLoadBins, 2, 10, /*precision*/1);
469
470
475
476#if VVT_TABLE_SIZE == 8
479#else
482#endif
485
487
488 // is this same old setCommonNTCSensor?
489 engineConfiguration->clt.config = {0, 23.8889, 48.8889, 9500, 2100, 1000, 1500};
490
492
493 // wow unit tests have much cooler setDefaultLaunchParameters method
495// engineConfiguration->launchTimingRetard = 10;
498
500
501 /**
502 * Idle control defaults
503 */
505 // setTargetRpmCurve(1200);
506
509
512 /**
513 * between variation between different sensor and weather and fabrication tolerance
514 * five percent looks like a safer default
515 */
517
518 engineConfiguration->idle.solenoidFrequency = DEFAULT_SOLENOID_FREQUENCY;
519 // set idle_position 50
521// engineConfiguration->idleMode = IM_AUTO;
523
525
527
528#if !EFI_UNIT_TEST
530#endif
531
532
537
542
543 engineConfiguration->idlePositionMin = PACK_MULT_VOLTAGE * 0;
544 engineConfiguration->idlePositionMax = PACK_MULT_VOLTAGE * 5;
549
553 engineConfiguration->oilPressure.value2 = 689.476f; // 100psi = 689.476kPa
554
556 // todo: start using this for custom MAP
558
560
562
563 setEgoSensor(ES_14Point7_Free);
564
566
567 engineConfiguration->map.sensor.type = MT_MPX4250;
568
572
573#if EFI_PROD_CODE
575#else
576 // need more events for automated test
578#endif
579
580#if EFI_PROD_CODE || EFI_SIMULATOR
581 // some tests broke with map averaging, see https://github.com/rusefi/rusefi/issues/7868
583#endif
585
592
599
600 engineConfiguration->triggerSimulatorRpm = DEFAULT_SELT_STIM_RPM;
601 engineConfiguration->simulatorCamPosition[0] = DEFAULT_SELT_STIM_VVT0;
602
603 engineConfiguration->alternatorPwmFrequency = DEFAULT_SOLENOID_FREQUENCY;
604
606
611
613 // todo: default limits should be hard-coded for each sensor type
614 // https://github.com/rusefi/rusefi/issues/4030
616
618#endif // EFI_ENGINE_CONTROL
619 #include "default_script.lua"
620}
void setDefaultBoostParameters()
void setBoschHDEV_5_injectors()
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
void setDefaultBaseEngine()
void setDefaultCranking()
void setDefaultFuel()
void setDefaultIgnition()
void setEgoSensor(ego_sensor_e type)
Definition ego.cpp:100
void setDefaultEtbParameters()
void setDefaultEtbBiasCurve()
static void setDefaultBoostOpenLoopParameters()
static void setDefaultGppwmParameters()
static void setDefaultIdleOpenLoopParameters()
static void setDefaultScriptParameters()
static void setDefaultEngineNoiseTable()
static void setDefaultIdleSpeedTarget()
static void setDefaultCanSettings()
persistent_config_container_s persistentState
void setDefaultIdleParameters()
void setBosch0280218037()
Definition maf.cpp:25
scaled_channel< uint8_t, 1, 100 > iacCoastingRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint16_t, 1000, 1 > fuelLevelBins[FUEL_LEVEL_TABLE_COUNT]
scaled_channel< uint16_t, 10, 1 > throttleEstimateEffectiveAreaBins[THR_EST_SIZE]
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)
void setCommonNTCSensorParameters(ThermistorConf *thermistorConf)
constexpr int convertVoltageTo10bitADC(float voltage)
Definition tps.h:21

Referenced by resetConfigurationExt().

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

◆ setDefaultEngineNoiseTable()

static void setDefaultEngineNoiseTable ( )
static

Definition at line 318 of file engine_configuration.cpp.

Referenced by setDefaultEngineConfiguration().

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

◆ setDefaultGppwmParameters()

static void setDefaultGppwmParameters ( )
static

Definition at line 280 of file engine_configuration.cpp.

280 {
281 // Same config for all channels
282 for (size_t i = 0; i < efi::size(engineConfiguration->gppwm); i++) {
283 auto& cfg = engineConfiguration->gppwm[i];
284 chsnprintf(engineConfiguration->gpPwmNote[i], sizeof(engineConfiguration->gpPwmNote[0]), "GPPWM%d", i);
285
286 // Set default axes
287 cfg.loadAxis = GPPWM_Zero;
288 cfg.rpmAxis = GPPWM_Rpm;
289
290 cfg.pin = Gpio::Unassigned;
291 cfg.dutyIfError = 0;
292 cfg.onAboveDuty = 60;
293 cfg.offBelowDuty = 50;
294 cfg.pwmFrequency = 250;
295
296 for (size_t j = 0; j < efi::size(cfg.loadBins); j++) {
297 uint8_t z = j * 100 / (efi::size(cfg.loadBins) - 1);
298 cfg.loadBins[j] = z;
299
300 // Fill some values in the table
301 for (size_t k = 0; k < efi::size(cfg.rpmBins); k++) {
302 cfg.table[j][k] = z;
303 }
304
305 }
306
307 for (size_t j = 0; j < efi::size(cfg.rpmBins); j++) {
308 cfg.rpmBins[j] = 1000 * j;
309 }
310 }
311}
@ Unassigned

Referenced by setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ setDefaultIdleOpenLoopParameters()

static void setDefaultIdleOpenLoopParameters ( )
static

Definition at line 356 of file engine_configuration.cpp.

356 {
358 setLinearCurve(config->cltIdleCorrBins, CLT_CURVE_RANGE_FROM, 140, 10);
359 for (size_t i = 0; i < CLT_IDLE_TABLE_RPM_SIZE; i++) {
360 setLinearCurve(config->cltIdleCorrTable[i], 75.0, 50, 5);
361 }
362}
float cltIdleCorrTable[CLT_IDLE_TABLE_RPM_SIZE][CLT_IDLE_TABLE_CLT_SIZE]
scaled_channel< uint8_t, 1, 100 > rpmIdleCorrBins[CLT_IDLE_TABLE_RPM_SIZE]

Referenced by setDefaultEngineConfiguration().

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

◆ setDefaultIdleSpeedTarget()

static void setDefaultIdleSpeedTarget ( )
static

see also setTargetRpmCurve()

Definition at line 264 of file engine_configuration.cpp.

264 {
265#if CLT_CURVE_SIZE == 16
266 copyArray(config->cltIdleRpmBins, { -30, - 20, -10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 , 110, 120 });
267 copyArray(config->cltIdleRpm, { 1350, 1350, 1300, 1200, 1150, 1100, 1050, 1000, 1000, 950, 950, 930, 900, 900, 1000, 1100 });
268#endif // CLT_CURVE_SIZE
269}
scaled_channel< int16_t, 1, 1 > cltIdleRpmBins[CLT_CURVE_SIZE]
scaled_channel< uint8_t, 1, 20 > cltIdleRpm[CLT_CURVE_SIZE]

Referenced by setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ setDefaultScriptParameters()

static void setDefaultScriptParameters ( )
static

Definition at line 345 of file engine_configuration.cpp.

345 {
354}

Referenced by setDefaultEngineConfiguration().

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

◆ setDefaultSdCardParameters()

void setDefaultSdCardParameters ( )

Definition at line 255 of file engine_configuration.cpp.

Referenced by f407_discovery_DefaultConfiguration().

Here is the caller graph for this function:

◆ setFuelTablesLoadBin()

void setFuelTablesLoadBin ( float  minValue,
float  maxValue 
)

Definition at line 187 of file engine_configuration.cpp.

187 {
188 setLinearCurve(config->injPhaseLoadBins, minValue, maxValue, 1);
189 setLinearCurve(config->veLoadBins, minValue, maxValue, 1);
190 setLinearCurve(config->lambdaLoadBins, minValue, maxValue, 1);
191}

Referenced by setDefaultFuel(), setDodgeNeonNGCEngineConfiguration(), and setVwAba().

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

◆ setTargetRpmCurve()

void setTargetRpmCurve ( float  rpm)

see also setDefaultIdleSpeedTarget()

Definition at line 275 of file engine_configuration.cpp.

275 {
276 setLinearCurve(config->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10);
277 setLinearCurve(config->cltIdleRpm, rpm, rpm, 10);
278}

Referenced by setGy6139qmbDefaultEngineConfiguration(), and setTargetIdleRpm().

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

◆ setWholeIatCorrTimingTable()

void setWholeIatCorrTimingTable ( float  value)

Definition at line 193 of file engine_configuration.cpp.

193 {
195}
scaled_channel< int16_t, 10, 1 > ignitionIatCorrTable[IAT_IGN_CORR_LOAD_COUNT][IAT_IGN_CORR_COUNT]
constexpr void setTable(TElement(&dest)[N][M], const VElement value)

Referenced by setTestCamEngineConfiguration().

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

◆ setWholeTimingTable()

void setWholeTimingTable ( angle_t  value)

See also crankingTimingAngle

Definition at line 200 of file engine_configuration.cpp.

200 {
202}
scaled_channel< int16_t, 10, 1 > ignitionTable[IGN_LOAD_COUNT][IGN_RPM_COUNT]

Referenced by setDodgeNeon1995EngineConfiguration(), setVwAba(), and testEngine6451().

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

◆ wipeStrings()

static void wipeStrings ( )
static

Definition at line 108 of file engine_configuration.cpp.

Referenced by onBurnRequest().

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

Variable Documentation

◆ activeConfiguration

◆ activeConfigurationLocalStorage

engine_configuration_s activeConfigurationLocalStorage
static

Definition at line 88 of file engine_configuration.cpp.

◆ custom_board_ConfigOverrides

std::optional<setup_custom_board_overrides_type> custom_board_ConfigOverrides

◆ custom_board_DefaultConfiguration

std::optional<setup_custom_board_overrides_type> custom_board_DefaultConfiguration

Definition at line 70 of file engine_configuration.cpp.

Referenced by resetConfigurationExt(), and setup_custom_board_overrides().

◆ custom_board_OnConfigurationChange

std::optional<setup_custom_board_config_type> custom_board_OnConfigurationChange

◆ hasRememberedConfiguration

bool hasRememberedConfiguration = false
static

Current engine configuration. On firmware start we assign empty configuration, then we copy actual configuration after reading settings from flash. This is useful to compare old/current (activeConfiguration) and new/future (engineConfiguration) configurations in order to apply new settings.

todo: place this field next to 'engineConfiguration'?

Definition at line 81 of file engine_configuration.cpp.

Referenced by incrementGlobalConfigurationVersion(), and rememberCurrentConfiguration().

◆ isActiveConfigurationVoid

bool isActiveConfigurationVoid = true

Go to the source code of this file.