From 40673ffda260ec2a0f0ceac87a7b093bfe653773 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 28 Apr 2023 03:27:43 -0400 Subject: [PATCH] add ignition/injection mode output channel #85 (cherry picked from commit 9621ff844eea704421dc6172d66a2f4053467277) --- firmware/console/binary/output_channels.txt | 5 +++-- .../controllers/engine_cycle/fuel_schedule.cpp | 15 ++------------- firmware/controllers/engine_cycle/spark_logic.cpp | 1 + 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index 045d4625be..a13571f700 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -101,8 +101,9 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2 uint16_t canReadCounter;;"",1, 0, 0, 0, 0 int16_t autoscale tpsAccelFuel;@@GAUGE_NAME_FUEL_TPS_EXTRA@@;"ms",{1/@@PACK_MULT_MS@@}, 0, 0, 0, 3 ! Ignition - uint16_t warningCounter;@@GAUGE_NAME_WARNING_COUNTER@@;"count",1, 0, 0, 0, 0 - uint16_t lastErrorCode;@@GAUGE_NAME_WARNING_LAST@@;"error",1, 0, 0, 0, 0 + int16_t autoscale ignitionAdvance;@@GAUGE_NAME_TIMING_ADVANCE@@;"deg",{1/@@PACK_MULT_ANGLE@@}, 0, 0, 0, 1 + uint8_t currentIgnitionMode; + uint8_t currentInjectionMode; uint16_t autoscale coilDutyCycle;@@GAUGE_NAME_DWELL_DUTY@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0 ! Idle & ETB diff --git a/firmware/controllers/engine_cycle/fuel_schedule.cpp b/firmware/controllers/engine_cycle/fuel_schedule.cpp index c659005c2c..c546c837a7 100644 --- a/firmware/controllers/engine_cycle/fuel_schedule.cpp +++ b/firmware/controllers/engine_cycle/fuel_schedule.cpp @@ -4,19 +4,7 @@ * Handles injection scheduling */ -#include "global.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 +#include "pch.h" #if EFI_ENGINE_CONTROL @@ -137,6 +125,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i) { } injection_mode_e mode = getCurrentInjectionMode(); + engine->outputChannels.currentInjectionMode = static_cast(mode); // We need two outputs if: // - we are running batch fuel, and have "use two wire batch" enabled diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 6d778ac455..f7cac61a51 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -104,6 +104,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_ efiAssertVoid(ObdCode::CUSTOM_SPARK_ANGLE_1, !cisnan(sparkAngle), "sparkAngle#1"); auto ignitionMode = getCurrentIgnitionMode(); + engine->outputChannels.currentIgnitionMode = static_cast(ignitionMode); const int index = getIgnitionPinForIndex(event->cylinderIndex, ignitionMode); const int coilIndex = ID2INDEX(getCylinderId(index));