2021-07-25 22:05:17 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2021-06-03 11:40:19 -07:00
|
|
|
#include "defaults.h"
|
|
|
|
#include "table_helper.h"
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
static void setDefaultMultisparkParameters() {
|
2021-06-03 11:40:19 -07:00
|
|
|
// 1ms spark + 2ms dwell
|
|
|
|
engineConfiguration->multisparkSparkDuration = 1000;
|
|
|
|
engineConfiguration->multisparkDwell = 2000;
|
|
|
|
|
|
|
|
// Conservative defaults - probably won't blow up coils
|
|
|
|
engineConfiguration->multisparkMaxRpm = 1500;
|
|
|
|
engineConfiguration->multisparkMaxExtraSparkCount = 2;
|
|
|
|
engineConfiguration->multisparkMaxSparkingAngle = 30;
|
|
|
|
}
|
|
|
|
|
|
|
|
static constexpr float iatTimingRpmBins[] = { 880, 1260, 1640, 2020, 2400, 2780, 3000, 3380, 3760, 4140, 4520, 5000, 5700, 6500, 7200, 8000 };
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
static void setDefaultIatTimingCorrection() {
|
2021-06-03 11:40:19 -07:00
|
|
|
setLinearCurve(config->ignitionIatCorrLoadBins, /*from*/CLT_CURVE_RANGE_FROM, 110, 1);
|
|
|
|
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
|
|
|
|
copyArray(config->ignitionIatCorrRpmBins, iatTimingRpmBins);
|
|
|
|
|
|
|
|
static constexpr int8_t defaultIatCorr[16] = {
|
|
|
|
4, // -40 deg
|
|
|
|
4,
|
|
|
|
3,
|
|
|
|
2,
|
|
|
|
0, // 0 deg
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
-1, // 50 deg
|
|
|
|
-2,
|
|
|
|
-4,
|
|
|
|
-4,
|
|
|
|
-4,
|
|
|
|
-4,
|
|
|
|
-4, // 110 deg
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set each row of the table to the same value (no rpm dependence by default)
|
|
|
|
for (size_t i = 0; i < efi::size(defaultIatCorr); i++) {
|
|
|
|
setArrayValues(config->ignitionIatCorrTable[i], (float)defaultIatCorr[i]);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
setLinearCurve(config->ignitionIatCorrLoadBins, /*from*/0, 6000, 1);
|
|
|
|
#endif /* IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT */
|
|
|
|
}
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setDefaultIgnition() {
|
2021-06-03 11:40:19 -07:00
|
|
|
// Ignition base settings
|
2021-11-17 00:54:21 -08:00
|
|
|
engineConfiguration->isIgnitionEnabled = true;
|
2021-06-03 11:40:19 -07:00
|
|
|
|
|
|
|
engineConfiguration->timingMode = TM_DYNAMIC;
|
|
|
|
engineConfiguration->fixedModeTiming = 50;
|
|
|
|
|
|
|
|
// Dwell table
|
2021-11-16 01:15:29 -08:00
|
|
|
setConstantDwell(4);
|
2021-06-03 11:40:19 -07:00
|
|
|
|
|
|
|
// Multispark
|
2021-11-16 01:15:29 -08:00
|
|
|
setDefaultMultisparkParameters();
|
2021-06-03 11:40:19 -07:00
|
|
|
|
|
|
|
// Ignition advance table
|
|
|
|
// TODO: populate some values that aren't all 0?
|
2021-11-16 01:15:29 -08:00
|
|
|
setTimingLoadBin(1.2, 4.4);
|
|
|
|
setTimingRpmBin(800, 7000);
|
2021-06-03 11:40:19 -07:00
|
|
|
|
2021-07-09 07:14:00 -07:00
|
|
|
engineConfiguration->trailingSparkAngle = 10;
|
|
|
|
|
2021-06-03 11:40:19 -07:00
|
|
|
// CLT correction
|
|
|
|
setLinearCurve(engineConfiguration->cltTimingBins, CLT_CURVE_RANGE_FROM, 120, 1);
|
|
|
|
setArrayValues(engineConfiguration->cltTimingExtra, 0.0f);
|
|
|
|
|
|
|
|
// IAT correction
|
2021-11-16 01:15:29 -08:00
|
|
|
setDefaultIatTimingCorrection();
|
2021-06-03 11:40:19 -07:00
|
|
|
}
|