give dwell metric its own channel

This commit is contained in:
Matthew Kennedy 2024-09-01 16:48:40 -07:00
parent 5105258377
commit 40dfd1e205
4 changed files with 8 additions and 34 deletions

View File

@ -373,4 +373,6 @@ float mapFast
uint16_t mapAveragingSamples uint16_t mapAveragingSamples
uint8_t[12 iterate] mapPerCylinder;;"kPa", 1, 0, 0, 0, 0 uint8_t[12 iterate] mapPerCylinder;;"kPa", 1, 0, 0, 0, 0
uint16_t autoscale dwellAccuracyRatio;;"ratio", 0.001, 0, 0, 0, 3
end_struct end_struct

View File

@ -264,7 +264,7 @@ typedef enum __attribute__ ((__packed__)) {
DBG_ION = 30, DBG_ION = 30,
DBG_TLE8888 = 31, DBG_TLE8888 = 31,
DBG_32 = 32, DBG_32 = 32,
DBG_DWELL_METRIC = 33, DBG_33 = 33,
DBG_34 = 34, DBG_34 = 34,
DBG_35 = 35, DBG_35 = 35,
DBG_36 = 36, DBG_36 = 36,

View File

@ -183,35 +183,14 @@ void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
LogTriggerCoilState(nowNt, false); LogTriggerCoilState(nowNt, false);
#endif // EFI_TOOTH_LOGGER #endif // EFI_TOOTH_LOGGER
#if !EFI_UNIT_TEST
if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
#if EFI_TUNER_STUDIO #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 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 engine->outputChannels.dwellAccuracyRatio = actualDwellMs / event->sparkDwell;
*/
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;
} }
#endif #endif
}
#endif /* EFI_UNIT_TEST */
// now that we've just fired a coil let's prepare the new schedule for the next engine revolution // 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; 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 nextDwellStart = nowNt + engine->engineState.multispark.delay;
efitick_t nextFiring = nextDwellStart + engine->engineState.multispark.dwell; 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" // 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("dwell", &event->dwellStartTimer, nextDwellStart, { &turnSparkPinHigh, event });
engine->scheduler.schedule("firing", &event->sparkEvent.scheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event }); engine->scheduler.schedule("firing", &event->sparkEvent.scheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event });
} else { } else {
if (engineConfiguration->enableTrailingSparks) { 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 // Trailing sparks are enabled - schedule an event for the corresponding trailing coil
scheduleByAngle( scheduleByAngle(
&event->trailingSparkFire, nowNt, engine->engineState.trailingSparkAngle, &event->trailingSparkFire, nowNt, engine->engineState.trailingSparkAngle,

View File

@ -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 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 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@@ 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" #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"