From 599943cf26ac03865ef0edd25e34a6809348b7d1 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 17 Jul 2021 16:12:54 -0400 Subject: [PATCH] NB2 trigger shape does not seem to match JimStim #2980 --- firmware/console/status_loop.cpp | 3 +++ firmware/controllers/algo/engine.h | 5 +++++ firmware/controllers/engine_cycle/main_trigger_callback.cpp | 3 +++ firmware/controllers/engine_cycle/spark_logic.cpp | 4 ++++ firmware/tunerstudio/rusefi.input | 4 ++-- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index b8352895d4..b9fc293352 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -875,6 +875,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ float instantRpm = engine->triggerCentral.triggerState.getInstantRpm(); tsOutputChannels->debugFloatField1 = instantRpm; tsOutputChannels->debugFloatField2 = instantRpm / GET_RPM(); + + tsOutputChannels->debugIntField1 = engine->mostRecentTimeBetweenSparkEvents; + tsOutputChannels->debugIntField2 = engine->mostRecentTimeBetweenIgnitionEvents; } break; case DBG_ION: diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index b1621d9624..ad0c214a77 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -103,6 +103,11 @@ public: GearControllerBase *gearController; + efitick_t mostRecentSparkEvent; + efitick_t mostRecentTimeBetweenSparkEvents; + efitick_t mostRecentIgnitionEvent; + efitick_t mostRecentTimeBetweenIgnitionEvents; + PrimaryTriggerConfiguration primaryTriggerConfiguration; VvtTriggerConfiguration vvtTriggerConfiguration[CAMS_PER_BANK]; efitick_t startStopStateLastPushTime = 0; diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 4a180d0ea2..52cc2d75e8 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -174,6 +174,9 @@ void turnInjectionPinLow(InjectionEvent *event) { EXPAND_Engine; #endif + engine->mostRecentTimeBetweenIgnitionEvents = nowNt - engine->mostRecentIgnitionEvent; + engine->mostRecentIgnitionEvent = nowNt; + event->isScheduled = false; for (int i = 0;ioutputs[i]; diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 4495f224b9..5d7ccc2967 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -45,6 +45,10 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou Engine *engine = event->engine; #endif /* EFI_UNIT_TEST */ + efitick_t nowNt = getTimeNowNt(); + engine->mostRecentTimeBetweenSparkEvents = nowNt - engine->mostRecentSparkEvent; + engine->mostRecentSparkEvent = nowNt; + #if SPARK_EXTREME_LOGGING efiPrintf("spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(), output->currentLogicValue, output->outOfOrder, event->sparkId); diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 9a5a809b78..e4d19166a9 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -448,8 +448,8 @@ enable2ndByteCanID = false debugFieldF5List = bits, U08, [0:7], "Alt: D Gain", "df5", "df5", "Idle: D Gain", "Idle df5", "VVT fall", "df5", "VVT1: D Gain", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "fsio 5", "24:df5", "CJ125: UR", "", "", "", "", "", "", "TPS1 Pri/Sec Ratio", "", "", "", "", "S unused" "", "Kp", "", "fsio 12", "", "", "", "", "", "", "Lua Debug 5", "VVT2: D Gain", "VVT3: D Gain", "VVT4: D Gain" debugFieldF6List = bits, U08, [0:7], "Alt: D Term", "", "", "Idle: D Term", "Idle df6", "Current Gap", "", "VVT1: D Term", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "fsio 6", "24:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki", "", "fsio 13", "", "", "", "", "", "", "Lua Debug 6", "VVT2: D Term", "VVT3: D Term", "VVT4: D Term" debugFieldF7List = bits, U08, [0:7], "Alt: Max-Value", "", "", "Idle: Max-Value", "Idle df7", "", "", "VVT1: Max-Value", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "fsio 7", "24:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd", "", "fsio 14", "", "", "", "", "", "", "Lua Debug 7", "", "", "" - debugFieldI1List = bits, U08, [0:7], "Alt: P Gain", "", "", "Idle: P Gain", "Idle di1", "Channel 1 Fall Counter", "", "VVT1: P Gain", "VVT Sync Counter", "Cycle Counter", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "t counter", "", "di1", "di1", "22di1", "", "24:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count", "", "", "", "", "", "", "deltatime", "", "", "Solenoid 1 State", "Lua memory used","VVT2: P Gain", "VVT3: P Gain", "VVT4: P Gain" - debugFieldI2List = bits, U08, [0:7], "Alt: Offset", "", "", "Idle: Offset", "Idle di2", "Channel 2 Fall Counter", "", "VVT1: Offset", "", "", "", "", "", "", "", "", "", "ETB di2", "invocationcounter", "", "di2", "di2", "22di2", "", "24:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "Starter Enable", "", "", "", "", "", "", "", "", "", "Solenoid 2 State", "", "VVT2: Offset", "VVT3: Offset", "VVT4: Offset" + debugFieldI1List = bits, U08, [0:7], "Alt: P Gain", "", "", "Idle: P Gain", "Idle di1", "Channel 1 Fall Counter", "", "VVT1: P Gain", "VVT Sync Counter", "Cycle Counter", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "t counter", "", "di1", "di1", "Spark Event Gap","", "24:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count", "", "", "", "", "", "", "deltatime", "", "", "Solenoid 1 State", "Lua memory used","VVT2: P Gain", "VVT3: P Gain", "VVT4: P Gain" + debugFieldI2List = bits, U08, [0:7], "Alt: Offset", "", "", "Idle: Offset", "Idle di2", "Channel 2 Fall Counter", "", "VVT1: Offset", "", "", "", "", "", "", "", "", "", "ETB di2", "invocationcounter", "", "di2", "di2", "Inj Event Gap", "", "24:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "Starter Enable", "", "", "", "", "", "", "", "", "", "Solenoid 2 State", "", "VVT2: Offset", "VVT3: Offset", "VVT4: Offset" debugFieldI3List = bits, U08, [0:7], "Alt: Reset Cnt", "", "", "Idle: Reset Cnt", "Idle di3", "Cycle Index", "", "VVT1: 10xTarget", "", "", "", "", "", "", "", "", "", "ETB di3", "s counter", "", "di3", "di3", "22di3", "", "24:di3", "", "write err", "", "", "", "", "Latest Received","", "", "", "", "", "Starter Disable","", "", "", "", "", "", "", "", "", "Solenoid 3 State", "", "VVT2: 10xTarger", "VVT3: 10xTarger", "VVT4: 10xTarger" debugFieldI4List = bits, U08, [0:7], "Alt: Period", "", "", "Idle: State", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "executor", "", "di4", "di4", "22di4", "", "24:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", "", "", "", "", "", "", "", "", "Solenoid 4 State", "", "", "", "" debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "max executor", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", "", "", "", "", "", "", "", "", "Solenoid 5 State", "", "", "", ""