From c21b60eeb82870b7f2eab9589e7626b372072b5d Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Tue, 14 Jul 2020 23:54:41 -0700 Subject: [PATCH] add reset --- firmware/controllers/algo/event_registry.h | 2 ++ firmware/controllers/engine_cycle/rpm_calculator.cpp | 1 + firmware/controllers/math/engine_math.cpp | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/firmware/controllers/algo/event_registry.h b/firmware/controllers/algo/event_registry.h index 0284b7d9c6..b59f954acd 100644 --- a/firmware/controllers/algo/event_registry.h +++ b/firmware/controllers/algo/event_registry.h @@ -57,6 +57,8 @@ public: void addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE); bool addFuelEventsForCylinder(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX); + void resetOverlapping(); + /** * injection events, per cylinder */ diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp index 29e7553f52..374f9c2718 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.cpp +++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp @@ -166,6 +166,7 @@ void RpmCalculator::setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX) { // This presumably fixes injection mode change for cranking-to-running transition. // 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running. if (state != oldState) { + engine->injectionEvents.resetOverlapping(); engine->injectionEvents.addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE); } #endif diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index eadbe4f606..6c8a3b5648 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -117,6 +117,12 @@ void FuelSchedule::clear() { isReady = false; } +void FuelSchedule::resetOverlapping() { + for (size_t i = 0; i < efi::size(enginePins.injectors); i++) { + enginePins.injectors[i].reset(); + } +} + /** * @returns false in case of error, true if success */