clean up timing table defaults (#3705)
* less crazy configs * cleanup * make that test happy
This commit is contained in:
parent
a7961852de
commit
0810198185
|
@ -16,13 +16,7 @@
|
|||
#include "GY6_139QMB.h"
|
||||
#include "advance_map.h"
|
||||
|
||||
static void setDefault139qmbMaps() {
|
||||
setTimingLoadBin(1.2, 4.4);
|
||||
setTimingRpmBin(1000, 11000);
|
||||
}
|
||||
|
||||
void setGy6139qmbDefaultEngineConfiguration() {
|
||||
setDefault139qmbMaps();
|
||||
// engineConfiguration->map.sensor.type = MT_3V_SENSOR;
|
||||
setEgoSensor(ES_NarrowBand);
|
||||
|
||||
|
|
|
@ -38,9 +38,6 @@ static const int8_t default_aspire_timing_table[16][16] = {
|
|||
#endif
|
||||
|
||||
static void setDefaultAspireMaps() {
|
||||
setTimingLoadBin(1.2, 4.4);
|
||||
setTimingRpmBin(800, 7000);
|
||||
|
||||
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
|
||||
copyTable(config->ignitionTable, default_aspire_timing_table);
|
||||
#endif
|
||||
|
|
|
@ -53,8 +53,6 @@ static void setHondaAccordConfigurationCommon() {
|
|||
|
||||
setAlgorithm(LM_SPEED_DENSITY);
|
||||
|
||||
buildTimingMap(35);
|
||||
|
||||
/**
|
||||
* 18K Ohm @ -20C
|
||||
* 2.1K Ohm @ 24C
|
||||
|
|
|
@ -249,43 +249,4 @@ float getTopAdvanceForBore(chamber_style_e style, int octane, double compression
|
|||
return ((int)(result * 10)) / 10.0;
|
||||
}
|
||||
|
||||
float getAdvanceForRpm(int rpm, float advanceMax) {
|
||||
if (rpm >= 3000)
|
||||
return advanceMax;
|
||||
if (rpm < 600)
|
||||
return 10;
|
||||
return interpolateMsg("advance", 600, 10, 3000, advanceMax, rpm);
|
||||
}
|
||||
|
||||
#define round10(x) efiRound(x, 0.1)
|
||||
|
||||
float getInitialAdvance(int rpm, float map, float advanceMax) {
|
||||
map = minF(map, 100);
|
||||
float advance = getAdvanceForRpm(rpm, advanceMax);
|
||||
|
||||
if (rpm >= 3000)
|
||||
return round10(advance + 0.1 * (100 - map));
|
||||
return round10(advance + 0.1 * (100 - map) * rpm / 3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* this method builds a good-enough base timing advance map bases on a number of heuristics
|
||||
*/
|
||||
void buildTimingMap(float advanceMax) {
|
||||
if (engineConfiguration->fuelAlgorithm != LM_SPEED_DENSITY) {
|
||||
warning(CUSTOM_WRONG_ALGORITHM, "wrong algorithm for MAP-based timing");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* good enough (but do not trust us!) default timing map in case of MAP-based engine load
|
||||
*/
|
||||
for (int loadIndex = 0; loadIndex < IGN_LOAD_COUNT; loadIndex++) {
|
||||
float load = config->ignitionLoadBins[loadIndex];
|
||||
for (int rpmIndex = 0;rpmIndex<IGN_RPM_COUNT;rpmIndex++) {
|
||||
float rpm = config->ignitionRpmBins[rpmIndex];
|
||||
config->ignitionTable[loadIndex][rpmIndex] = getInitialAdvance(rpm, load, advanceMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
|
|
|
@ -49,6 +49,45 @@ static void setDefaultIatTimingCorrection() {
|
|||
#endif /* IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT */
|
||||
}
|
||||
|
||||
static float getAdvanceForRpm(int rpm, float advanceMax) {
|
||||
if (rpm >= 3000)
|
||||
return advanceMax;
|
||||
if (rpm < 600)
|
||||
return 10;
|
||||
return interpolateMsg("advance", 600, 10, 3000, advanceMax, rpm);
|
||||
}
|
||||
|
||||
#define round10(x) efiRound(x, 0.1)
|
||||
|
||||
float getInitialAdvance(int rpm, float map, float advanceMax) {
|
||||
map = minF(map, 100);
|
||||
float advance = getAdvanceForRpm(rpm, advanceMax);
|
||||
|
||||
if (rpm >= 3000)
|
||||
return round10(advance + 0.1 * (100 - map));
|
||||
return round10(advance + 0.1 * (100 - map) * rpm / 3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* this method builds a good-enough base timing advance map bases on a number of heuristics
|
||||
*/
|
||||
static void buildTimingMap(float advanceMax) {
|
||||
if (engineConfiguration->fuelAlgorithm != LM_SPEED_DENSITY) {
|
||||
warning(CUSTOM_WRONG_ALGORITHM, "wrong algorithm for MAP-based timing");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* good enough (but do not trust us!) default timing map in case of MAP-based engine load
|
||||
*/
|
||||
for (int loadIndex = 0; loadIndex < IGN_LOAD_COUNT; loadIndex++) {
|
||||
float load = config->ignitionLoadBins[loadIndex];
|
||||
for (int rpmIndex = 0;rpmIndex<IGN_RPM_COUNT;rpmIndex++) {
|
||||
float rpm = config->ignitionRpmBins[rpmIndex];
|
||||
config->ignitionTable[loadIndex][rpmIndex] = getInitialAdvance(rpm, load, advanceMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setDefaultIgnition() {
|
||||
// Ignition base settings
|
||||
engineConfiguration->isIgnitionEnabled = true;
|
||||
|
@ -63,9 +102,9 @@ void setDefaultIgnition() {
|
|||
setDefaultMultisparkParameters();
|
||||
|
||||
// Ignition advance table
|
||||
// TODO: populate some values that aren't all 0?
|
||||
setTimingLoadBin(1.2, 4.4);
|
||||
setLinearCurve(config->ignitionLoadBins, 20, 120, 3);
|
||||
setTimingRpmBin(800, 7000);
|
||||
buildTimingMap(35);
|
||||
|
||||
engineConfiguration->trailingSparkAngle = 10;
|
||||
|
||||
|
|
|
@ -476,10 +476,6 @@ void setTimingLoadBin(float from, float to) {
|
|||
*/
|
||||
void setAlgorithm(engine_load_mode_e algo) {
|
||||
engineConfiguration->fuelAlgorithm = algo;
|
||||
if (algo == LM_SPEED_DENSITY) {
|
||||
setLinearCurve(config->ignitionLoadBins, 20, 120, 3);
|
||||
buildTimingMap(35);
|
||||
}
|
||||
}
|
||||
|
||||
void setFlatInjectorLag(float value) {
|
||||
|
|
|
@ -688,20 +688,6 @@ static void showPinFunction(const char *pinName) {
|
|||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
static void setTimingMap(const char * rpmStr, const char *loadStr, const char *valueStr) {
|
||||
float rpm = atoff(rpmStr);
|
||||
float engineLoad = atoff(loadStr);
|
||||
float value = atoff(valueStr);
|
||||
|
||||
int rpmIndex = findIndexMsg("setTM", config->ignitionRpmBins, IGN_RPM_COUNT, rpm);
|
||||
rpmIndex = rpmIndex < 0 ? 0 : rpmIndex;
|
||||
int loadIndex = findIndexMsg("setTM", config->ignitionLoadBins, IGN_LOAD_COUNT, engineLoad);
|
||||
loadIndex = loadIndex < 0 ? 0 : loadIndex;
|
||||
|
||||
config->ignitionTable[loadIndex][rpmIndex] = value;
|
||||
efiPrintf("Setting timing map entry %d:%d to %.2f", rpmIndex, loadIndex, value);
|
||||
}
|
||||
|
||||
static void setSpiMode(int index, bool mode) {
|
||||
switch (index) {
|
||||
case 1:
|
||||
|
@ -1222,8 +1208,6 @@ void initSettings(void) {
|
|||
addConsoleActionF("set_whole_ve_map", setWholeVeCmd);
|
||||
addConsoleActionF("set_whole_ign_corr_map", setWholeIgnitionIatCorr);
|
||||
|
||||
addConsoleActionSSS("set_timing_map", setTimingMap);
|
||||
|
||||
addConsoleAction("stopengine", (Void) scheduleStopEngine);
|
||||
|
||||
// todo: refactor this - looks like all boolean flags should be controlled with less code duplication
|
||||
|
|
|
@ -60,6 +60,8 @@ TEST(ignition, trailingSpark) {
|
|||
|
||||
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||
|
||||
setWholeTimingTable(0);
|
||||
|
||||
eth.fireTriggerEventsWithDuration(20);
|
||||
// still no RPM since need to cycles measure cycle duration
|
||||
eth.fireTriggerEventsWithDuration(20);
|
||||
|
|
Loading…
Reference in New Issue