diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index 931291f760..8cee4f9370 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -373,4 +373,6 @@ float mapFast uint16_t mapAveragingSamples uint8_t[12 iterate] mapPerCylinder;;"kPa", 1, 0, 0, 0, 0 + + uint16_t autoscale dwellAccuracyRatio;;"ratio", 0.001, 0, 0, 0, 3 end_struct diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index 524c8d1302..60a69df4b0 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -264,7 +264,7 @@ typedef enum __attribute__ ((__packed__)) { DBG_ION = 30, DBG_TLE8888 = 31, DBG_32 = 32, - DBG_DWELL_METRIC = 33, + DBG_33 = 33, DBG_34 = 34, DBG_35 = 35, DBG_36 = 36, diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 2ecb6f924b..c09b36e8e2 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -183,35 +183,14 @@ void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) { LogTriggerCoilState(nowNt, false); #endif // EFI_TOOTH_LOGGER -#if !EFI_UNIT_TEST -if (engineConfiguration->debugMode == DBG_DWELL_METRIC) { #if EFI_TUNER_STUDIO - float actualDwellMs = event->actualDwellTimer.getElapsedSeconds(nowNt) * 1e3; - - /** - * ratio of desired dwell duration to actual dwell duration gives us some idea of how good is input trigger jitter - */ - float ratio = actualDwellMs / event->sparkDwell; - - // todo: smarted solution for index to field mapping - switch (event->cylinderIndex) { - case 0: - engine->outputChannels.debugFloatField1 = ratio; - break; - case 1: - engine->outputChannels.debugFloatField2 = ratio; - break; - case 2: - engine->outputChannels.debugFloatField3 = ratio; - break; - case 3: - engine->outputChannels.debugFloatField4 = ratio; - break; + { + // ratio of desired dwell duration to actual dwell duration gives us some idea of how good is input trigger jitter + float actualDwellMs = event->actualDwellTimer.getElapsedSeconds(nowNt) * 1e3; + engine->outputChannels.dwellAccuracyRatio = actualDwellMs / event->sparkDwell; } #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 dwellAngleDuration = engine->ignitionState.dwellAngle; @@ -227,19 +206,12 @@ if (engineConfiguration->debugMode == DBG_DWELL_METRIC) { efitick_t nextDwellStart = nowNt + engine->engineState.multispark.delay; efitick_t nextFiring = nextDwellStart + engine->engineState.multispark.dwell; -#if SPARK_EXTREME_LOGGING - efiPrintf("schedule multispark"); -#endif /* SPARK_EXTREME_LOGGING */ // We can schedule both of these right away, since we're going for "asap" not "particular angle" engine->scheduler.schedule("dwell", &event->dwellStartTimer, nextDwellStart, { &turnSparkPinHigh, event }); engine->scheduler.schedule("firing", &event->sparkEvent.scheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event }); } else { if (engineConfiguration->enableTrailingSparks) { -#if SPARK_EXTREME_LOGGING - efiPrintf("scheduleByAngle TrailingSparks"); -#endif /* SPARK_EXTREME_LOGGING */ - // Trailing sparks are enabled - schedule an event for the corresponding trailing coil scheduleByAngle( &event->trailingSparkFire, nowNt, engine->engineState.trailingSparkAngle, diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 8129c9addd..b372887c7a 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -264,7 +264,7 @@ float baseFuel;Base mass of the per-cylinder fuel injected during cranking. This int16_t rpm;This sets the RPM limit below which the ECU will use cranking fuel and ignition logic, typically this is around 350-450rpm.;"RPM", 1, 0, 0, 3000, 0 end_struct -#define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INVALID", "INVALID", "Status", "INVALID", "INVALID", "INVALID", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua" +#define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INVALID", "INVALID", "Status", "INVALID", "INVALID", "INVALID", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "INVALID", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua" custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@ #define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "INVALID", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63", "Mazda L"