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

Functions

static void setDefaultAlternatorParameters ()
 
void setHpfpLobeProfileAngle (int lobes)
 
static void setDefaultHPFP ()
 
static void setGdiDefaults ()
 
void setGDIFueling ()
 
void setLeftRightBanksNeedBetterName ()
 
static void mc33810defaults ()
 
void setDynoDefaults ()
 
void defaultsOrFixOnBurn ()
 
void setDefaultBaseEngine ()
 
void setPPSInputs (adc_channel_e pps1, adc_channel_e pps2)
 
void setTPS1Inputs (adc_channel_e tps1, adc_channel_e tps2)
 
void setTPS1Calibration (uint16_t tpsMin, uint16_t tpsMax)
 
void setTPS1Calibration (uint16_t tpsMin, uint16_t tpsMax, uint16_t tps1SecondaryMin, uint16_t tps1SecondaryMax)
 
void setCustomMap (float lowValue, float mapLowValueVoltage, float highValue, float mapHighValueVoltage)
 
void setPPSCalibration (float primaryUp, float primaryDown, float secondaryUp, float secondaryDown)
 
void setEtbPID (float p, float i, float d)
 
void setInline4 ()
 
void setProteusEtbIO ()
 
void setupTLE9201 (Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
 
void setupTLE9201IncludingStepper (Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
 

Function Documentation

◆ defaultsOrFixOnBurn()

void defaultsOrFixOnBurn ( )

Definition at line 130 of file default_base_engine.cpp.

130 {
131 if (config->dynoCarCarMassKg == 0) {
133 }
134
137 }
138
141 }
142
145 }
148 }
149
152 }
155 }
158 }
159
162 }
163}
static bool isTuningDetectorUndefined()
static void setUserEnteredTuningDetector(uint8_t tuningDetector)
void setDynoDefaults()
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration

Referenced by setDefaultBaseEngine(), and validateConfigOnStartUpOrBurn().

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

◆ mc33810defaults()

static void mc33810defaults ( )
static

Definition at line 103 of file default_base_engine.cpp.

Referenced by setDefaultBaseEngine().

Here is the caller graph for this function:

◆ setCustomMap()

void setCustomMap ( float  lowValue,
float  mapLowValueVoltage,
float  highValue,
float  mapHighValueVoltage 
)

◆ setDefaultAlternatorParameters()

static void setDefaultAlternatorParameters ( )
static

Definition at line 14 of file default_base_engine.cpp.

Referenced by setDefaultBaseEngine().

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

◆ setDefaultBaseEngine()

void setDefaultBaseEngine ( )

Definition at line 165 of file default_base_engine.cpp.

165 {
166 // Base Engine Settings
169#if MAX_CYLINDER_COUNT >= 4
170 setInline4();
171#else
172 // todo: invoke more complete one cylinder default?
174#endif
175
176 for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
177 // one knock sensor by default. See also 'setLeftRightBanksNeedBetterName()'
178 // zero-based index
180 }
181
184
189
191
192#ifdef EFI_KLINE
193 engineConfiguration->kLinePeriodUs = 300 /* us*/;
195#endif
196
198
199 // it's useful to know what starting point is given tune based on
200 engineConfiguration->calibrationBirthday = compilationYear() * 10000 + compilationMonth() * 100 + compilationDay();
201
203
206
209
213
216
218
223
225
226 setLinearCurve(engineConfiguration->tractionControlSlipBins, /*from*/0.9, /*to*/1.2, 0.05);
228
230
232
235
236 engineConfiguration->fuelAlgorithm = engine_load_mode_e::LM_SPEED_DENSITY;
237 // let's have valid default while we still have the field
238 engineConfiguration->debugMode = DBG_EXECUTOR;
239
240
242 // this should not be below default rpm! maybe even make them equal?
244
245 // todo: this "2JZ" trigger is very powerful for many low tooth quantity applications
246 // todo: we might be getting closer to a re-name
247 // by the way 2GRFE intake likes position 160 / precision 20
248 // see also https://github.com/rusefi/rusefi/issues/7345
249 //
250 // 2JZ values
253
254 // Limits and Fallbacks
260
262
265
266 // CLT RPM limit table - just the X axis
267 copyArray(config->cltRevLimitRpmBins, { -20, 0, 40, 80 });
268
273// engineConfiguration->alsMinPps = 10;
277
279
284
285 // Trigger
287
288#if EFI_SIMULATOR
289 engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
291 engineConfiguration->vvtPins[0] = Gpio::A0; // a random unused pin needed to unblock startSimplePwmExt()
292#endif // EFI_SIMULATOR
293
294#if EFI_SIMULATOR
295 // R
296 config->tcuSolenoidTable[0][0] = 99;
297 config->tcuSolenoidTable[0][1] = 1;
298 config->tcuSolenoidTable[0][2] = 2;
299 config->tcuSolenoidTable[0][3] = 3;
300 config->tcuSolenoidTable[0][4] = 4;
301 config->tcuSolenoidTable[0][5] = 5;
302 // P/N
303 config->tcuSolenoidTable[1][0] = 10;
304 config->tcuSolenoidTable[1][1] = 11;
305 config->tcuSolenoidTable[1][2] = 12;
306 config->tcuSolenoidTable[1][3] = 13;
307 config->tcuSolenoidTable[1][4] = 14;
308 config->tcuSolenoidTable[1][5] = 15;
309 config->tcuSolenoidTable[1][6] = 16;
310 config->tcuSolenoidTable[1][7] = 17;
311 config->tcuSolenoidTable[1][8] = 18;
312 config->tcuSolenoidTable[1][9] = 19;
313 // 1
314 config->tcuSolenoidTable[2][0] = 20;
315 config->tcuSolenoidTable[2][1] = 21;
316 config->tcuSolenoidTable[2][2] = 22;
317 // 2
318 config->tcuSolenoidTable[3][0] = 30;
319 config->tcuSolenoidTable[3][1] = 31;
320 config->tcuSolenoidTable[3][3] = 33;
321 // 3
322 config->tcuSolenoidTable[4][0] = 40;
323 config->tcuSolenoidTable[4][1] = 41;
324 config->tcuSolenoidTable[4][4] = 44;
325 // 4
326 config->tcuSolenoidTable[5][0] = 50;
327 config->tcuSolenoidTable[5][1] = 51;
328 config->tcuSolenoidTable[5][5] = 55;
329
330 // [tag:runNotSquareTest] huh why is this not a unit test?!
331 config->scriptTable4[0][0] = 140;
332 config->scriptTable4[0][1] = 141;
333 config->scriptTable4[0][2] = 142;
334 config->scriptTable4[0][3] = 143;
335 config->scriptTable4[0][4] = 144;
336 config->scriptTable4[0][5] = 145;
337
338 config->scriptTable4[1][0] = 240;
339 config->scriptTable4[1][1] = 241;
340 config->scriptTable4[1][2] = 242;
341 config->scriptTable4[1][3] = 243;
342 config->scriptTable4[1][4] = 244;
343 config->scriptTable4[1][5] = 245;
344
345 config->scriptTable4[4][0] = 40;
346 config->scriptTable4[4][2] = 41;
347 config->scriptTable4[4][3] = 42;
348 config->scriptTable4[4][4] = 43;
349 config->scriptTable4[4][5] = 44;
350 config->scriptTable4[4][5] = 45;
351
352 config->scriptTable4[5][0] = 50;
353 config->scriptTable4[5][1] = 51;
354 config->scriptTable4[5][2] = 52;
355 config->scriptTable4[5][3] = 53;
356 config->scriptTable4[5][4] = 54;
357 config->scriptTable4[5][5] = 55;
358
359#endif // EFI_SIMULATOR
360
362
363 // Default this to on - if you want to diagnose, turn it off.
365
370
371 engineConfiguration->etbSplit = MAX_TPS_PPS_DISCREPANCY;
372
373 // Advanced Trigger
374
375 // Battery and alternator
376 engineConfiguration->vbattDividerCoeff = ((float) (15 + 65)) / 15;
377
378#if EFI_ALTERNATOR_CONTROL
380#endif /* EFI_ALTERNATOR_CONTROL */
381
382 // Fuel pump
383 // todo: maybe change to 2s as default?
385
386 engineConfiguration->kLineBaudRate = KLINE_BAUD_RATE;
387
391
392
393 // Tachometer
394 // 50% duty cycle is the default for tach signal
398
401
404
405 //knock
406#ifdef KNOCK_SPECTROGRAM
411#endif
412
413 // Check engine light
414#if EFI_PROD_CODE
416#else
418#endif /* EFI_PROD_CODE */
419
421
422 // Oil pressure protection
426
427 engine->engineModules.apply_all([](auto & m) { m.setDefaultConfiguration(); });
428 // we invoke this last so that we can validate even defaults
430}
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 defaultsOrFixOnBurn()
static void mc33810defaults()
void setInline4()
static void setDefaultAlternatorParameters()
static void setGdiDefaults()
static EngineAccessor engine
Definition engine.h:413
uint8_t tractionControlSpeedBins[TRACTION_CONTROL_ETB_DROP_SPEED_SIZE]
scaled_channel< uint16_t, 100, 1 > tractionControlSlipBins[TRACTION_CONTROL_ETB_DROP_SLIP_SIZE]
scaled_channel< uint8_t, 1, 100 > maximumOilPressureBins[4]
uint8_t tcuSolenoidTable[TCU_SOLENOID_COUNT][TCU_GEAR_COUNT]
scaled_channel< int16_t, 1, 1 > cltRevLimitRpmBins[CLT_LIMITER_CURVE_SIZE]
scaled_channel< uint8_t, 1, 100 > minimumOilPressureBins[8]
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)
void setDefaultVrThresholds()
Definition vr_pwm.cpp:57

Referenced by setDefaultEngineConfiguration().

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

◆ setDefaultHPFP()

static void setDefaultHPFP ( )
static

Definition at line 38 of file default_base_engine.cpp.

38 {
39#if ! EFI_UNIT_TEST
40 // unit tests rely on 'hpfpCamLobes' for isGdiEngine() and we need not-GDI by default for unit tests
42#endif
43
44// todo: would be nice for unit tests to be happy about these defaults
45#if EFI_PROD_CODE || EFI_SIMULATOR
47#endif
54}

Referenced by setGdiDefaults().

Here is the caller graph for this function:

◆ setDynoDefaults()

void setDynoDefaults ( )

Definition at line 109 of file default_base_engine.cpp.

109 {
110 config->dynoRpmStep = 100;
111
113 config->dynoSaeBaro = STD_ATMOSPHERE;
115
119
123
124 config->dynoCarCarMassKg = 1000;
128 }

Referenced by defaultsOrFixOnBurn().

Here is the caller graph for this function:

◆ setEtbPID()

void setEtbPID ( float  p,
float  i,
float  d 
)

◆ setGdiDefaults()

static void setGdiDefaults ( )
static

Definition at line 56 of file default_base_engine.cpp.

56 {
58
62
66
69}
static void setDefaultHPFP()
scaled_channel< uint16_t, 10, 1 > injectorFlowLinearizationPressureBins[FLOW_LINEARIZATION_PRESSURE_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpFuelMassCompensationFuelPressure[HPFP_FUEL_MASS_COMPENSATION_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpTargetRpmBins[HPFP_TARGET_SIZE]
uint16_t hpfpTarget[HPFP_TARGET_SIZE][HPFP_TARGET_SIZE]
scaled_channel< uint16_t, 100, 1 > injectorFlowLinearizationFuelMassBins[FLOW_LINEARIZATION_MASS_SIZE]
scaled_channel< uint16_t, 100, 1 > hpfpFuelMassCompensationFuelMass[HPFP_FUEL_MASS_COMPENSATION_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpTargetLoadBins[HPFP_TARGET_SIZE]
scaled_channel< uint16_t, 100, 1 > hpfpFuelMassCompensation[HPFP_FUEL_MASS_COMPENSATION_SIZE][HPFP_FUEL_MASS_COMPENSATION_SIZE]

Referenced by setDefaultBaseEngine().

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

◆ setGDIFueling()

void setGDIFueling ( )

Definition at line 71 of file default_base_engine.cpp.

71 {
72#ifdef HW_HELLEN_8CHAN
74#endif
75
76 engineConfiguration->injectionMode = IM_SEQUENTIAL;
78 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
79
81 // Use high pressure sensor
83 // Automatic compensation of injector flow based on rail pressure
84 engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
85 // Reference rail pressure is 10 000 kPa = 100 bar
87 //setting "flat" 0.2 ms injector's lag time
89
93}
void setGdiWallWetting()
scaled_channel< int16_t, 100, 1 > battLagCorrTable[VBAT_INJECTOR_CURVE_PRESSURE_SIZE][VBAT_INJECTOR_CURVE_SIZE]
int16_t injectionPhase[INJ_PHASE_LOAD_COUNT][INJ_PHASE_RPM_COUNT]

Referenced by alphax_4kgdi_defaultConfiguration(), commonPassatB6(), setGmGdi(), and setHyundaiPb().

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

◆ setHpfpLobeProfileAngle()

void setHpfpLobeProfileAngle ( int  lobes)

Definition at line 23 of file default_base_engine.cpp.

23 {
24#if HPFP_LOBE_PROFILE_SIZE == 16
25static const float hardCodedHpfpLobeProfileAnglesForThreeLobes[16] = {0.0, 7.5, 16.5, 24.0,
2632.0 , 40.0, 48.0, 56.0,
2764.0 , 72.0, 80.0, 88.0,
2896.0 , 103.5, 112.5, 120.0
29};
30
31 float multiplier = 3.0 / lobes;
32 for (size_t i = 0; i < HPFP_LOBE_PROFILE_SIZE; i++) {
33 config->hpfpLobeProfileAngle[i] = multiplier * hardCodedHpfpLobeProfileAnglesForThreeLobes[i];
34 }
35#endif // HPFP_LOBE_PROFILE_SIZE
36}
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileAngle[HPFP_LOBE_PROFILE_SIZE]

Referenced by set4CylGmEcotec3(), setBoschHDEV_5_injectors(), setFordEcoboost(), and setHyundaiPb().

Here is the caller graph for this function:

◆ setInline4()

void setInline4 ( )

◆ setLeftRightBanksNeedBetterName()

void setLeftRightBanksNeedBetterName ( )

file defaults.h

Definition at line 96 of file default_base_engine.cpp.

96 {
97 for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
98 // zero-based index
100 }
101}

Referenced by setGmLs4(), and setSubaruEG33Defaults().

Here is the caller graph for this function:

◆ setPPSCalibration()

void setPPSCalibration ( float  primaryUp,
float  primaryDown,
float  secondaryUp,
float  secondaryDown 
)

◆ setPPSInputs()

void setPPSInputs ( adc_channel_e  pps1,
adc_channel_e  pps2 
)

◆ setProteusEtbIO()

void setProteusEtbIO ( )

Definition at line 481 of file default_base_engine.cpp.

481 {
482#if HW_PROTEUS && EFI_PROD_CODE
483 engineConfiguration->tps1_2AdcChannel = PROTEUS_IN_TPS1_2;
484 setPPSInputs(PROTEUS_IN_PPS, PROTEUS_IN_PPS2);
485#endif // HW_PROTEUS
486}
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)

Referenced by proteusStimQc(), setHyundaiPb(), setMaverickX3(), setMercedesM111EngineConfiguration(), setProteusVwPassatB6(), setSlingshot(), and setSubaru2011().

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

◆ setTPS1Calibration() [1/2]

void setTPS1Calibration ( uint16_t  tpsMin,
uint16_t  tpsMax 
)

◆ setTPS1Calibration() [2/2]

void setTPS1Calibration ( uint16_t  tpsMin,
uint16_t  tpsMax,
uint16_t  tps1SecondaryMin,
uint16_t  tps1SecondaryMax 
)

Definition at line 447 of file default_base_engine.cpp.

447 {
448 setTPS1Calibration(tpsMin, tpsMax);
449
450
451 engineConfiguration->tps1SecondaryMin = tps1SecondaryMin;
452 engineConfiguration->tps1SecondaryMax = tps1SecondaryMax;
453}
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
Here is the call graph for this function:

◆ setTPS1Inputs()

void setTPS1Inputs ( adc_channel_e  tps1,
adc_channel_e  tps2 
)

Definition at line 437 of file default_base_engine.cpp.

437 {
440}
static RedundantPair tps2(tps2p, tps2s, SensorType::Tps2)

Referenced by alphax_4kgdi_defaultConfiguration(), m74_9_boardDefaultConfiguration(), setDefaultSensorInputs(), setGmEcotec3(), setGmLs4(), setHarley(), setMercedesM111EngineConfiguration(), and setupDefaultSensorInputs().

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

◆ setupTLE9201()

void setupTLE9201 ( Gpio  controlPin,
Gpio  direction,
Gpio  disable,
int  dcIndex 
)

Definition at line 488 of file default_base_engine.cpp.

488 {
489 // TLE9201 driver
490 // This chip has three control pins:
491 // DIR - sets direction of the motor
492 // PWM - pwm control (enable high, coast low)
493 // DIS - disables motor (enable low)
494
495 // PWM pin
496 engineConfiguration->etbIo[dcIndex].controlPin = controlPin;
497 // DIR pin
498 engineConfiguration->etbIo[dcIndex].directionPin1 = direction;
499 // Disable pin
501
502 // we only have pwm/dir, no dira/dirb
504}
static void disable(const char *param)
Definition settings.cpp:445

Referenced by alphax_4chan_defaultConfiguration(), alphax_4kgdi_boardConfigOverrides(), alphax_8chan_defaultConfiguration(), alphax_8chan_reva_boardDefaultConfiguration(), hellen154hyundai_f7_boardConfigOverrides(), hellen_gm_e67_boardConfigOverrides(), setupEtb(), and setupTLE9201IncludingStepper().

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

◆ setupTLE9201IncludingStepper()

void setupTLE9201IncludingStepper ( Gpio  controlPin,
Gpio  direction,
Gpio  disable,
int  dcIndex 
)

Definition at line 506 of file default_base_engine.cpp.

506 {
507 setupTLE9201(controlPin, direction, disable, dcIndex);
508
509 // on SBC style stepper IAC fully-extended valve shaft would give least idle air
510 // fully-retracted valve shaft would give most idle air
511 int stepperIndexWeirdness = 1 - dcIndex;
512 engineConfiguration->stepperDcIo[stepperIndexWeirdness].controlPin = controlPin;
513 engineConfiguration->stepperDcIo[stepperIndexWeirdness].directionPin1 = direction;
515 engineConfiguration->stepperDcIo[stepperIndexWeirdness].disablePin = disable;
516}
@ Unassigned
void setupTLE9201(Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)

Referenced by setDefaultETBPins(), and setMegaUaefiBoardDefaultConfiguration().

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

Go to the source code of this file.