2021-07-25 22:05:17 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2021-06-02 14:50:07 -07:00
|
|
|
#include "defaults.h"
|
2022-05-17 14:54:11 -07:00
|
|
|
#include "vr_pwm.h"
|
2021-06-02 14:50:07 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
static void setDefaultAlternatorParameters() {
|
2021-06-02 14:50:07 -07:00
|
|
|
engineConfiguration->alternatorOffAboveTps = 120;
|
|
|
|
|
|
|
|
engineConfiguration->targetVBatt = 14;
|
|
|
|
|
|
|
|
engineConfiguration->alternatorControl.offset = 0;
|
|
|
|
engineConfiguration->alternatorControl.pFactor = 30;
|
|
|
|
engineConfiguration->alternatorControl.periodMs = 100;
|
|
|
|
}
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setDefaultBaseEngine() {
|
2021-06-02 14:50:07 -07:00
|
|
|
// Base Engine Settings
|
|
|
|
engineConfiguration->specs.cylindersCount = 4;
|
|
|
|
engineConfiguration->specs.displacement = 2;
|
|
|
|
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
|
|
|
|
|
2021-11-17 00:54:21 -08:00
|
|
|
engineConfiguration->compressionRatio = 9;
|
2021-06-02 14:50:07 -07:00
|
|
|
|
2021-06-03 11:40:19 -07:00
|
|
|
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;
|
2021-06-03 11:40:19 -07:00
|
|
|
|
2021-06-02 14:50:07 -07:00
|
|
|
// Limits and Fallbacks
|
|
|
|
engineConfiguration->rpmHardLimit = 7000;
|
|
|
|
engineConfiguration->cutFuelOnHardLimit = true;
|
|
|
|
engineConfiguration->cutSparkOnHardLimit = true;
|
|
|
|
|
|
|
|
engineConfiguration->failedMapFallback = 60;
|
|
|
|
engineConfiguration->enableMapEstimationTableFallback = false;
|
|
|
|
|
|
|
|
// Trigger
|
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
2022-04-03 03:58:25 -07:00
|
|
|
|
2021-06-02 14:50:07 -07:00
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
|
|
|
|
|
|
|
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
|
2021-11-16 01:15:29 -08:00
|
|
|
setDefaultAlternatorParameters();
|
2021-06-02 14:50:07 -07:00
|
|
|
#endif /* EFI_ALTERNATOR_CONTROL */
|
|
|
|
|
|
|
|
// Fuel pump
|
|
|
|
engineConfiguration->startUpFuelPumpDuration = 4;
|
|
|
|
|
2021-06-13 05:06:45 -07:00
|
|
|
// Fans
|
2021-06-02 14:50:07 -07:00
|
|
|
engineConfiguration->fanOnTemperature = 95;
|
|
|
|
engineConfiguration->fanOffTemperature = 91;
|
2021-06-13 05:06:45 -07:00
|
|
|
engineConfiguration->fan2OnTemperature = 95;
|
|
|
|
engineConfiguration->fan2OffTemperature = 91;
|
2021-06-02 14:50:07 -07:00
|
|
|
|
|
|
|
// Tachometer
|
|
|
|
// 50% duty cycle is the default for tach signal
|
2021-11-17 00:54:21 -08:00
|
|
|
engineConfiguration->tachPulseDurationAsDutyCycle = true;
|
|
|
|
engineConfiguration->tachPulseDuractionMs = 0.5;
|
|
|
|
engineConfiguration->tachPulsePerRev = 1;
|
2021-06-02 14:50:07 -07:00
|
|
|
|
2022-05-02 02:24:50 -07:00
|
|
|
engineConfiguration->etbMinimumPosition = 1;
|
|
|
|
engineConfiguration->etbMaximumPosition = 100;
|
2022-04-25 14:20:56 -07:00
|
|
|
|
|
|
|
engineConfiguration->tcuInputSpeedSensorTeeth = 1;
|
2022-04-25 14:42:19 -07:00
|
|
|
engineConfiguration->issFilterReciprocal = 2;
|
2022-04-25 14:20:56 -07:00
|
|
|
|
2021-06-02 14:50:07 -07:00
|
|
|
// Check engine light
|
|
|
|
#if EFI_PROD_CODE
|
|
|
|
engineConfiguration->warningPeriod = 10;
|
|
|
|
#else
|
|
|
|
engineConfiguration->warningPeriod = 0;
|
|
|
|
#endif /* EFI_PROD_CODE */
|
2022-05-17 14:54:11 -07:00
|
|
|
|
|
|
|
setDefaultVrThresholds();
|
|
|
|
|
2021-06-02 14:50:07 -07:00
|
|
|
}
|