diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 10bc02db8b..9a6038d7bc 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -641,4 +641,8 @@ EngineRotationState * getEngineRotationState() { return &engine->rpmCalculator; } +EngineState * getEngineState() { + return &engine->engineState; +} + diff --git a/firmware/controllers/algo/wall_fuel.h b/firmware/controllers/algo/wall_fuel.h index 5e178079c8..154ea5f093 100644 --- a/firmware/controllers/algo/wall_fuel.h +++ b/firmware/controllers/algo/wall_fuel.h @@ -5,6 +5,7 @@ #pragma once +#include "wall_fuel_state_generated.h" #include "engine_module.h" /** diff --git a/firmware/controllers/engine_cycle/fuel_schedule.cpp b/firmware/controllers/engine_cycle/fuel_schedule.cpp index 75cc803553..9d0c3dbf70 100644 --- a/firmware/controllers/engine_cycle/fuel_schedule.cpp +++ b/firmware/controllers/engine_cycle/fuel_schedule.cpp @@ -5,8 +5,18 @@ */ #include "pch.h" -#include "rpm_calculator_api.h" +#include +#include +#include "fuel_schedule.h" #include "event_registry.h" +#include "fuel_schedule.h" +#include "trigger_decoder.h" +#include "engine_math.h" + +// dependency injection +#include "engine_state.h" +#include "rpm_calculator_api.h" +// end of injection #if EFI_ENGINE_CONTROL @@ -65,10 +75,10 @@ expected InjectionEvent::computeInjectionAngle(int cylinderIndex) const { // injection phase may be scheduled by injection end, so we need to step the angle back // for the duration of the injection - angle_t injectionDurationAngle = getInjectionAngleCorrection(engine->engineState.injectionDuration, oneDegreeUs); + angle_t injectionDurationAngle = getInjectionAngleCorrection(getEngineState()->injectionDuration, oneDegreeUs); // User configured offset - degrees after TDC combustion - floatus_t injectionOffset = engine->engineState.injectionOffset; + floatus_t injectionOffset = getEngineState()->injectionOffset; if (cisnan(injectionOffset)) { // injection offset map not ready - we are not ready to schedule fuel events return unexpected; diff --git a/firmware/controllers/engine_cycle/fuel_schedule.h b/firmware/controllers/engine_cycle/fuel_schedule.h index d859dcb02c..e644faf193 100644 --- a/firmware/controllers/engine_cycle/fuel_schedule.h +++ b/firmware/controllers/engine_cycle/fuel_schedule.h @@ -2,12 +2,13 @@ * @file fuel_schedule.h */ +#pragma once + #include "global.h" #include "efi_gpio.h" #include "scheduler.h" #include "fl_stack.h" #include "trigger_structure.h" -#include "accel_enrichment.h" #include "wall_fuel.h" #define MAX_WIRES_COUNT 2