From a54f3e5289e4d908d9b9569b77b970c3e647b2ed Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 23 Nov 2020 01:10:12 -0500 Subject: [PATCH] GDI Epic #1448 --- firmware/console/status_loop.cpp | 2 +- .../controllers/engine_cycle/high_pressure_fuel_pump.cpp | 7 ++++++- firmware/controllers/sensors/map.h | 5 +++-- firmware/controllers/sensors/sensor_type.h | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 76ee2f0f31..52ec86fb54 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -604,7 +604,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ // Low pressure is directly in kpa tsOutputChannels->lowFuelPressure = Sensor::get(SensorType::FuelPressureLow).Value; // High pressure is in bar, aka 100 kpa - tsOutputChannels->highFuelPressure = Sensor::get(SensorType::FuelPressureHigh).Value * 0.01f; + tsOutputChannels->highFuelPressure = KPA2BAR(Sensor::get(SensorType::FuelPressureHigh).Value); // 288 tsOutputChannels->injectionOffset = engine->engineState.injectionOffset; diff --git a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp index 8274778e15..053836f295 100644 --- a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp +++ b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp @@ -10,6 +10,7 @@ #include "high_pressure_fuel_pump.h" #include "spark_logic.h" +#include "map.h" #if EFI_HPFP @@ -58,7 +59,11 @@ static void handle(HpfpActor *actor) { void hpfpPlainPinTurnOn(HpfpActor *current) { RegisteredNamedOutputPin *output = &enginePins.hpfpValve; - output->setHigh(); + int highPressureKpa = Sensor::get(SensorType::FuelPressureHigh).Value; + // very basic control strategy + if (highPressureKpa < BAR2KPA(50)) { + output->setHigh(); + } handle(current); } diff --git a/firmware/controllers/sensors/map.h b/firmware/controllers/sensors/map.h index 4a433d1139..8c9789bf5a 100644 --- a/firmware/controllers/sensors/map.h +++ b/firmware/controllers/sensors/map.h @@ -31,10 +31,11 @@ float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX); #define PSI2KPA(psi) (KPA_PER_PSI * (psi)) #define BAR2KPA(bar) (100 * (bar)) +#define KPA2BAR(kpa) (0.01f * (kpa)) // PSI (relative to atmosphere) to kPa (relative to vacuum) #define PSI2KPA_RELATIVE(psi) (101.32500411216164f + PSI2KPA(psi)) -#define INHG2KPA(inhg) ((inhg) * 3.386375) -#define KPA2INHG(kpa) ((kpa) / 3.386375) +#define INHG2KPA(inhg) ((inhg) * 3.386375f) +#define KPA2INHG(kpa) ((kpa) / 3.386375f) diff --git a/firmware/controllers/sensors/sensor_type.h b/firmware/controllers/sensors/sensor_type.h index 84d092f551..7676548f52 100644 --- a/firmware/controllers/sensors/sensor_type.h +++ b/firmware/controllers/sensors/sensor_type.h @@ -26,8 +26,8 @@ enum class SensorType : unsigned char { OilPressure, - FuelPressureLow, - FuelPressureHigh, + FuelPressureLow, // in kPa + FuelPressureHigh, // in kPa FuelPressureInjector, // This is the "resolved" position, potentially composited out of the following two