From d647772b984752768cea3c1f4d029f188c86ef1e Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 7 May 2019 19:16:01 -0400 Subject: [PATCH] Injection/Ignition angle inaccuracy on 60-2? EngineSniffer vs Real Hardware #778 metric progress --- firmware/controllers/algo/auto_generated_enums.cpp | 6 ++++-- firmware/controllers/algo/rusefi_enums.h | 3 ++- firmware/controllers/algo/rusefi_generated.h | 2 +- firmware/controllers/engine_controller.cpp | 2 +- firmware/controllers/trigger/spark_logic.cpp | 7 ++++++- firmware/integration/rusefi_config.txt | 2 +- firmware/tunerstudio/rusefi.ini | 8 ++++++-- java_console/models/src/com/rusefi/config/Fields.java | 4 ++-- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 44dfb85212..7230133fd8 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -930,10 +930,12 @@ case TLE8888_PIN_9: } const char *getDebug_mode_e(debug_mode_e value){ switch(value) { -case DBG_33: - return "DBG_33"; +case DBG_DWELL_METRIC: + return "DBG_DWELL_METRIC"; case DBG_34: return "DBG_34"; +case DBG_35: + return "DBG_35"; case DBG_ALTERNATOR_PID: return "DBG_ALTERNATOR_PID"; case DBG_ANALOG_INPUTS: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index aa2281d5dd..3f8e9b5f57 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -901,8 +901,9 @@ typedef enum { * See also DBG_ANALOG_INPUTS */ DBG_ANALOG_INPUTS2 = 32, - DBG_33 = 33, + DBG_DWELL_METRIC = 33, DBG_34 = 34, + DBG_35 = 35, Force_4_bytes_size_debug_mode_e = ENUM_32_BITS, } debug_mode_e; diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index cde3d95175..28b182b1b9 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -418,7 +418,7 @@ #define cylinderBore_offset_hex 198 #define cylindersCount_offset 400 #define cylindersCount_offset_hex 190 -#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "mode33" +#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "mode34", "mode35" #define debugMode_offset 2112 #define debugMode_offset_hex 840 #define DIGIPOT_COUNT 4 diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 0cc0a8cc6b..31839a2a46 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -807,6 +807,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20190503; + return 20190507; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/trigger/spark_logic.cpp b/firmware/controllers/trigger/spark_logic.cpp index 6ca18dc897..3fe9ad4ddf 100644 --- a/firmware/controllers/trigger/spark_logic.cpp +++ b/firmware/controllers/trigger/spark_logic.cpp @@ -117,10 +117,15 @@ void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) { fireSparkBySettingPinLow(event, output); } } +#if !EFI_UNIT_TEST +if (engineConfiguration->debugMode == DBG_DWELL_METRIC) { + +} +#endif /* EFI_UNIT_TEST */ #if EFI_UNIT_TEST Engine *engine = event->engine; EXPAND_Engine; -#endif +#endif /* EFI_UNIT_TEST */ // now that we've just fired a coil let's prepare the new schedule for the next engine revolution angle_t dwellAngle = ENGINE(engineState.dwellAngle); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 1249d39839..f46eb2e543 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -158,7 +158,7 @@ float baseFuel;+Fuel squirt duration while cranking\nA number of curves adjust t int16_t rpm;+Cranking mode threshold. Special cranking logic controls fuel and spark while RPM is below this threshold\nset cranking_rpm X;"RPM", 1, 0, 0, 3000, 0 end_struct -#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "mode33" +#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "mode34", "mode35" custom debug_mode_e 4 bits, U32, @OFFSET@, [0:5], @@debug_mode_e_enum@@ #define vvt_mode_e_enum "First half", "Second half", "2GZ", "Miata NB2", "mode4", "mode5", "mode6", "mode7" diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 26e6f3901c..449eb133fd 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -48,6 +48,10 @@ enable2ndByteCanID = false pageValueWrite = "W\x00\x00%2o%v" pageChunkWrite = "C\x00\x00%2o%2c%v" ; crc32CheckCommand = "k%2i%2o\xB8\x36" + ; + ; TODO: interesting - 0x36B8 equals 14008 which looks like pageSize at some point in the past? is this a defect here - should + ; we have current pageSize or (pageSize + 8) here? + ; crc32CheckCommand = "k\x00\x00\x00\x00\x36\xB8" ;communication settings @@ -68,7 +72,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 06 09:14:48 EDT 2019 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue May 07 18:36:15 EDT 2019 pageSize = 20000 page = 1 @@ -647,7 +651,7 @@ page = 1 tpsDecelEnleanmentThreshold = scalar, F32, 2100, "roc", 1, 0, 0, 200, 3 tpsDecelEnleanmentMultiplier = scalar, F32, 2104, "coeff", 1, 0, 0, 200, 3 slowAdcAlpha = scalar, F32, 2108, "coeff", 1, 0, 0, 200, 3 - debugMode = bits, U32, 2112, [0:5], "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "mode33" + debugMode = bits, U32, 2112, [0:5], "Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "mode34", "mode35" warmupTargetAfrBins = array, F32, 2116, [4], "C", 1, 0, -100.0, 250.0, 2 warmupTargetAfr = array, F32, 2132, [4], "AFR", 1, 0, 0.0, 20.0, 2 warmupAfrThreshold = scalar, F32, 2148, "temperature", 1, 0, 0, 200, 3 diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index 24b6316b42..dbf0b7c37f 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config; -// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 05 11:03:35 EDT 2019 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue May 07 18:36:15 EDT 2019 public class Fields { public static final int accelerometerSpiDevice_offset = 2736; public static final int acCutoffHighRpm_offset = 1498; @@ -1782,7 +1782,7 @@ public class Fields { public static final Field TPSDECELENLEANMENTTHRESHOLD = Field.create("TPSDECELENLEANMENTTHRESHOLD", 2100, FieldType.FLOAT); public static final Field TPSDECELENLEANMENTMULTIPLIER = Field.create("TPSDECELENLEANMENTMULTIPLIER", 2104, FieldType.FLOAT); public static final Field SLOWADCALPHA = Field.create("SLOWADCALPHA", 2108, FieldType.FLOAT); - public static final String[] debug_mode_e = {"Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "mode33"}; + public static final String[] debug_mode_e = {"Alternator PID", "TPS acceleration enrichment", "Warmup PID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "mode34", "mode35"}; public static final Field DEBUGMODE = Field.create("DEBUGMODE", 2112, FieldType.INT, debug_mode_e); public static final Field WARMUPAFRTHRESHOLD = Field.create("WARMUPAFRTHRESHOLD", 2148, FieldType.FLOAT); public static final Field BOOSTCUTPRESSURE = Field.create("BOOSTCUTPRESSURE", 2152, FieldType.FLOAT);