From 1c51c0914133e5d7a3a93dd418b6eaa177c1cf96 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 13 Oct 2014 15:02:58 -0500 Subject: [PATCH] auto-sync --- firmware/console/status_loop.cpp | 12 ++++++------ .../console/tunerstudio/tunerstudio_configuration.h | 8 ++++---- firmware/controllers/algo/fuel_math.cpp | 5 ++--- firmware/tunerstudio/rusefi.ini | 11 ++++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 93ab1f8e1e..35724bb82a 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -306,7 +306,7 @@ void updateDevConsoleState(Engine *engine) { */ static void showFuelInfo2(float rpm, float engineLoad) { - float baseFuel = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); + float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY))); @@ -317,12 +317,12 @@ static void showFuelInfo2(float rpm, float engineLoad) { float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(engineConfiguration2)); float injectorLag = getInjectorLag(engineConfiguration, getVBatt()); scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad); - scheduleMsg(&logger2, "baseFuel=%f", baseFuel); + scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs); scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection, injectorLag); - float value = getRunningFuel(baseFuel, &engine, (int) rpm); + float value = getRunningFuel(baseFuelMs, &engine, (int) rpm); scheduleMsg(&logger2, "injection pulse width: %f", value); } } @@ -361,7 +361,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) { float intake = getIntakeAirTemperature(engineConfiguration2); float engineLoad = getEngineLoad(); - float baseFuel = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); + float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); tsOutputChannels->rpm = rpm; tsOutputChannels->coolant_temperature = coolant; @@ -393,8 +393,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) { #endif tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake); tsOutputChannels->sparkDwell = getSparkDwellMs(rpm); - tsOutputChannels->pulseWidth = getRunningFuel(baseFuel, &engine, rpm); - tsOutputChannels->crankingFuel = getCrankingFuel(&engine); + tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, &engine, rpm); + tsOutputChannels->crankingFuelMs = getCrankingFuel(&engine); } extern TunerStudioOutputChannels tsOutputChannels; diff --git a/firmware/console/tunerstudio/tunerstudio_configuration.h b/firmware/console/tunerstudio/tunerstudio_configuration.h index ca5e1a8000..2ef32f59ef 100644 --- a/firmware/console/tunerstudio/tunerstudio_configuration.h +++ b/firmware/console/tunerstudio/tunerstudio_configuration.h @@ -42,12 +42,12 @@ typedef struct { short int alignment; // size 2, offset 34 float atmospherePressure; // size 4, offset 36 float manifold_air_pressure; // size 4, offset 40 - float crankingFuel; - int tpsVolrage; + float crankingFuelMs; + int unused; float tCharge; // 52 float inj_adv; // 56 float sparkDwell; // 60 - float pulseWidth; // 64 + float pulseWidthMs; // 64 float warmUpEnrich; // 68 /** * Yes, I do not really enjoy packing bits into integers but we simply have too many boolean flags and I cannot @@ -71,7 +71,7 @@ typedef struct { unsigned int isIatError : 1; // bit 3 int tsConfigVersion; egt_values_s egtValues; - int unused[3]; + int unused3[3]; } TunerStudioOutputChannels; #endif /* TUNERSTUDIO_CONFIGURATION_H_ */ diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 0232361850..10d7456b4e 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -85,8 +85,7 @@ float getFuelMs(int rpm, Engine *engine) { return theoreticalInjectionLength + injectorLag; } -// todo: start using 'engine' parameter and not 'extern' -float getRunningFuel(float baseFuel, Engine *engine, int rpm) { +float getRunningFuel(float baseFuelMs, Engine *engine, int rpm) { engine_configuration_s *engineConfiguration = engine->engineConfiguration; float iatCorrection = getIatCorrection(engineConfiguration, getIntakeAirTemperature(engine->engineConfiguration2)); float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(engine->engineConfiguration2)); @@ -96,7 +95,7 @@ float getRunningFuel(float baseFuel, Engine *engine, int rpm) { // todo: accelEnrichment #endif /* EFI_ACCEL_ENRICHMENT */ - return baseFuel * cltCorrection * iatCorrection; + return baseFuelMs * cltCorrection * iatCorrection; } static Map3D1616 fuelMap; diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 4e1d50bf3c..c8c9293eec 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -339,15 +339,17 @@ fileVersion = { 20141008 } #endif TPS = scalar, F32, 12, "%", 1, 0 MAF = scalar, F32, 16, "V", 1, 0 - AFR = scalar, F32, 20, "AFR", 1, 0.0, 0.00, 25.5, 1 ; + AFRactual = scalar, F32, 20, "AFR", 1, 0.0, 0.00, 25.5, 1 ; fuelload = scalar, F32, 24, "%", 1, 0.0 ; Blend of MAP and TPS, depends on algorithm VBatt = scalar, F32, 28, "V", 1, 0.0, 8, 21; + ; 10 bit TPS ADC value (from 0 to 1023 in 5v scale) tpsADC = scalar, U16, 32, "ADC", 1, 0.0; alignmet = scalar, U16, 34, "al", 1, 0.0; atmPres = scalar, F32, 36, "pres", 1, 0.0; MAP = scalar, F32, 40, "MAP", 1, 0.0; + ; total fuel squirt duration (in MS) per engine cycle according to current CLT crankingFuel = scalar, F32, 44, "ms", 1, 0.0; - tpsAdcValue = scalar, U32, 48, "adc", 1, 0 + AFRextected = scalar, F32, 48, "adc", 1, 0 tCharge = scalar, F32, 52, "T", 1, 0.0; inj_adv = scalar, F32, 56, "MAP", 1, 0.0; sparkDwell = scalar, F32, 60, "MAP", 1, 0.0; @@ -472,7 +474,7 @@ fileVersion = { 20141008 } CLTGauge = coolant, "Coolant Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1 IATGauge = intake, "Intake Air Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1 throttleGauge = TPS, "Throttle Position", "%", 0, 100, 0, 0, 100, 100, 0, 0 - afr1Gauge = AFR, "Air:Fuel Ratio 1", "", 10, 19.4, 12, 13, 15, 16, 2, 2 + afr1Gauge = AFRactual, "Air:Fuel Ratio 1", "", 10, 19.4, 12, 13, 15, 16, 2, 2 mafGauge = MAF, "Mass Air Flow", "v", 0, 5, 0, 1, 3, 4, 1, 1 VBattGauge = VBatt, "Battery Voltage", "V", 8, 21, 9, 10, 17, 19, 1, 1 tpsADCGauge = tpsADC, "tps ADC", "ADC", 0, 1024, 0, 0, 0, 0, 0, 0 @@ -535,14 +537,13 @@ fileVersion = { 20141008 } entry = TPS, "TPS", float, "%d" entry = MAF, "MAF", float, "%.2f" entry = MAP, "MAP", float, "%d" - entry = AFR, "AFR", float, "%.2f" + entry = AFRactual, "AFR", float, "%.2f" entry = VBatt, "vBatt", float, "%.2f" entry = fuelload "Fuelload" float, "%d" ; tpsADC = U16, "ADC", ; alignmet = U16, "al", ; atmPres = F32, "pres", ; crankingFuel = F32, "ms", -; tpsAdcValue = U32, "adc", ; tCharge = F32, "T", ; inj_adv = F32, "MAP", ; sparkDwell = F32, "MAP",