diff --git a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp index 531617dd6d..d4650eac41 100644 --- a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp +++ b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp @@ -128,11 +128,12 @@ void HpfpController::onFastCallback() { // Pressure current/target calculation int rpm = engine->rpmCalculator.getRpm(); + isHpfpActive = rpm < rpm_spinning_cutoff || + engineConfiguration->hpfpCamLobes == 0 || + engineConfiguration->hpfpPumpVolume == 0 || + !enginePins.hpfpValve.isInitialized(); // What conditions can we not handle? - if (rpm < rpm_spinning_cutoff || - engineConfiguration->hpfpCamLobes == 0 || - engineConfiguration->hpfpPumpVolume == 0 || - !enginePins.hpfpValve.isInitialized()) { + if (isHpfpActive) { m_quantity.reset(); m_requested_pump = 0; m_deadtime = 0; @@ -192,6 +193,9 @@ void HpfpController::scheduleNextCycle() { nextStart = lobe - angle_requested - m_deadtime; engine->outputChannels.di_nextStart = nextStart; + /** + * We are good to use just one m_event instance because new events are scheduled when we turn off valve. + */ engine->module()->scheduleOrQueue( &m_event, TRIGGER_EVENT_UNDEFINED, 0, nextStart, @@ -201,6 +205,7 @@ void HpfpController::scheduleNextCycle() { } else { // Schedule this, even if we aren't opening the valve this time, since this // will schedule the next lobe. + // todo: would it have been cleaner to schedule 'scheduleNextCycle' directly? engine->module()->scheduleOrQueue( &m_event, TRIGGER_EVENT_UNDEFINED, 0, lobe, { pinTurnOff, this }); diff --git a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.txt b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.txt index f057926f0b..76e084d5f9 100644 --- a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.txt +++ b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.txt @@ -5,6 +5,7 @@ float fuel_requested_percent float fuel_requested_percent_pi bit noValve bit angleAboveMin +bit isHpfpActive angle_t nextLobe angle_t nextStart diff --git a/firmware/controllers/engine_cycle/high_pressure_fuel_pump_generated.h b/firmware/controllers/engine_cycle/high_pressure_fuel_pump_generated.h index c8ac9bba99..2a3d738a6d 100644 --- a/firmware/controllers/engine_cycle/high_pressure_fuel_pump_generated.h +++ b/firmware/controllers/engine_cycle/high_pressure_fuel_pump_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 00:21:14 EST 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 10:07:25 EST 2022 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -26,94 +26,94 @@ struct high_pressure_fuel_pump_s { bool angleAboveMin : 1 {}; /** offset 12 bit 2 */ - bool unusedBit_5_2 : 1 {}; + bool isHpfpActive : 1 {}; /** offset 12 bit 3 */ - bool unusedBit_5_3 : 1 {}; + bool unusedBit_6_3 : 1 {}; /** offset 12 bit 4 */ - bool unusedBit_5_4 : 1 {}; + bool unusedBit_6_4 : 1 {}; /** offset 12 bit 5 */ - bool unusedBit_5_5 : 1 {}; + bool unusedBit_6_5 : 1 {}; /** offset 12 bit 6 */ - bool unusedBit_5_6 : 1 {}; + bool unusedBit_6_6 : 1 {}; /** offset 12 bit 7 */ - bool unusedBit_5_7 : 1 {}; + bool unusedBit_6_7 : 1 {}; /** offset 12 bit 8 */ - bool unusedBit_5_8 : 1 {}; + bool unusedBit_6_8 : 1 {}; /** offset 12 bit 9 */ - bool unusedBit_5_9 : 1 {}; + bool unusedBit_6_9 : 1 {}; /** offset 12 bit 10 */ - bool unusedBit_5_10 : 1 {}; + bool unusedBit_6_10 : 1 {}; /** offset 12 bit 11 */ - bool unusedBit_5_11 : 1 {}; + bool unusedBit_6_11 : 1 {}; /** offset 12 bit 12 */ - bool unusedBit_5_12 : 1 {}; + bool unusedBit_6_12 : 1 {}; /** offset 12 bit 13 */ - bool unusedBit_5_13 : 1 {}; + bool unusedBit_6_13 : 1 {}; /** offset 12 bit 14 */ - bool unusedBit_5_14 : 1 {}; + bool unusedBit_6_14 : 1 {}; /** offset 12 bit 15 */ - bool unusedBit_5_15 : 1 {}; + bool unusedBit_6_15 : 1 {}; /** offset 12 bit 16 */ - bool unusedBit_5_16 : 1 {}; + bool unusedBit_6_16 : 1 {}; /** offset 12 bit 17 */ - bool unusedBit_5_17 : 1 {}; + bool unusedBit_6_17 : 1 {}; /** offset 12 bit 18 */ - bool unusedBit_5_18 : 1 {}; + bool unusedBit_6_18 : 1 {}; /** offset 12 bit 19 */ - bool unusedBit_5_19 : 1 {}; + bool unusedBit_6_19 : 1 {}; /** offset 12 bit 20 */ - bool unusedBit_5_20 : 1 {}; + bool unusedBit_6_20 : 1 {}; /** offset 12 bit 21 */ - bool unusedBit_5_21 : 1 {}; + bool unusedBit_6_21 : 1 {}; /** offset 12 bit 22 */ - bool unusedBit_5_22 : 1 {}; + bool unusedBit_6_22 : 1 {}; /** offset 12 bit 23 */ - bool unusedBit_5_23 : 1 {}; + bool unusedBit_6_23 : 1 {}; /** offset 12 bit 24 */ - bool unusedBit_5_24 : 1 {}; + bool unusedBit_6_24 : 1 {}; /** offset 12 bit 25 */ - bool unusedBit_5_25 : 1 {}; + bool unusedBit_6_25 : 1 {}; /** offset 12 bit 26 */ - bool unusedBit_5_26 : 1 {}; + bool unusedBit_6_26 : 1 {}; /** offset 12 bit 27 */ - bool unusedBit_5_27 : 1 {}; + bool unusedBit_6_27 : 1 {}; /** offset 12 bit 28 */ - bool unusedBit_5_28 : 1 {}; + bool unusedBit_6_28 : 1 {}; /** offset 12 bit 29 */ - bool unusedBit_5_29 : 1 {}; + bool unusedBit_6_29 : 1 {}; /** offset 12 bit 30 */ - bool unusedBit_5_30 : 1 {}; + bool unusedBit_6_30 : 1 {}; /** offset 12 bit 31 */ - bool unusedBit_5_31 : 1 {}; + bool unusedBit_6_31 : 1 {}; /** * offset 16 */ @@ -126,4 +126,4 @@ struct high_pressure_fuel_pump_s { }; // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 00:21:14 EST 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 10:07:25 EST 2022 diff --git a/java_console/models/src/main/java/com/rusefi/config/generated/HighPressureFuelPump.java b/java_console/models/src/main/java/com/rusefi/config/generated/HighPressureFuelPump.java index f02ace8aac..67ee6d832e 100644 --- a/java_console/models/src/main/java/com/rusefi/config/generated/HighPressureFuelPump.java +++ b/java_console/models/src/main/java/com/rusefi/config/generated/HighPressureFuelPump.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 00:21:14 EST 2022 +// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\high_pressure_fuel_pump.txt Tue Jan 18 10:07:25 EST 2022 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -11,36 +11,36 @@ public class HighPressureFuelPump { public static final Field FUEL_REQUESTED_PERCENT_PI = Field.create("FUEL_REQUESTED_PERCENT_PI", 8, FieldType.FLOAT); public static final Field NOVALVE = Field.create("NOVALVE", 12, FieldType.BIT, 0); public static final Field ANGLEABOVEMIN = Field.create("ANGLEABOVEMIN", 12, FieldType.BIT, 1); - public static final Field UNUSEDBIT_5_2 = Field.create("UNUSEDBIT_5_2", 12, FieldType.BIT, 2); - public static final Field UNUSEDBIT_5_3 = Field.create("UNUSEDBIT_5_3", 12, FieldType.BIT, 3); - public static final Field UNUSEDBIT_5_4 = Field.create("UNUSEDBIT_5_4", 12, FieldType.BIT, 4); - public static final Field UNUSEDBIT_5_5 = Field.create("UNUSEDBIT_5_5", 12, FieldType.BIT, 5); - public static final Field UNUSEDBIT_5_6 = Field.create("UNUSEDBIT_5_6", 12, FieldType.BIT, 6); - public static final Field UNUSEDBIT_5_7 = Field.create("UNUSEDBIT_5_7", 12, FieldType.BIT, 7); - public static final Field UNUSEDBIT_5_8 = Field.create("UNUSEDBIT_5_8", 12, FieldType.BIT, 8); - public static final Field UNUSEDBIT_5_9 = Field.create("UNUSEDBIT_5_9", 12, FieldType.BIT, 9); - public static final Field UNUSEDBIT_5_10 = Field.create("UNUSEDBIT_5_10", 12, FieldType.BIT, 10); - public static final Field UNUSEDBIT_5_11 = Field.create("UNUSEDBIT_5_11", 12, FieldType.BIT, 11); - public static final Field UNUSEDBIT_5_12 = Field.create("UNUSEDBIT_5_12", 12, FieldType.BIT, 12); - public static final Field UNUSEDBIT_5_13 = Field.create("UNUSEDBIT_5_13", 12, FieldType.BIT, 13); - public static final Field UNUSEDBIT_5_14 = Field.create("UNUSEDBIT_5_14", 12, FieldType.BIT, 14); - public static final Field UNUSEDBIT_5_15 = Field.create("UNUSEDBIT_5_15", 12, FieldType.BIT, 15); - public static final Field UNUSEDBIT_5_16 = Field.create("UNUSEDBIT_5_16", 12, FieldType.BIT, 16); - public static final Field UNUSEDBIT_5_17 = Field.create("UNUSEDBIT_5_17", 12, FieldType.BIT, 17); - public static final Field UNUSEDBIT_5_18 = Field.create("UNUSEDBIT_5_18", 12, FieldType.BIT, 18); - public static final Field UNUSEDBIT_5_19 = Field.create("UNUSEDBIT_5_19", 12, FieldType.BIT, 19); - public static final Field UNUSEDBIT_5_20 = Field.create("UNUSEDBIT_5_20", 12, FieldType.BIT, 20); - public static final Field UNUSEDBIT_5_21 = Field.create("UNUSEDBIT_5_21", 12, FieldType.BIT, 21); - public static final Field UNUSEDBIT_5_22 = Field.create("UNUSEDBIT_5_22", 12, FieldType.BIT, 22); - public static final Field UNUSEDBIT_5_23 = Field.create("UNUSEDBIT_5_23", 12, FieldType.BIT, 23); - public static final Field UNUSEDBIT_5_24 = Field.create("UNUSEDBIT_5_24", 12, FieldType.BIT, 24); - public static final Field UNUSEDBIT_5_25 = Field.create("UNUSEDBIT_5_25", 12, FieldType.BIT, 25); - public static final Field UNUSEDBIT_5_26 = Field.create("UNUSEDBIT_5_26", 12, FieldType.BIT, 26); - public static final Field UNUSEDBIT_5_27 = Field.create("UNUSEDBIT_5_27", 12, FieldType.BIT, 27); - public static final Field UNUSEDBIT_5_28 = Field.create("UNUSEDBIT_5_28", 12, FieldType.BIT, 28); - public static final Field UNUSEDBIT_5_29 = Field.create("UNUSEDBIT_5_29", 12, FieldType.BIT, 29); - public static final Field UNUSEDBIT_5_30 = Field.create("UNUSEDBIT_5_30", 12, FieldType.BIT, 30); - public static final Field UNUSEDBIT_5_31 = Field.create("UNUSEDBIT_5_31", 12, FieldType.BIT, 31); + public static final Field ISHPFPACTIVE = Field.create("ISHPFPACTIVE", 12, FieldType.BIT, 2); + public static final Field UNUSEDBIT_6_3 = Field.create("UNUSEDBIT_6_3", 12, FieldType.BIT, 3); + public static final Field UNUSEDBIT_6_4 = Field.create("UNUSEDBIT_6_4", 12, FieldType.BIT, 4); + public static final Field UNUSEDBIT_6_5 = Field.create("UNUSEDBIT_6_5", 12, FieldType.BIT, 5); + public static final Field UNUSEDBIT_6_6 = Field.create("UNUSEDBIT_6_6", 12, FieldType.BIT, 6); + public static final Field UNUSEDBIT_6_7 = Field.create("UNUSEDBIT_6_7", 12, FieldType.BIT, 7); + public static final Field UNUSEDBIT_6_8 = Field.create("UNUSEDBIT_6_8", 12, FieldType.BIT, 8); + public static final Field UNUSEDBIT_6_9 = Field.create("UNUSEDBIT_6_9", 12, FieldType.BIT, 9); + public static final Field UNUSEDBIT_6_10 = Field.create("UNUSEDBIT_6_10", 12, FieldType.BIT, 10); + public static final Field UNUSEDBIT_6_11 = Field.create("UNUSEDBIT_6_11", 12, FieldType.BIT, 11); + public static final Field UNUSEDBIT_6_12 = Field.create("UNUSEDBIT_6_12", 12, FieldType.BIT, 12); + public static final Field UNUSEDBIT_6_13 = Field.create("UNUSEDBIT_6_13", 12, FieldType.BIT, 13); + public static final Field UNUSEDBIT_6_14 = Field.create("UNUSEDBIT_6_14", 12, FieldType.BIT, 14); + public static final Field UNUSEDBIT_6_15 = Field.create("UNUSEDBIT_6_15", 12, FieldType.BIT, 15); + public static final Field UNUSEDBIT_6_16 = Field.create("UNUSEDBIT_6_16", 12, FieldType.BIT, 16); + public static final Field UNUSEDBIT_6_17 = Field.create("UNUSEDBIT_6_17", 12, FieldType.BIT, 17); + public static final Field UNUSEDBIT_6_18 = Field.create("UNUSEDBIT_6_18", 12, FieldType.BIT, 18); + public static final Field UNUSEDBIT_6_19 = Field.create("UNUSEDBIT_6_19", 12, FieldType.BIT, 19); + public static final Field UNUSEDBIT_6_20 = Field.create("UNUSEDBIT_6_20", 12, FieldType.BIT, 20); + public static final Field UNUSEDBIT_6_21 = Field.create("UNUSEDBIT_6_21", 12, FieldType.BIT, 21); + public static final Field UNUSEDBIT_6_22 = Field.create("UNUSEDBIT_6_22", 12, FieldType.BIT, 22); + public static final Field UNUSEDBIT_6_23 = Field.create("UNUSEDBIT_6_23", 12, FieldType.BIT, 23); + public static final Field UNUSEDBIT_6_24 = Field.create("UNUSEDBIT_6_24", 12, FieldType.BIT, 24); + public static final Field UNUSEDBIT_6_25 = Field.create("UNUSEDBIT_6_25", 12, FieldType.BIT, 25); + public static final Field UNUSEDBIT_6_26 = Field.create("UNUSEDBIT_6_26", 12, FieldType.BIT, 26); + public static final Field UNUSEDBIT_6_27 = Field.create("UNUSEDBIT_6_27", 12, FieldType.BIT, 27); + public static final Field UNUSEDBIT_6_28 = Field.create("UNUSEDBIT_6_28", 12, FieldType.BIT, 28); + public static final Field UNUSEDBIT_6_29 = Field.create("UNUSEDBIT_6_29", 12, FieldType.BIT, 29); + public static final Field UNUSEDBIT_6_30 = Field.create("UNUSEDBIT_6_30", 12, FieldType.BIT, 30); + public static final Field UNUSEDBIT_6_31 = Field.create("UNUSEDBIT_6_31", 12, FieldType.BIT, 31); public static final Field NEXTLOBE = Field.create("NEXTLOBE", 16, FieldType.FLOAT); public static final Field NEXTSTART = Field.create("NEXTSTART", 20, FieldType.FLOAT); public static final Field[] VALUES = { @@ -49,36 +49,36 @@ public class HighPressureFuelPump { FUEL_REQUESTED_PERCENT_PI, NOVALVE, ANGLEABOVEMIN, - UNUSEDBIT_5_2, - UNUSEDBIT_5_3, - UNUSEDBIT_5_4, - UNUSEDBIT_5_5, - UNUSEDBIT_5_6, - UNUSEDBIT_5_7, - UNUSEDBIT_5_8, - UNUSEDBIT_5_9, - UNUSEDBIT_5_10, - UNUSEDBIT_5_11, - UNUSEDBIT_5_12, - UNUSEDBIT_5_13, - UNUSEDBIT_5_14, - UNUSEDBIT_5_15, - UNUSEDBIT_5_16, - UNUSEDBIT_5_17, - UNUSEDBIT_5_18, - UNUSEDBIT_5_19, - UNUSEDBIT_5_20, - UNUSEDBIT_5_21, - UNUSEDBIT_5_22, - UNUSEDBIT_5_23, - UNUSEDBIT_5_24, - UNUSEDBIT_5_25, - UNUSEDBIT_5_26, - UNUSEDBIT_5_27, - UNUSEDBIT_5_28, - UNUSEDBIT_5_29, - UNUSEDBIT_5_30, - UNUSEDBIT_5_31, + ISHPFPACTIVE, + UNUSEDBIT_6_3, + UNUSEDBIT_6_4, + UNUSEDBIT_6_5, + UNUSEDBIT_6_6, + UNUSEDBIT_6_7, + UNUSEDBIT_6_8, + UNUSEDBIT_6_9, + UNUSEDBIT_6_10, + UNUSEDBIT_6_11, + UNUSEDBIT_6_12, + UNUSEDBIT_6_13, + UNUSEDBIT_6_14, + UNUSEDBIT_6_15, + UNUSEDBIT_6_16, + UNUSEDBIT_6_17, + UNUSEDBIT_6_18, + UNUSEDBIT_6_19, + UNUSEDBIT_6_20, + UNUSEDBIT_6_21, + UNUSEDBIT_6_22, + UNUSEDBIT_6_23, + UNUSEDBIT_6_24, + UNUSEDBIT_6_25, + UNUSEDBIT_6_26, + UNUSEDBIT_6_27, + UNUSEDBIT_6_28, + UNUSEDBIT_6_29, + UNUSEDBIT_6_30, + UNUSEDBIT_6_31, NEXTLOBE, NEXTSTART, };