auto-sync

This commit is contained in:
rusEfi 2015-12-31 13:02:19 -05:00
parent 5fbbe630a9
commit ca5ee711af
17 changed files with 95 additions and 56 deletions

View File

@ -431,9 +431,9 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->canNbcType = CAN_BUS_NBC_BMW;
// engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
engineConfiguration->mapAccelLength = 12;
engineConfiguration->mapAccelEnrichmentThreshold = 5; // kPa
engineConfiguration->mapAccelEnrichmentMultiplier = 0;
engineConfiguration->engineLoadAccelLength = 12;
engineConfiguration->engineLoadAccelEnrichmentThreshold = 5; // kPa
engineConfiguration->engineLoadAccelEnrichmentMultiplier = 0;
engineConfiguration->tpsAccelLength = 12;
engineConfiguration->tpsAccelEnrichmentThreshold = 10;

View File

@ -24,6 +24,7 @@
#include "honda_accord.h"
#include "engine_math.h"
#include "settings.h"
#include "advance_map.h"
void setFrankenso_01_LCD(board_configuration_s *boardConfiguration) {
boardConfiguration->HD44780_rs = GPIOE_7;
@ -53,11 +54,11 @@ static void setHondaAccordConfigurationCommon(DECLARE_ENGINE_PARAMETER_F) {
// Keihin 06164-P0A-A00
engineConfiguration->injector.flow = 248;
// engineConfiguration->algorithm = LM_SPEED_DENSITY;
// I want to start with a simple Alpha-N
setAlgorithm(LM_ALPHA_N PASS_ENGINE_PARAMETER);
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
setFuelLoadBin(0, 100 PASS_ENGINE_PARAMETER);
buildTimingMap(35 PASS_ENGINE_PARAMETER);
/**
* 18K Ohm @ -20C
* 2.1K Ohm @ 24C

View File

@ -79,9 +79,9 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->map.sensor.type = MT_SUBY_DENSO;
// http://s2.micp.ru/vJ9Sd.png
engineConfiguration->mapAccelLength = 12;
engineConfiguration->mapAccelEnrichmentThreshold = 1;
engineConfiguration->mapAccelEnrichmentMultiplier = 0.25;
engineConfiguration->engineLoadAccelLength = 12;
engineConfiguration->engineLoadAccelEnrichmentThreshold = 1;
engineConfiguration->engineLoadAccelEnrichmentMultiplier = 0.25;
engineConfiguration->tpsAccelLength = 12;
engineConfiguration->tpsAccelEnrichmentThreshold = 10;

View File

@ -88,7 +88,7 @@ typedef struct {
float veValue; // current volumetric efficiency, offset 112
float deltaTps;
int triggerErrorsCounter;
float currentMapAccelDelta;
float currentEngineLoadAccelDelta;
float tpsAccelFuel; // offset 128
float baroCorrection;
float pedalPosition;

View File

@ -31,17 +31,17 @@
static LoggingWithStorage logger("console");
static char fatalErrorMessage[200];
//static char fatalErrorMessage[200];
void fatal3(char *msg, char *file, int line) {
strncpy(fatalErrorMessage, msg, sizeof(fatalErrorMessage) - 1);
fatalErrorMessage[sizeof(fatalErrorMessage) - 1] = 0; // just to be sure
#if EFI_CUSTOM_PANIC_METHOD
chDbgPanic3(fatalErrorMessage, file, line);
#else
chDbgPanic(fatalErrorMessage);
#endif
}
//void fatal3(char *msg, char *file, int line) {
// strncpy(fatalErrorMessage, msg, sizeof(fatalErrorMessage) - 1);
// fatalErrorMessage[sizeof(fatalErrorMessage) - 1] = 0; // just to be sure
//#if EFI_CUSTOM_PANIC_METHOD
// chDbgPanic3(fatalErrorMessage, file, line);
//#else
// chDbgPanic(fatalErrorMessage);
//#endif
//}
static void myfatal(void) {
chDbgCheck(0, "my fatal");

View File

@ -593,7 +593,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->manifold_air_pressure = getMap();
tsOutputChannels->engineLoad = engineLoad;
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
tsOutputChannels->currentMapAccelDelta = engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
tsOutputChannels->currentEngineLoadAccelDelta = engine->engineLoadAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;

View File

@ -76,8 +76,8 @@ floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) {
float AccelEnrichmemnt::getMapEnrichment(DECLARE_ENGINE_PARAMETER_F) {
float d = getDelta();
if (d > engineConfiguration->mapAccelEnrichmentThreshold) {
return d * engineConfiguration->mapAccelEnrichmentMultiplier;
if (d > engineConfiguration->engineLoadAccelEnrichmentThreshold) {
return d * engineConfiguration->engineLoadAccelEnrichmentMultiplier;
}
// if (d < engineConfiguration->deaccelEnrichmentThreshold) {
// return d * engineConfiguration->deaccelEnrichmentMultiplier;
@ -117,7 +117,7 @@ AccelEnrichmemnt::AccelEnrichmemnt() {
static void accelInfo() {
// scheduleMsg(logger, "MAP accel length=%d", mapInstance.cb.getSize());
scheduleMsg(logger, "MAP accel th=%f/mult=%f", engineConfiguration->mapAccelEnrichmentThreshold, engineConfiguration->mapAccelEnrichmentMultiplier);
scheduleMsg(logger, "MAP accel th=%f/mult=%f", engineConfiguration->engineLoadAccelEnrichmentThreshold, engineConfiguration->engineLoadAccelEnrichmentMultiplier);
scheduleMsg(logger, "MAP decel th=%f/mult=%f", engineConfiguration->decelEnleanmentThreshold, engineConfiguration->decelEnleanmentMultiplier);
// scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize());
@ -126,13 +126,13 @@ static void accelInfo() {
scheduleMsg(logger, "added to wall=%f/sucked=%f", engineConfiguration->addedToWallCoef, engineConfiguration->suckedOffCoef);
}
static void setMapAccelThr(float value) {
engineConfiguration->mapAccelEnrichmentThreshold = value;
static void setengineLoadAccelThr(float value) {
engineConfiguration->engineLoadAccelEnrichmentThreshold = value;
accelInfo();
}
static void setMapAccelMult(float value) {
engineConfiguration->mapAccelEnrichmentMultiplier = value;
static void setengineLoadAccelMult(float value) {
engineConfiguration->engineLoadAccelEnrichmentMultiplier = value;
accelInfo();
}
@ -165,12 +165,12 @@ static void setTpsAccelLen(int len) {
accelInfo();
}
static void setMapAccelLen(int len) {
static void setengineLoadAccelLen(int len) {
if (len < 1) {
scheduleMsg(logger, "Length should be positive");
return;
}
engine->mapAccelEnrichment.cb.setSize(len);
engine->engineLoadAccelEnrichment.cb.setSize(len);
accelInfo();
}
@ -180,14 +180,14 @@ void initAccelEnrichment(Logging *sharedLogger) {
addConsoleActionF("set_tps_accel_threshold", setTpsAccelThr);
addConsoleActionF("set_tps_accel_multiplier", setTpsAccelMult);
addConsoleActionI("set_map_accel_len", setMapAccelLen);
addConsoleActionF("set_map_accel_threshold", setMapAccelThr);
addConsoleActionF("set_map_accel_multiplier", setMapAccelMult);
addConsoleActionI("set_map_accel_len", setengineLoadAccelLen);
addConsoleActionF("set_map_accel_threshold", setengineLoadAccelThr);
addConsoleActionF("set_map_accel_multiplier", setengineLoadAccelMult);
addConsoleActionF("set_decel_threshold", setDecelThr);
addConsoleActionF("set_decel_multiplier", setDecelMult);
addConsoleAction("accelinfo", accelInfo);
setMapAccelLen(engineConfiguration->mapAccelLength);
setengineLoadAccelLen(engineConfiguration->engineLoadAccelLength);
setTpsAccelLen(engineConfiguration->tpsAccelLength);
}
#endif /* ! EFI_UNIT_TEST */

View File

@ -147,3 +147,37 @@ float getTopAdvanceForBore(chamber_style_e style, int octane, double compression
float result = base + octaneCorrection + compressionCorrection + boreCorrection;
return ((int)(result * 10)) / 10.0;
}
float getAdvanceForRpm(int rpm, float advanceMax) {
if (rpm >= 3000)
return advanceMax;
if (rpm < 600)
return 10;
return interpolate(600, 10, 3000, advanceMax, rpm);
}
#define round10(x) efiRound(x, 0.1)
float getInitialAdvance(int rpm, float map, float advanceMax) {
float advance = getAdvanceForRpm(rpm, advanceMax);
return round10(advance + 0.3 * (100 - map));
}
void buildTimingMap(float advanceMax DECLARE_ENGINE_PARAMETER_S) {
if (engineConfiguration->algorithm != LM_SPEED_DENSITY &&
engineConfiguration->algorithm != LM_MAP) {
warning(OBD_PCM_Processor_Fault, "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->ignitionLoadBins[loadIndex];
config->ignitionTable[loadIndex][rpmIndex] = getInitialAdvance(rpm, load, advanceMax);
}
}
}

View File

@ -14,5 +14,7 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S);
void setDefaultIatTimingCorrection(DECLARE_ENGINE_PARAMETER_F);
void prepareTimingMap(DECLARE_ENGINE_PARAMETER_F);
float getTopAdvanceForBore(chamber_style_e style, int octane, double compression, double bore);
float getInitialAdvance(int rpm, float map, float advanceMax);
void buildTimingMap(float advanceMax DECLARE_ENGINE_PARAMETER_S);
#endif /* ADVANCE_H_ */

View File

@ -205,7 +205,7 @@ public:
*/
efitick_t stopEngineRequestTimeNt;
AccelEnrichmemnt mapAccelEnrichment;
AccelEnrichmemnt engineLoadAccelEnrichment;
AccelEnrichmemnt tpsAccelEnrichment;
TriggerCentral triggerCentral;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Dec 28 17:33:44 EST 2015
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Dec 31 12:46:57 EST 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -1410,7 +1410,7 @@ typedef struct {
/**
* offset 2196
*/
int mapAccelLength;
int engineLoadAccelLength;
/**
* offset 2200
*/
@ -1422,11 +1422,11 @@ typedef struct {
/**
* offset 2208
*/
float mapAccelEnrichmentThreshold;
float engineLoadAccelEnrichmentThreshold;
/**
* offset 2212
*/
float mapAccelEnrichmentMultiplier;
float engineLoadAccelEnrichmentMultiplier;
/**
* offset 2216
*/
@ -1595,4 +1595,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Dec 28 17:33:44 EST 2015
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Dec 31 12:46:57 EST 2015

View File

@ -715,13 +715,13 @@
#define tpsAccelEnrichmentThreshold_offset 2188
#define tpsAccelEnrichmentMultiplier_offset 2192
#define tpsAccelEnrichmentMultiplier_offset_hex 890
#define mapAccelLength_offset 2196
#define mapAccelLength_offset_hex 894
#define engineLoadAccelLength_offset 2196
#define engineLoadAccelLength_offset_hex 894
#define decelEnleanmentThreshold_offset 2200
#define decelEnleanmentThreshold_offset_hex 898
#define decelEnleanmentMultiplier_offset 2204
#define mapAccelEnrichmentThreshold_offset 2208
#define mapAccelEnrichmentMultiplier_offset 2212
#define engineLoadAccelEnrichmentThreshold_offset 2208
#define engineLoadAccelEnrichmentMultiplier_offset 2212
#define fatalErrorPin_offset 2216
#define warninigPin_offset 2220
#define configResetPin_offset 2224

View File

@ -181,7 +181,7 @@ static ALWAYS_INLINE void handleFuel(bool_t limitedFuel, uint32_t eventIndex, in
engine->tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_F);
engine->mapAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
engine->engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
for (int i = 0; i < source->size; i++) {

View File

@ -614,12 +614,12 @@ baro_corr_table_t baroCorrTable;
float tpsAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float tpsAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
int mapAccelLength;;"len", 1, 0, 1, 200, 3
int engineLoadAccelLength;;"len", 1, 0, 1, 200, 3
float decelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3
float decelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3
float mapAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float mapAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
float engineLoadAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float engineLoadAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
brain_pin_e fatalErrorPin;

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Dec 28 17:33:44 EST 2015
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Dec 31 12:46:57 EST 2015
public class Fields {
public static final Field ENGINETYPE = new Field("ENGINETYPE", 0, FieldType.INT);
public static final Field UNUSEDOFFSET4 = new Field("UNUSEDOFFSET4", 4, FieldType.INT);
@ -449,11 +449,11 @@ public class Fields {
public static final Field TPSACCELLENGTH = new Field("TPSACCELLENGTH", 2184, FieldType.INT);
public static final Field TPSACCELENRICHMENTTHRESHOLD = new Field("TPSACCELENRICHMENTTHRESHOLD", 2188, FieldType.FLOAT);
public static final Field TPSACCELENRICHMENTMULTIPLIER = new Field("TPSACCELENRICHMENTMULTIPLIER", 2192, FieldType.FLOAT);
public static final Field MAPACCELLENGTH = new Field("MAPACCELLENGTH", 2196, FieldType.INT);
public static final Field ENGINELOADACCELLENGTH = new Field("ENGINELOADACCELLENGTH", 2196, FieldType.INT);
public static final Field DECELENLEANMENTTHRESHOLD = new Field("DECELENLEANMENTTHRESHOLD", 2200, FieldType.FLOAT);
public static final Field DECELENLEANMENTMULTIPLIER = new Field("DECELENLEANMENTMULTIPLIER", 2204, FieldType.FLOAT);
public static final Field MAPACCELENRICHMENTTHRESHOLD = new Field("MAPACCELENRICHMENTTHRESHOLD", 2208, FieldType.FLOAT);
public static final Field MAPACCELENRICHMENTMULTIPLIER = new Field("MAPACCELENRICHMENTMULTIPLIER", 2212, FieldType.FLOAT);
public static final Field ENGINELOADACCELENRICHMENTTHRESHOLD = new Field("ENGINELOADACCELENRICHMENTTHRESHOLD", 2208, FieldType.FLOAT);
public static final Field ENGINELOADACCELENRICHMENTMULTIPLIER = new Field("ENGINELOADACCELENRICHMENTMULTIPLIER", 2212, FieldType.FLOAT);
public static final Field FATALERRORPIN = new Field("FATALERRORPIN", 2216, FieldType.INT, brain_pin_e);
public static final Field WARNINIGPIN = new Field("WARNINIGPIN", 2220, FieldType.INT, brain_pin_e);
public static final Field CONFIGRESETPIN = new Field("CONFIGRESETPIN", 2224, FieldType.INT, brain_pin_e);

View File

@ -170,10 +170,10 @@ void print(const char *format, ...) {
va_end(ap);
}
void fatal3(char *msg, char *file, int line) {
printf(msg);
exit(-1);
}
//void fatal3(char *msg, char *file, int line) {
// printf(msg);
// exit(-1);
//}
int warning(const char *fmt, ...) {
printf(fmt);

View File

@ -55,6 +55,8 @@ void testIgnitionMapGenerator(void) {
assertEquals(22.0, getTopAdvanceForBore(CS_SWIRL_TUMBLE, 89, 9, 101.6));
assertEquals(32.2, getTopAdvanceForBore(CS_SWIRL_TUMBLE, 89, 9, 145));
assertEquals(47.5, getInitialAdvance(2400, 40, 36));
assertEquals(54.0, getInitialAdvance(4400, 40, 36));
}
void testMafLookup(void) {