rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
engine_configuration.h
Go to the documentation of this file.
1/**
2 * @file engine_configuration.h
3 * @brief Main engine configuration data structure.
4 *
5 * @date Oct 30, 2013
6 * @author Andrey Belomutskiy, (c) 2012-2020
7 */
8
9#pragma once
10
12
13#ifndef DEFAULT_ENGINE_TYPE
14#define DEFAULT_ENGINE_TYPE engine_type_e::MINIMAL_PINS
15#endif
16
17#define WARMUP_CLT_EXTRA_FUEL_CURVE config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE
18#define IAT_FUEL_CORRECTION_CURVE config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE
19
20#define MOCK_UNDEFINED -1
21
22// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90826 Weak symbol does not work reliably on windows
23// https://sourceware.org/bugzilla/show_bug.cgi?id=9687 Weak symbols not working on mingw32
24// DEPRECATED see PUBLIC_API_WEAK
25#if !defined(IS_WINDOWS_COMPILER) || !IS_WINDOWS_COMPILER
26#define PUBLIC_API_WEAK_SOMETHING_WEIRD __attribute__((weak))
27#else
28#define PUBLIC_API_WEAK_SOMETHING_WEIRD
29#endif
30
33
35void setTargetRpmCurve(float rpm);
36void setFuelTablesLoadBin(float minValue, float maxValue);
37void setWholeIatCorrTimingTable(float value);
39void setConstantDwell(floatms_t dwellMs);
40
41// needed by bootloader
43
45
46void onBurnRequest();
47void incrementGlobalConfigurationVersion(const char * msg = "undef");
48
50
52
54
55#ifdef __cplusplus
56// because of 'Logging' class parameter these functions are visible only to C++ code but C code
58/**
59 * boardCallback is invoked after configuration reset but before specific engineType configuration
60 */
63
65#endif /* __cplusplus */
66
69void onBoardStandBy();
70void boardOnConfigurationChange(engine_configuration_s *previousConfiguration);
74
75int hackHellenBoardId(int detectedId);
76void applyEngineType(engine_type_e engineType);
77
78#if !EFI_UNIT_TEST
82#else // EFI_UNIT_TEST
85#endif // EFI_UNIT_TEST
86
87/**
88 * & is reference in C++ (not C)
89 * Ref is a pointer that:
90 * you access with dot instead of arrow
91 * Cannot be null
92 * This is about EFI_ACTIVE_CONFIGURATION_IN_FLASH
93 */
95
96#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
97// We store a special changeable copy of configuration is RAM, so we can just compare them
98#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
99#else
100// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash,
101// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable,
102// and then we consider 'x' as changed if it's just non-zero.
103extern bool isActiveConfigurationVoid;
104#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && (int)(engineConfiguration->x) != 0))
105#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
106
107#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
108
109// total number of outputs: low side + high side
static EngineAccessor engine
Definition engine.h:413
void setConstantDwell(floatms_t dwellMs)
Sets the same dwell time across the whole getRpm() range set dwell X.
void setBoardDefaultConfiguration()
Board-specific configuration defaults.
Gpio getWarningLedPin()
void onBurnRequest()
void setCamOperationMode()
void commonFrankensoAnalogInputs()
void setDefaultBasePins()
void incrementGlobalConfigurationVersion(const char *msg="undef")
int getBoardMetaLowSideOutputsCount()
void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e engineType)
int getBoardMetaDcOutputsCount()
void onBoardStandBy()
Gpio getCommsLedPin()
void setTargetRpmCurve(float rpm)
void setDefaultSdCardParameters()
static constexpr persistent_config_s * config
void setCrankOperationMode()
void boardOnConfigurationChange(engine_configuration_s *previousConfiguration)
void loadConfiguration()
int getBoardMetaOutputsCount()
void setWholeIatCorrTimingTable(float value)
engine_configuration_s & activeConfiguration
Gpio getRunningLedPin()
void rememberCurrentConfiguration()
void applyEngineType(engine_type_e engineType)
void setBoardConfigOverrides()
void(* configuration_callback_t)(engine_configuration_s *)
void setWholeTimingTable(angle_t value)
void emptyCallbackWithConfiguration(engine_configuration_s *engine)
static constexpr engine_configuration_s * engineConfiguration
persistent_config_container_s persistentState
bool isActiveConfigurationVoid
void setFuelTablesLoadBin(float minValue, float maxValue)
int hackHellenBoardId(int detectedId)
Gpio * getBoardMetaOutputs()
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration)
engine_type_e
float floatms_t
float angle_t