rusefi/firmware/controllers/algo/defaults/default_base_engine.cpp

142 lines
4.3 KiB
C++
Raw Normal View History

#include "pch.h"
#include "defaults.h"
#include "vr_pwm.h"
static void setDefaultAlternatorParameters() {
engineConfiguration->alternatorOffAboveTps = 120;
engineConfiguration->targetVBatt = 14;
engineConfiguration->alternatorControl.offset = 0;
engineConfiguration->alternatorControl.pFactor = 30;
engineConfiguration->alternatorControl.periodMs = 100;
}
2022-10-25 18:54:26 -07:00
/* Cylinder to bank mapping */
void setLeftRightBanksNeedBetterName() {
for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
2022-10-25 18:54:26 -07:00
engineConfiguration->cylinderBankSelect[i] = i % 2;
}
}
void setDefaultBaseEngine() {
// Base Engine Settings
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.displacement = 2;
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
engineConfiguration->compressionRatio = 9;
2022-09-19 09:06:00 -07:00
engineConfiguration->turbochargerFilter = 0.01f;
engineConfiguration->fuelAlgorithm = LM_SPEED_DENSITY;
2022-01-21 12:22:11 -08:00
// let's have valid default while we still have the field
engineConfiguration->debugMode = DBG_INSTANT_RPM;
// Limits and Fallbacks
engineConfiguration->rpmHardLimit = 7000;
engineConfiguration->cutFuelOnHardLimit = true;
engineConfiguration->cutSparkOnHardLimit = true;
engineConfiguration->failedMapFallback = 60;
engineConfiguration->enableMapEstimationTableFallback = false;
2022-12-16 20:51:50 -08:00
engineConfiguration->ALSMinRPM = 400;
engineConfiguration->ALSMaxRPM = 3200;
engineConfiguration->ALSMaxDuration = 3.5;
2022-12-16 20:51:50 -08:00
engineConfiguration->ALSMaxCLT = 105;
// engineConfiguration->alsMinPps = 10;
2022-12-14 19:25:06 -08:00
engineConfiguration->alsMinTimeBetween = 5;
engineConfiguration->alsEtbPosition = 30;
engineConfiguration->ALSMaxTPS = 5;
2022-12-14 19:25:06 -08:00
// Trigger
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->globalTriggerAngleOffset = 0;
// Default this to on - if you want to diagnose, turn it off.
engineConfiguration->silentTriggerError = true;
// Advanced Trigger
// Battery and alternator
engineConfiguration->vbattDividerCoeff = ((float) (15 + 65)) / 15;
#if EFI_ALTERNATOR_CONTROL
setDefaultAlternatorParameters();
#endif /* EFI_ALTERNATOR_CONTROL */
// Fuel pump
engineConfiguration->startUpFuelPumpDuration = 4;
engineConfiguration->benchTestOnTime = 4;
engineConfiguration->benchTestOffTime = 500;
engineConfiguration->benchTestCount = 3;
// Fans
engineConfiguration->fanOnTemperature = 95;
engineConfiguration->fanOffTemperature = 91;
engineConfiguration->fan2OnTemperature = 95;
engineConfiguration->fan2OffTemperature = 91;
// Tachometer
// 50% duty cycle is the default for tach signal
engineConfiguration->tachPulseDurationAsDutyCycle = true;
engineConfiguration->tachPulseDuractionMs = 0.5;
engineConfiguration->tachPulsePerRev = 1;
engineConfiguration->etbMinimumPosition = 1;
engineConfiguration->etbMaximumPosition = 100;
engineConfiguration->tcuInputSpeedSensorTeeth = 1;
engineConfiguration->issFilterReciprocal = 2;
// Check engine light
#if EFI_PROD_CODE
engineConfiguration->warningPeriod = 10;
#else
engineConfiguration->warningPeriod = 0;
#endif /* EFI_PROD_CODE */
setDefaultVrThresholds();
}
2022-10-29 20:04:24 -07:00
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2) {
engineConfiguration->throttlePedalPositionAdcChannel = pps1;
engineConfiguration->throttlePedalPositionSecondAdcChannel = pps2;
2022-10-29 20:55:14 -07:00
}
2022-10-29 21:17:42 -07:00
void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2) {
engineConfiguration->tps1_1AdcChannel = tps1;
engineConfiguration->tps1_2AdcChannel = tps2;
}
2023-03-03 07:35:06 -08:00
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax) {
2022-11-04 09:37:28 -07:00
engineConfiguration->tpsMin = tpsMin;
engineConfiguration->tpsMax = tpsMax;
2023-03-03 07:35:06 -08:00
}
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax, uint16_t tps1SecondaryMin, uint16_t tps1SecondaryMax) {
setTPS1Calibration(tpsMin, tpsMax);
2022-11-04 09:37:28 -07:00
engineConfiguration->tps1SecondaryMin = tps1SecondaryMin;
engineConfiguration->tps1SecondaryMax = tps1SecondaryMax;
}
2022-10-29 20:55:14 -07:00
void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown) {
engineConfiguration->throttlePedalUpVoltage = primaryUp;
engineConfiguration->throttlePedalWOTVoltage = primaryDown;
engineConfiguration->throttlePedalSecondaryUpVoltage = secondaryUp;
engineConfiguration->throttlePedalSecondaryWOTVoltage = secondaryDown;
}
2022-11-04 10:27:40 -07:00
void setEtbPID(float p, float i, float d) {
engineConfiguration->etb.pFactor = p;
engineConfiguration->etb.iFactor = i;
engineConfiguration->etb.dFactor = d;
}