From 66cc63b18ae16a118ac99cdf4dfd26b394de3087 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 30 Oct 2020 14:42:00 -0700 Subject: [PATCH] log target lambda (#1919) --- firmware/console/binary/tunerstudio_outputs.h | 4 +++- firmware/console/binary_log/binary_logging.cpp | 1 + firmware/console/status_loop.cpp | 1 + firmware/integration/rusefi_config.txt | 1 + firmware/tunerstudio/rusefi.input | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/firmware/console/binary/tunerstudio_outputs.h b/firmware/console/binary/tunerstudio_outputs.h index ad108709c8..81c0a93005 100644 --- a/firmware/console/binary/tunerstudio_outputs.h +++ b/firmware/console/binary/tunerstudio_outputs.h @@ -256,7 +256,9 @@ typedef struct { scaled_pressure lowFuelPressure; // 276 scaled_high_pressure highFuelPressure; // 278 - uint8_t unusedAtTheEnd[8]; // we have some unused bytes to allow compatible TS changes + scaled_lambda targetLambda; // 280 + + uint8_t unusedAtTheEnd[6]; // we have some unused bytes to allow compatible TS changes // Temporary - will remove soon TsDebugChannels* getDebugChannels() { diff --git a/firmware/console/binary_log/binary_logging.cpp b/firmware/console/binary_log/binary_logging.cpp index 15a5a024a1..ec94c48ab2 100644 --- a/firmware/console/binary_log/binary_logging.cpp +++ b/firmware/console/binary_log/binary_logging.cpp @@ -38,6 +38,7 @@ static const LogField fields[] = { {tsOutputChannels.vvtPosition, GAUGE_NAME_VVT, "deg", 1}, {tsOutputChannels.chargeAirMass, GAUGE_NAME_AIR_MASS, "g", 3}, {tsOutputChannels.currentTargetAfr, GAUGE_NAME_TARGET_AFR, "afr", 2}, + {tsOutputChannels.targetLambda, GAUGE_NAME_TARGET_LAMBDA, "", 3}, {tsOutputChannels.fuelBase, GAUGE_NAME_FUEL_BASE, "ms", 3}, {tsOutputChannels.fuelRunning, GAUGE_NAME_FUEL_RUNNING, "ms", 3}, {tsOutputChannels.actualLastInjection, GAUGE_NAME_FUEL_LAST_INJECTION, "ms", 3}, diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 3867aa1468..ca40b01992 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -617,6 +617,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ // offset 112 tsOutputChannels->veValue = engine->engineState.currentVe; tsOutputChannels->currentTargetAfr = ENGINE(engineState.targetAFR); + tsOutputChannels->targetLambda = ENGINE(engineState.targetLambda); if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) { float mapValue = getMap(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 58dc7527d5..d22e37b828 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1620,6 +1620,7 @@ end_struct #define GAUGE_NAME_FUEL_INJ_DUTY "fuel: injector duty cycle" #define GAUGE_NAME_TCHARGE "fuel: SD tCharge" #define GAUGE_NAME_TARGET_AFR "fuel: target AFR" +#define GAUGE_NAME_TARGET_LAMBDA "fuel: target lambda" #define GAUGE_NAME_LAMBDA "Lambda" #define GAUGE_NAME_IAC "Idle Air Valve" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index d7412f8199..0037074bf7 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -369,6 +369,7 @@ enable2ndByteCanID = false rawHighFuelPressure = scalar, U16, 274, "V",{1/@@PACK_MULT_VOLTAGE@@}, 0 lowFuelPressure = scalar, S16, 276, "kpa", {1/@@PACK_MULT_PRESSURE@@}, 0 highFuelPressure = scalar, S16, 278, "bar", {1/@@PACK_MULT_HIGH_PRESSURE@@}, 0 + targetLambda = scalar, U16, 280, "",{1/@@PACK_MULT_LAMBDA@@}, 0.0 ; ; see TunerStudioOutputChannels struct @@ -1156,6 +1157,7 @@ gaugeCategory = Knock entry = injectorDutyCycle,@@GAUGE_NAME_FUEL_INJ_DUTY@@,float,"%.3f" entry = coilDutyCycle, @@GAUGE_NAME_DWELL_DUTY@@, float,"%.3f" entry = currentTargetAfr,@@GAUGE_NAME_TARGET_AFR@@, float,"%.3f" + entry = targetLambda, @@GAUGE_NAME_TARGET_LAMBDA@@, float,"%.4f" entry = accelerationX, @@GAUGE_NAME_ACCEL_X@@, float,"%.2f", { LIS302DLCsPin != 0 } entry = accelerationY, @@GAUGE_NAME_ACCEL_Y@@, float,"%.2f", { LIS302DLCsPin != 0 }