plumb new load channels (#1573)

* wire up new channels

* add deprecation comment

* add gauges

* these tables are indeed used in those modes

* simplify

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-07-05 13:25:19 -07:00 committed by GitHub
parent bc61f487e1
commit 2b8b43ca55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 9 deletions

View File

@ -474,8 +474,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
executorStatistics();
#endif /* EFI_PROD_CODE */
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
// header
tsOutputChannels->tsConfigVersion = TS_FILE_VERSION;
@ -524,7 +522,10 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->airFuelRatio = getAfr(PASS_ENGINE_PARAMETER_SIGNATURE);
}
// offset 24
tsOutputChannels->engineLoad = engineLoad;
tsOutputChannels->engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
tsOutputChannels->fuelingLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
tsOutputChannels->ignitionLoad = getIgnitionLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
// KLUDGE? we always show VBatt because Proteus board has VBatt input sensor hardcoded
// offset 28

View File

@ -63,6 +63,8 @@ public:
int vssEventCounter = 0;
float fuelingLoad = 0;
float ignitionLoad = 0;
/**
* pre-calculated value from simple fuel lookup

View File

@ -239,10 +239,18 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
// Plop some state for others to read
ENGINE(engineState.targetAFR) = targetAfr;
ENGINE(engineState.sd.airMassInOneCylinder) = airmass.CylinderAirmass;
ENGINE(engineState.fuelingLoad) = airmass.EngineLoadPercent;
// TODO: independently selectable ignition load mode
ENGINE(engineState.ignitionLoad) = airmass.EngineLoadPercent;
baseFuel = getInjectionDurationForAirmass(airmass.CylinderAirmass, targetAfr PASS_ENGINE_PARAMETER_SUFFIX) * 1000;
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN baseFuel", 0);
} else {
float tps = Sensor::get(SensorType::Tps1).value_or(0);
ENGINE(engineState.fuelingLoad) = tps;
// TODO: independently selectable ignition load mode
ENGINE(engineState.ignitionLoad) = tps;
baseFuel = engine->engineState.baseTableFuel;
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN bt baseFuel", 0);
}

View File

@ -49,6 +49,14 @@ floatms_t getCrankshaftRevolutionTimeMs(int rpm) {
return 360 * getOneDegreeTimeMs(rpm);
}
float getFuelingLoad(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return ENGINE(engineState.fuelingLoad);
}
float getIgnitionLoad(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return ENGINE(engineState.ignitionLoad);
}
/**
* @brief Returns engine load according to selected engine_load_mode
*

View File

@ -42,6 +42,9 @@ void setFlatInjectorLag(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
floatms_t getCrankshaftRevolutionTimeMs(int rpm);
floatms_t getEngineCycleDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
float getFuelingLoad(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getIgnitionLoad(DECLARE_ENGINE_PARAMETER_SIGNATURE);
// getEngineLoadT is deprecated - please use one of the above functions, getFuelingLoad or getIgnitionMode
float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE);
floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -1491,6 +1491,7 @@ end_struct
#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"
#define GAUGE_NAME_FUEL_LOAD "fuel: load"
#define GAUGE_NAME_FUEL_INJ_DUTY "fuel: injector duty cycle"
#define GAUGE_NAME_TCHARGE "fuel: SD tCharge"
@ -1498,6 +1499,10 @@ end_struct
#define GAUGE_NAME_AFR "Air/Fuel Ratio"
#define GAUGE_NAME_IAC "Idle Air Valve"
#define GAUGE_NAME_DWELL_DUTY "dwell: coil duty cycle"
#define GAUGE_COIL_DWELL_TIME "dwell: coil charge time"
#define GAUGE_NAME_IGNITION_LOAD "ign: load"
#define GAUGE_NAME_DEBUG_F1 "debug f1"
#define GAUGE_NAME_DEBUG_F2 "debug f2: iTerm"
#define GAUGE_NAME_DEBUG_F3 "debug f3: prevError"
@ -1642,10 +1647,6 @@ end_struct
#define ET_BMW_M73_PROTEUS 63
#define ET_CITROEN_TU3JP 65
#define GAUGE_NAME_DWELL_DUTY "dwell: coil duty cycle"
#define GAUGE_COIL_DWELL_TIME "dwell: coil charge time"
! some board files override this value using prepend file
#define ts_show_hip9011 true
#define ts_show_main_relay true

View File

@ -984,6 +984,7 @@ gaugeCategory = Ignition
ignadvGauge = ignitionAdvance, "Ignition timing", "degrees", -100, 100, -999, -999, 999, 999, 1, 1
dwellGauge = sparkDwellValue, "Dwell", "mSec", 0, 10, 0.5, 1.0, 6.0, 8.0, 1, 1
coilDutyCycleGauge = coilDutyCycle, @@GAUGE_NAME_DWELL_DUTY@@, "perc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
ignitionLoadGauge = ignitionLoad, @@GAUGE_NAME_IGNITION_LOAD@@, "%", 0, 300, 0, 0, 300, 300, 1, 1
gaugeCategory = Acceleration Enrichment
engineLoadDeltaGauge = engineLoadDelta,"AE: load change","value", 0, 120, 10, 10, 100, 100, 1, 1
@ -1008,6 +1009,7 @@ gaugeCategory = Fueling
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
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
gaugeCategory = Throttle Body (incl. ETB)
pedalPositionGauge = throttlePedalPosition, @@GAUGE_NAME_THROTTLE_PEDAL@@, "%", 0, 120, 0, 0, 100, 100, 1, 1
@ -1257,14 +1259,14 @@ menuDialog = main
subMenu = std_separator
# Targets & closed loop
subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)}
subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1}
subMenu = fuelClosedLoopDialog, "Closed loop fuel correction", 0, {isInjectionEnabled == 1}
subMenu = coastingFuelCutControl, "Deceleration fuel cutoff (DFCO)", 0, {isInjectionEnabled == 1}
subMenu = std_separator
# Fuel table/VE
subMenu = fuelTableDialog, "Fuel table", 0, {isInjectionEnabled == 1 && fuelAlgorithm != LM_SPEED_DENSITY && fuelAlgorithm != LM_REAL_MAF}
subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)}
subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1}
subMenu = injPhaseTableTbl, "Injection phase", 0, {isInjectionEnabled == 1}
subMenu = std_separator