add Injector pressure sensor (#1898)

* add sensor type

* add config

* initialize injector pressure

* add UI
This commit is contained in:
Matthew Kennedy 2020-10-23 12:46:16 -07:00 committed by GitHub
parent 08d8262f77
commit d84cd385ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 1 deletions

View File

@ -1011,3 +1011,8 @@ typedef enum __attribute__ ((__packed__)) {
ETB_IdleValve = 3,
ETB_Wastegate = 4,
} etb_function_e;
typedef enum __attribute__ ((__packed__)) {
IPT_Low = 0,
IPT_High = 1,
} injector_pressure_type_e;

View File

@ -60,6 +60,7 @@ static const char* s_sensorNames[] = {
"Fuel Pressure (LP)",
"Fuel Pressure (HP)",
"Fuel Pressure (injector)",
"TPS 1",
"TPS 1 Primary",

View File

@ -28,6 +28,7 @@ enum class SensorType : unsigned char {
FuelPressureLow,
FuelPressureHigh,
FuelPressureInjector,
// This is the "resolved" position, potentially composited out of the following two
Tps1,

View File

@ -4,6 +4,7 @@
#include "error_handling.h"
#include "global.h"
#include "functional_sensor.h"
#include "proxy_sensor.h"
#include "linear_func.h"
EXTERN_ENGINE;
@ -17,6 +18,8 @@ static FunctionalSensor fuelPressureSensorLow(SensorType::FuelPressureLow, /* ti
static LinearFunc fuelPressureFuncHigh;
static FunctionalSensor fuelPressureSensorHigh(SensorType::FuelPressureHigh, /* timeout = */ MS2NT(50));
static ProxySensor injectorPressure(SensorType::FuelPressureInjector);
static void configureFluidPressure(LinearFunc& func, const linear_sensor_s& cfg) {
float val1 = cfg.value1;
float val2 = cfg.value2;
@ -51,6 +54,16 @@ void initOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
initFluidPressure(oilpSensorFunc, oilpSensor, CONFIG(oilPressure), 10);
initFluidPressure(fuelPressureFuncLow, fuelPressureSensorLow, CONFIG(lowPressureFuel), 10);
initFluidPressure(fuelPressureFuncHigh, fuelPressureSensorHigh, CONFIG(highPressureFuel), 100);
injectorPressure.setProxiedSensor(
CONFIG(injectorPressureType) == IPT_High
? SensorType::FuelPressureHigh
: SensorType::FuelPressureLow
);
if (!injectorPressure.Register()) {
firmwareError(OBD_PCM_Processor_Fault, "Duplicate sensor registration");
}
}
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {

View File

@ -1196,7 +1196,11 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\
pin_output_mode_e starterControlPinMode;
adc_channel_e wastegatePositionSensor;
afr_override_e ignOverrideMode;+Override the Y axis (load) value used for the ignition table.\nAdvanced users only: If you aren't sure you need this, you probably don't need this.
uint8_t[3] unused_former_warmup_target_afr;;"units", 1, 0, -20, 100, 0
custom injector_pressure_type_e 1 bits, U08, @OFFSET@, [0:0], "Low", "High"
injector_pressure_type_e injectorPressureType;+Select which fuel pressure sensor measures the pressure of the fuel at your injectors.
uint8_t[2] unused_former_warmup_target_afr;;"units", 1, 0, -20, 100, 0
float boostCutPressure;+MAP value above which fuel is cut in case of overboost.\n0 to disable overboost cut.;"kPa (absolute)", 1, 0, 0, 500, 0

View File

@ -1712,6 +1712,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
; Engine->Injection Settings
dialog = injChars, "Injector Settings", yAxis
field = "Injector Flow", injector_flow, {isInjectionEnabled == 1}
field = "Fuel rail pressure sensor", injectorPressureType, { isInjectionEnabled && (highPressureFuel_hwChannel || lowPressureFuel_hwChannel) }
dialog = fuelParams, "Fuel characteristics", yAxis
field = "Stoichiometric ratio", stoichRatioPrimary, {isInjectionEnabled == 1}