auto-sync

This commit is contained in:
rusEfi 2015-02-12 21:04:12 -06:00
parent 4486ca0b51
commit 740e6ba22f
8 changed files with 96 additions and 111 deletions

View File

@ -192,8 +192,6 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
// set_injection_offset 0 // set_injection_offset 0
engineConfiguration->injectionAngle = 0; engineConfiguration->injectionAngle = 0;
setMap(engineConfiguration->fuelTable, -180);
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->injectionMode = IM_SEQUENTIAL;
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
@ -395,6 +393,8 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
engineConfiguration->canReadEnabled = false; engineConfiguration->canReadEnabled = false;
engineConfiguration->canNbcType = CAN_BUS_NBC_BMW; engineConfiguration->canNbcType = CAN_BUS_NBC_BMW;
// engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8; // engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
setMap(engineConfiguration->injectionPhase, -180);
} }
#endif /* EFI_SUPPORT_DODGE_NEON */ #endif /* EFI_SUPPORT_DODGE_NEON */

View File

@ -96,8 +96,8 @@ static LoggingWithStorage fileLogger("file logger");
static int logFileLineIndex = 0; static int logFileLineIndex = 0;
#define TAB "\t" #define TAB "\t"
static void reportSensorF(Logging *log, bool fileFormat, const char *caption, static void reportSensorF(Logging *log, bool fileFormat, const char *caption, const char *units, float value,
const char *units, float value, int precision) { int precision) {
if (!fileFormat) { if (!fileFormat) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
debugFloat(log, caption, value, precision); debugFloat(log, caption, value, precision);
@ -119,8 +119,7 @@ static void reportSensorF(Logging *log, bool fileFormat, const char *caption,
} }
} }
static void reportSensorI(Logging *log, bool fileFormat, const char *caption, static void reportSensorI(Logging *log, bool fileFormat, const char *caption, const char *units, int value) {
const char *units, int value) {
if (!fileFormat) { if (!fileFormat) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
@ -154,16 +153,18 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) {
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) #if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
reportSensorI(log, fileFormat, "rpm", "RPM", getRpmE(engine)); reportSensorI(log, fileFormat, "rpm", "RPM", getRpmE(engine));
reportSensorF(log, fileFormat, "TRG_0_DUTY", "%", getTriggerDutyCycle(0), reportSensorF(log, fileFormat, "TRG_0_DUTY", "%", getTriggerDutyCycle(0), 2);
2); reportSensorF(log, fileFormat, "TRG_1_DUTY", "%", getTriggerDutyCycle(1), 2);
reportSensorF(log, fileFormat, "TRG_1_DUTY", "%", getTriggerDutyCycle(1),
2);
#endif #endif
reportSensorF(log, fileFormat, "maf", "V", getMaf(), 2);
engine_configuration_s *engineConfiguration = engine->engineConfiguration; engine_configuration_s *engineConfiguration = engine->engineConfiguration;
if (engineConfiguration->hasMafSensor) {
reportSensorF(log, fileFormat, "maf", "V", getMaf(), 2);
reportSensorF(log, fileFormat, "mafr", "kg/hr", getRealMaf(), 2);
}
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
if (engineConfiguration->hasMapSensor) { if (engineConfiguration->hasMapSensor) {
reportSensorF(log, fileFormat, "MAP", "kPa", getMap(), 2); reportSensorF(log, fileFormat, "MAP", "kPa", getMap(), 2);
@ -182,21 +183,16 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) {
reportSensorF(log, fileFormat, "vss", "kph", getVehicleSpeed(), 2); reportSensorF(log, fileFormat, "vss", "kph", getVehicleSpeed(), 2);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2);
2); reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(engineConfiguration), 2);
reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(engineConfiguration),
2);
reportSensorF(log, fileFormat, "TP", "%", getTPS(PASS_ENGINE_PARAMETER_F), reportSensorF(log, fileFormat, "TP", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2);
2);
if (engineConfiguration->hasCltSensor) { if (engineConfiguration->hasCltSensor) {
reportSensorF(log, fileFormat, "CLT", "C", reportSensorF(log, fileFormat, "CLT", "C", getCoolantTemperature(engine), 2);
getCoolantTemperature(engine), 2);
} }
reportSensorF(log, fileFormat, "MAT", "C", getIntakeAirTemperature(engine), reportSensorF(log, fileFormat, "MAT", "C", getIntakeAirTemperature(engine), 2);
2);
// debugFloat(&logger, "tch", getTCharge1(tps), 2); // debugFloat(&logger, "tch", getTCharge1(tps), 2);
@ -230,16 +226,13 @@ static void printState(Engine *engine) {
if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER]) if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER])
debugInt(&logger, "ckp_c", getCrankEventCounter()); debugInt(&logger, "ckp_c", getCrankEventCounter());
if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER]) if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER])
debugInt(&logger, "ckp_r", debugInt(&logger, "ckp_r", triggerCentral.triggerState.runningRevolutionCounter);
triggerCentral.triggerState.runningRevolutionCounter);
if (subscription[(int) RO_RUNNING_TRIGGER_ERROR]) if (subscription[(int) RO_RUNNING_TRIGGER_ERROR])
debugInt(&logger, "trg_r_errors", debugInt(&logger, "trg_r_errors", triggerCentral.triggerState.runningTriggerErrorCounter);
triggerCentral.triggerState.runningTriggerErrorCounter);
if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR]) if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR])
debugInt(&logger, "trg_r_order_errors", debugInt(&logger, "trg_r_order_errors", triggerCentral.triggerState.runningOrderingErrorCounter);
triggerCentral.triggerState.runningOrderingErrorCounter);
if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE]) if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE])
debugInt(&logger, "wave_chart_current", 0); debugInt(&logger, "wave_chart_current", 0);
@ -253,13 +246,10 @@ static void printState(Engine *engine) {
debugFloat(&logger, "fuel_base", baseFuel, 2); debugFloat(&logger, "fuel_base", baseFuel, 2);
// debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2); // debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2);
// debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2); // debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2);
debugFloat(&logger, "fuel_lag", debugFloat(&logger, "fuel_lag", getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER), 2);
getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER),
2);
debugFloat(&logger, "fuel", getFuelMs(rpm PASS_ENGINE_PARAMETER), 2); debugFloat(&logger, "fuel", getFuelMs(rpm PASS_ENGINE_PARAMETER), 2);
debugFloat(&logger, "timing", debugFloat(&logger, "timing", getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER), 2);
getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER), 2);
// float map = getMap(); // float map = getMap();
@ -286,8 +276,7 @@ static systime_t timeOfPreviousPrintVersion = (systime_t) -1;
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
static void printOutPin(const char *pinName, brain_pin_e hwPin) { static void printOutPin(const char *pinName, brain_pin_e hwPin) {
appendPrintf(&logger, "outpin%s%s@%s%s", DELIMETER, pinName, appendPrintf(&logger, "outpin%s%s@%s%s", DELIMETER, pinName, hwPortname(hwPin), DELIMETER);
hwPortname(hwPin), DELIMETER);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -302,8 +291,7 @@ static void printInfo(Engine *engine, systime_t nowSeconds) {
return; return;
} }
timeOfPreviousPrintVersion = nowSeconds; timeOfPreviousPrintVersion = nowSeconds;
appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION,
getRusEfiVersion(), VCS_VERSION,
getConfigurationName(engineConfiguration->engineType), getConfigurationName(engineConfiguration->engineType),
DELIMETER); DELIMETER);
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
@ -315,11 +303,9 @@ static void printInfo(Engine *engine, systime_t nowSeconds) {
#endif #endif
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
printOutPin(enginePins.coils[i].name, printOutPin(enginePins.coils[i].name, boardConfiguration->ignitionPins[i]);
boardConfiguration->ignitionPins[i]);
printOutPin(enginePins.injectors[i].name, printOutPin(enginePins.injectors[i].name, boardConfiguration->injectionPins[i]);
boardConfiguration->injectionPins[i]);
} }
#endif #endif
@ -363,8 +349,7 @@ void updateDevConsoleState(Engine *engine) {
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
int currentCkpEventCounter = getCrankEventCounter(); int currentCkpEventCounter = getCrankEventCounter();
if (prevCkpEventCounter == currentCkpEventCounter if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) {
&& timeOfPreviousReport == nowSeconds) {
return; return;
} }
timeOfPreviousReport = nowSeconds; timeOfPreviousReport = nowSeconds;
@ -394,36 +379,29 @@ void updateDevConsoleState(Engine *engine) {
static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) { static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
engine_configuration_s *engineConfiguration = engine->engineConfiguration; engine_configuration_s *engineConfiguration = engine->engineConfiguration;
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
engineLoad);
scheduleMsg(&logger, "SD magic fuel %f", scheduleMsg(&logger, "SD magic fuel %f", sdMath(engineConfiguration, 100, 100, 14.7, convertCelsiusToKelvin(20)));
sdMath(engineConfiguration, 100, 100, 14.7,
convertCelsiusToKelvin(20)));
scheduleMsg(&logger2, "algo=%s/pump=%s", scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm),
getEngine_load_mode_e(engineConfiguration->algorithm),
boolToString(enginePins.fuelPumpRelay.getLogicValue())); boolToString(enginePins.fuelPumpRelay.getLogicValue()));
scheduleMsg(&logger2, "phase=%f", getInjectionAngle(rpm));
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(engine)); scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(engine));
if (engine->rpmCalculator.isRunning()) { if (engine->rpmCalculator.isRunning()) {
float iatCorrection = getIatCorrection( float iatCorrection = getIatCorrection(getIntakeAirTemperature(engine) PASS_ENGINE_PARAMETER);
getIntakeAirTemperature(engine) PASS_ENGINE_PARAMETER); float cltCorrection = getCltCorrection(getCoolantTemperature(engine) PASS_ENGINE_PARAMETER);
float cltCorrection = getCltCorrection( float injectorLag = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER);
getCoolantTemperature(engine) PASS_ENGINE_PARAMETER);
float injectorLag = getInjectorLag(
getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER);
scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad); scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs); scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs);
scheduleMsg(&logger2, scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection,
"iatCorrection=%f cltCorrection=%f injectorLag=%f", injectorLag);
iatCorrection, cltCorrection, injectorLag);
float value = getRunningFuel(baseFuelMs, float value = getRunningFuel(baseFuelMs, (int) rpm PASS_ENGINE_PARAMETER);
(int) rpm PASS_ENGINE_PARAMETER);
scheduleMsg(&logger2, "injection pulse width: %f", value); scheduleMsg(&logger2, "injection pulse width: %f", value);
} }
#endif #endif
@ -431,8 +409,7 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
static void showFuelInfo(Engine *engine) { static void showFuelInfo(Engine *engine) {
showFuelInfo2((float) getRpmE(engine), showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER), engine);
getEngineLoadT(PASS_ENGINE_PARAMETER), engine);
} }
#endif #endif
@ -452,20 +429,19 @@ OutputPin warningPin;
OutputPin runningPin; OutputPin runningPin;
extern engine_pins_s enginePins; extern engine_pins_s enginePins;
static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, &communicationPin, &checkEnginePin };
&communicationPin, &checkEnginePin };
static void initStatisLeds() { static void initStatisLeds() {
#if EFI_PROD_CODE #if EFI_PROD_CODE
outputPinRegister("communication status 1", &communicationPin, outputPinRegister("communication status 1", &communicationPin,
LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN); LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN);
#endif #endif
#if EFI_WARNING_LED #if EFI_WARNING_LED
outputPinRegister("warning", &warningPin, LED_WARNING_PORT, outputPinRegister("warning", &warningPin, LED_WARNING_PORT,
LED_WARNING_PIN); LED_WARNING_PIN);
outputPinRegister("is running status", &runningPin, LED_RUNNING_STATUS_PORT, outputPinRegister("is running status", &runningPin, LED_RUNNING_STATUS_PORT,
LED_RUNNING_STATUS_PIN); LED_RUNNING_STATUS_PIN);
#endif /* EFI_WARNING_LED */ #endif /* EFI_WARNING_LED */
} }
@ -533,8 +509,7 @@ static THD_WORKING_AREA(tsThreadStack, UTILITY_THREAD_STACK_SIZE);
#if EFI_TUNER_STUDIO #if EFI_TUNER_STUDIO
void updateTunerStudioState(Engine *engine, void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels) {
TunerStudioOutputChannels *tsOutputChannels) {
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) #if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
int rpm = getRpmE(engine); int rpm = getRpmE(engine);
#else #else
@ -548,8 +523,7 @@ void updateTunerStudioState(Engine *engine,
float intake = getIntakeAirTemperature(engine); float intake = getIntakeAirTemperature(engine);
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER); float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER);
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
engineLoad);
// header // header
tsOutputChannels->tsConfigVersion = TS_FILE_VERSION; tsOutputChannels->tsConfigVersion = TS_FILE_VERSION;
@ -566,8 +540,7 @@ void updateTunerStudioState(Engine *engine,
tsOutputChannels->atmospherePressure = getBaroPressure(); tsOutputChannels->atmospherePressure = getBaroPressure();
tsOutputChannels->manifold_air_pressure = getMap(); tsOutputChannels->manifold_air_pressure = getMap();
tsOutputChannels->engineLoad = engineLoad; tsOutputChannels->engineLoad = engineLoad;
tsOutputChannels->rpmAcceleration = tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
engine->rpmCalculator.getRpmAcceleration();
tsOutputChannels->checkEngine = hasErrorCodes(); tsOutputChannels->checkEngine = hasErrorCodes();
#if EFI_PROD_CODE #if EFI_PROD_CODE
@ -580,19 +553,13 @@ void updateTunerStudioState(Engine *engine,
tsOutputChannels->isFanOn = enginePins.fanRelay.getLogicValue(); tsOutputChannels->isFanOn = enginePins.fanRelay.getLogicValue();
tsOutputChannels->isO2HeaterOn = enginePins.o2heater.getLogicValue(); tsOutputChannels->isO2HeaterOn = enginePins.o2heater.getLogicValue();
tsOutputChannels->ignition_enabled = engineConfiguration->isIgnitionEnabled; tsOutputChannels->ignition_enabled = engineConfiguration->isIgnitionEnabled;
tsOutputChannels->injection_enabled = tsOutputChannels->injection_enabled = engineConfiguration->isInjectionEnabled;
engineConfiguration->isInjectionEnabled; tsOutputChannels->cylinder_cleanup_enabled = engineConfiguration->isCylinderCleanupEnabled;
tsOutputChannels->cylinder_cleanup_enabled = tsOutputChannels->cylinder_cleanup_activated = engine->isCylinderCleanupMode;
engineConfiguration->isCylinderCleanupEnabled; tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
tsOutputChannels->cylinder_cleanup_activated =
engine->isCylinderCleanupMode;
tsOutputChannels->secondTriggerChannelEnabled =
engineConfiguration->secondTriggerChannelEnabled;
tsOutputChannels->vehicleSpeedKph = getVehicleSpeed(); tsOutputChannels->vehicleSpeedKph = getVehicleSpeed();
tsOutputChannels->isCltError = !isValidCoolantTemperature( tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
getCoolantTemperature(engine)); tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(
getIntakeAirTemperature(engine));
#endif #endif
tsOutputChannels->clutchUpState = engine->clutchUpState; tsOutputChannels->clutchUpState = engine->clutchUpState;
tsOutputChannels->clutchDownState = engine->clutchDownState; tsOutputChannels->clutchDownState = engine->clutchDownState;
@ -601,8 +568,7 @@ void updateTunerStudioState(Engine *engine,
tsOutputChannels->inj_adv = timing > 360 ? timing - 720 : timing; tsOutputChannels->inj_adv = timing > 360 ? timing - 720 : timing;
tsOutputChannels->sparkDwell = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER); tsOutputChannels->sparkDwell = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER);
tsOutputChannels->baseFuel = baseFuelMs; tsOutputChannels->baseFuel = baseFuelMs;
tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, rpm PASS_ENGINE_PARAMETER);
rpm PASS_ENGINE_PARAMETER);
tsOutputChannels->crankingFuelMs = getCrankingFuel(engine); tsOutputChannels->crankingFuelMs = getCrankingFuel(engine);
} }
@ -636,8 +602,7 @@ void initStatusLoop(Engine *engine) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr) showFuelInfo2, addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr) showFuelInfo2, engine);
engine);
addConsoleActionP("fuelinfo", (VoidPtr) showFuelInfo, engine); addConsoleActionP("fuelinfo", (VoidPtr) showFuelInfo, engine);
#endif #endif
@ -657,14 +622,11 @@ void initStatusLoop(Engine *engine) {
void startStatusThreads(Engine *engine) { void startStatusThreads(Engine *engine) {
// todo: refactoring needed, this file should probably be split into pieces // todo: refactoring needed, this file should probably be split into pieces
chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, (tfunc_t) lcdThread, engine);
(tfunc_t) lcdThread, engine); chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t) tsStatusThread, engine);
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO,
(tfunc_t) tsStatusThread, engine);
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
initStatisLeds(); initStatisLeds();
chThdCreateStatic(blinkingStack, sizeof(blinkingStack), NORMALPRIO, chThdCreateStatic(blinkingStack, sizeof(blinkingStack), NORMALPRIO, (tfunc_t) blinkingThread, NULL);
(tfunc_t) blinkingThread, NULL);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }

View File

@ -55,6 +55,11 @@ float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
} }
} }
float getInjectionAngle(int rpm DECLARE_ENGINE_PARAMETER_S) {
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
return fuelPhaseMap.getValue(engineLoad, rpm);
}
/** /**
* Number of injections into each cylinder per engine cycle * Number of injections into each cylinder per engine cycle
*/ */

View File

@ -13,6 +13,7 @@
void prepareFuelMap(engine_configuration_s *engineConfiguration); void prepareFuelMap(engine_configuration_s *engineConfiguration);
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S); float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S);
float getInjectionAngle(int rpm DECLARE_ENGINE_PARAMETER_S);
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad); float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S); float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S);
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S); float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S);

View File

@ -28,20 +28,13 @@
#include "trigger_decoder.h" #include "trigger_decoder.h"
#include "event_registry.h" #include "event_registry.h"
#include "efiGpio.h" #include "efiGpio.h"
#include "fuel_math.h"
EXTERN_ENGINE EXTERN_ENGINE
; ;
extern engine_pins_s enginePins; extern engine_pins_s enginePins;
/*
* default Volumetric Efficiency
*/
//float getDefaultVE(int rpm) {
// if (rpm > 5000)
// return interpolate(5000, 1.1, 8000, 1, rpm);
// return interpolate(500, 0.5, 5000, 1.1, rpm);
//}
/** /**
* @return number of milliseconds in one crankshaft revolution * @return number of milliseconds in one crankshaft revolution
*/ */
@ -66,8 +59,7 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F) {
case LM_ALPHA_N: case LM_ALPHA_N:
return getTPS(PASS_ENGINE_PARAMETER_F); return getTPS(PASS_ENGINE_PARAMETER_F);
case LM_REAL_MAF: { case LM_REAL_MAF: {
int mafAdc = getAdcValue(engineConfiguration->mafAdcChannel); return getRealMaf(PASS_ENGINE_PARAMETER_F);
return getMafT(engineConfiguration);
} }
default: default:
firmwareError("Unexpected engine load parameter: %d", engineConfiguration->algorithm); firmwareError("Unexpected engine load parameter: %d", engineConfiguration->algorithm);
@ -168,7 +160,8 @@ void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e
* injection phase is scheduled by injection end, so we need to step the angle back * injection phase is scheduled by injection end, so we need to step the angle back
* for the duration of the injection * for the duration of the injection
*/ */
float baseAngle = engineConfiguration->injectionAngle - MS2US(engine->fuelMs) / engine->rpmCalculator.oneDegreeUs; float baseAngle = getInjectionAngle(engine->rpmCalculator.rpmValue PASS_ENGINE_PARAMETER) +
engineConfiguration->injectionAngle - MS2US(engine->fuelMs) / engine->rpmCalculator.oneDegreeUs;
switch (mode) { switch (mode) {
case IM_SEQUENTIAL: case IM_SEQUENTIAL:

View File

@ -10,6 +10,17 @@ float getMaf(DECLARE_ENGINE_PARAMETER_F) {
return getMafT(engineConfiguration); return getMafT(engineConfiguration);
} }
/**
* @return kg/hour value
*/
float getRealMaf(DECLARE_ENGINE_PARAMETER_F) {
int mafAdc = getAdcValue(engineConfiguration->mafAdcChannel);
/**
* here we drop from 12 bit ADC to 8 bit index
*/
return engine->mafDecodingLookup[mafAdc >> 4];
}
void setBosch0280218037(engine_configuration_s *engineConfiguration) { void setBosch0280218037(engine_configuration_s *engineConfiguration) {
int i = 0; int i = 0;
engineConfiguration->mafDecoding[i] = -34.5; engineConfiguration->mafDecoding[i] = -34.5;

View File

@ -16,6 +16,8 @@
#define getMafT(ec) (getVoltageDivided(ec->mafAdcChannel)) #define getMafT(ec) (getVoltageDivided(ec->mafAdcChannel))
float getMaf(void); float getMaf(void);
float getRealMaf(DECLARE_ENGINE_PARAMETER_F);
void setBosch0280218037(engine_configuration_s *engineConfiguration); void setBosch0280218037(engine_configuration_s *engineConfiguration);
#endif #endif

View File

@ -524,7 +524,7 @@ fileVersion = { 20150211 }
TPS = scalar, F32, 12, "%", 1, 0 TPS = scalar, F32, 12, "%", 1, 0
MAF = scalar, F32, 16, "V", 1, 0 MAF = scalar, F32, 16, "V", 1, 0
AFRactual = scalar, F32, 20, "AFR", 1, 0.0 AFRactual = scalar, F32, 20, "AFR", 1, 0.0
engineload = scalar, F32, 24, "%", 1, 0.0 ; Blend of MAP and TPS, depends on algorithm engineLoad = scalar, F32, 24, "%", 1, 0.0 ; Blend of MAP and TPS, depends on algorithm
VBatt = scalar, F32, 28, "V", 1, 0.0 VBatt = scalar, F32, 28, "V", 1, 0.0
; 10 bit TPS ADC value (from 0 to 1023 in 5v scale) ; 10 bit TPS ADC value (from 0 to 1023 in 5v scale)
tpsADC = scalar, U16, 32, "ADC", 1, 0.0; tpsADC = scalar, U16, 32, "ADC", 1, 0.0;
@ -572,7 +572,7 @@ fileVersion = { 20150211 }
rpmAcceleration = scalar, F32, 104, "dRpm", 1, 0 rpmAcceleration = scalar, F32, 104, "dRpm", 1, 0
egoCorrection = { 1 } egoCorrection = { 1 }
time = { timeNow } time = { timeNow }
engineLoad = { algorithm == 0 ? MAF : TPS } ; engineLoad = { algorithm == 0 ? MAF : TPS }
[CurveEditor] [CurveEditor]
curve = dwellCorrection, "Dwell time RPM based" curve = dwellCorrection, "Dwell time RPM based"
@ -675,6 +675,15 @@ fileVersion = { 20150211 }
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
upDownLabel = "(RICHER)", "(LEANER)" upDownLabel = "(RICHER)", "(LEANER)"
table = injPhaseTableTbl, injPhaseTableMap, "Injection Phase Table", 1
; constant, variable
xBins = injPhaseRpmBins, rpm
yBins = injPhaseLoadBins, engineLoad
zBins = injectionPhase
; gridHeight = 2.0
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
upDownLabel = "(Later)", "(Sooner)"
table = afrTableTbl, afrTableMap, "Target AFR Table", 1 table = afrTableTbl, afrTableMap, "Target AFR Table", 1
; constant, variable ; constant, variable
xBins = afrRpmBins, rpm xBins = afrRpmBins, rpm
@ -776,7 +785,7 @@ fileVersion = { 20150211 }
entry = MAP, "MAP", float, "%d" entry = MAP, "MAP", float, "%d"
entry = AFRactual, "AFR", float, "%.2f" entry = AFRactual, "AFR", float, "%.2f"
entry = VBatt, "vBatt", float, "%.2f" entry = VBatt, "vBatt", float, "%.2f"
entry = engineload, "Load", float, "%d" entry = engineLoad, "Load", float, "%d"
entry = pulseWidth, "injPulse", float, "%.3f" entry = pulseWidth, "injPulse", float, "%.3f"
entry = baseFuel, "baseFuel", float, "%.2f" entry = baseFuel, "baseFuel", float, "%.2f"
entry = ign_adv, "ignAdv", float, "%.2f" entry = ign_adv, "ignAdv", float, "%.2f"
@ -818,7 +827,8 @@ fileVersion = { 20150211 }
subMenu = iatFuelCorrCurve, "Intake air temp fuel correction" subMenu = iatFuelCorrCurve, "Intake air temp fuel correction"
subMenu = cltFuelCorrCurve, "Coolant temp fuel correction" subMenu = cltFuelCorrCurve, "Coolant temp fuel correction"
subMenu = veTableTbl, "VE Table", {algorithm == 3} subMenu = veTableTbl, "VE Table", {algorithm == 3}
subMenu = afrTableTbl, "Targe AFR Table", {algorithm == 3} subMenu = afrTableTbl, "Targe AFR Table", {algorithm == 3}
subMenu = injPhaseTableTbl, "Injection Phase"
subMenu = std_separator subMenu = std_separator
subMenu = ignitionTableTbl, "Ignition Table" subMenu = ignitionTableTbl, "Ignition Table"
subMenu = mafDecodingCurve, "MAF Decoding Curve" subMenu = mafDecodingCurve, "MAF Decoding Curve"
@ -832,6 +842,7 @@ fileVersion = { 20150211 }
subMenu = fuelTableMap, "Fuel Table" subMenu = fuelTableMap, "Fuel Table"
subMenu = veTableMap, "VE Table" subMenu = veTableMap, "VE Table"
subMenu = afrTableMap, "Targe AFR Table" subMenu = afrTableMap, "Targe AFR Table"
subMenu = injPhaseTableMap, "Injection Phase"
menu = "Board" menu = "Board"
subMenu = boardInputs, "Board Inputs" subMenu = boardInputs, "Board Inputs"