display base fuel mass in milligrams (#1838)

* switch to mg

* use the correct thing

* gauge scaling

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-09-30 17:19:51 -07:00 committed by GitHub
parent 476c55fd4e
commit 6ac9aad358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 7 deletions

View File

@ -112,11 +112,11 @@ typedef struct {
scaled_angle vvtPosition; // 42
// Fuel math
scaled_channel<uint16_t, 1000> chargeAirMass; // 44
scaled_channel<uint16_t, 1000> chargeAirMass; // 44 cylinder airmass in mg, 0-65 grams
scaled_ms crankingFuelMs; // 46
scaled_afr currentTargetAfr; // 48
// This is the raw value we take from the fuel map or base fuel algorithm, before the corrections
scaled_ms fuelBase; // 50
scaled_fuel_mass_mg fuelBase; // 50
// Total fuel with CLT, IAT and TPS acceleration without injector lag corrections per cycle, as pulse per cycle
scaled_ms fuelRunning; // 52
// Actual last injection time - including all compensation and injection mode

View File

@ -547,7 +547,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->baroPressure = hasBaroSensor() ? getBaroPressure() : 0;
#endif /* EFI_ANALOG_SENSORS */
// 48
tsOutputChannels->fuelBase = engine->engineState.baseFuel;
tsOutputChannels->fuelBase = engine->engineState.baseFuel * 1000; // Convert grams to mg
// 64
tsOutputChannels->actualLastInjection = ENGINE(actualLastInjection);

View File

@ -226,7 +226,7 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN baseFuel", 0);
engine->engineState.baseFuel = baseFuel;
engine->engineState.baseFuel = baseFuelMass;
return tpsAccelEnrich + baseFuel;
}

View File

@ -179,6 +179,7 @@ struct_no_prefix engine_configuration_s
#define TPS_1_BYTE_PACKING_MULT 2
#define LOAD_1_BYTE_PACKING_MULT 2
#define PACK_MULT_AFR_CFG 10
#define PACK_MULT_FUEL_MASS 100
#define FSIO_TABLE_8 8
#define FSIO_CURVE_8 8
@ -1587,7 +1588,7 @@ end_struct
#define GAUGE_NAME_FUEL_CRANKING "fuel: cranking"
#define GAUGE_NAME_FUEL_RUNNING "fuel: running"
#define GAUGE_NAME_FUEL_LAST_INJECTION "fuel: Last injection"
#define GAUGE_NAME_FUEL_BASE "fuel: base"
#define GAUGE_NAME_FUEL_BASE "fuel: base mass"
#define GAUGE_NAME_FUEL_PID_CORR "fuel: Short-term fuel trim"
#define GAUGE_NAME_FUEL_WALL_AMOUNT "fuel: wall amount"
#define GAUGE_NAME_FUEL_WALL_CORRECTION "fuel: wall corr ms"

View File

@ -227,7 +227,7 @@ enable2ndByteCanID = false
chargeAirMass = scalar, U16, 44, "g",0.001, 0
crankingFuelMs = scalar, U16, 46, "ms",{1/@@PACK_MULT_MS@@}, 0.0
currentTargetAfr= scalar, U16, 48, "ratio",,{1/@@PACK_MULT_AFR@@},, 0
baseFuel = scalar, U16, 50, "ms",{1/@@PACK_MULT_MS@@}, 0
baseFuel = scalar, U16, 50, "mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0
fuelRunning = scalar, U16, 52, "ms",{1/@@PACK_MULT_MS@@}, 0
actualLastInjection=scalar,U16, 54, "ms",{1/@@PACK_MULT_MS@@}, 0.0
injectorDutyCycle=scalar, U08, 56, "%", 0.5, 0
@ -978,7 +978,7 @@ gaugeCategory = Fueling
injectorLagMsGauge = injectorLagMs, @@GAUGE_NAME_INJECTOR_LAG@@, "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
fuelRunningGauge = fuelRunning, @@GAUGE_NAME_FUEL_RUNNING@@, "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
baseFuelGauge = baseFuel, @@GAUGE_NAME_FUEL_BASE@@, "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
baseFuelGauge = baseFuel, @@GAUGE_NAME_FUEL_BASE@@, "mSec", 0, 100, 0, 0, 100, 100, 2, 0
fuelPidCorrectionGauge = fuelPidCorrection, @@GAUGE_NAME_FUEL_PID_CORR@@, "%", -10, 10, -8, -5, 5, 8, 3, 1
fuelingLoadGauge = fuelingLoad, @@GAUGE_NAME_FUEL_LOAD@@, "%", 0, 300, 0, 0, 300, 300, 1, 1

View File

@ -54,3 +54,4 @@ using scaled_pressure = scaled_channel<uint16_t, PACK_MULT_PRESSURE>; // 0-2000
using scaled_angle = scaled_channel<int16_t, PACK_MULT_ANGLE>; // +-655 degrees at 0.02 degree resolution
using scaled_voltage = scaled_channel<uint16_t, PACK_MULT_VOLTAGE>; // 0-65v at 1mV resolution
using scaled_afr = scaled_channel<uint16_t, PACK_MULT_AFR>; // 0-65afr at 0.001 resolution
using scaled_fuel_mass_mg = scaled_channel<uint16_t, PACK_MULT_FUEL_MASS>; // 0 - 655.35 milligrams, 0.01mg resolution