maximumIgnitionTiming does not account timing_offset_cylinder #5894

only: renaming field so that we do not have two entities with same name and different meaning
This commit is contained in:
Andrey 2024-02-28 19:34:02 -05:00
parent 73298d21ad
commit 17275e4f4b
4 changed files with 10 additions and 10 deletions

View File

@ -107,7 +107,7 @@ void EngineState::periodicFastCallback() {
int rpm = Sensor::getOrZero(SensorType::Rpm);
engine->ignitionState.sparkDwell = engine->ignitionState.getSparkDwell(rpm);
engine->ignitionState.dwellAngle = cisnan(rpm) ? NAN : engine->ignitionState.sparkDwell / getOneDegreeTimeMs(rpm);
engine->ignitionState.dwellDurationAngle = cisnan(rpm) ? NAN : engine->ignitionState.sparkDwell / getOneDegreeTimeMs(rpm);
// todo: move this into slow callback, no reason for IAT corr to be here
engine->fuelComputer.running.intakeTemperatureCoefficient = getIatFuelCorrection();

View File

@ -4,7 +4,7 @@ struct_no_prefix ignition_state_s
float baseDwell;"Ignition: base dwell";"ms", 1,0, 0,30, 1,@@GAUGE_CATEGORY_TIMING@@
floatms_t sparkDwell;@@GAUGE_COIL_DWELL_TIME@@;"ms", 1,0, 0,30, 1,@@GAUGE_CATEGORY_TIMING@@
angle_t dwellAngle;Ignition: dwell duration\nas crankshaft angle\nNAN if engine is stopped\nSee also sparkDwell;"deg", 1,0, 0,120, 1,@@GAUGE_CATEGORY_TIMING@@
angle_t dwellDurationAngle;Ignition: dwell duration\nas crankshaft angle\nNAN if engine is stopped\nSee also sparkDwell;"deg", 1,0, 0,120, 1,@@GAUGE_CATEGORY_TIMING@@
int16_t autoscale cltTimingCorrection;Ign: CLT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2,@@GAUGE_CATEGORY_TIMING@@
int16_t autoscale timingIatCorrection;Ign: IAT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2,@@GAUGE_CATEGORY_TIMING@@

View File

@ -222,9 +222,9 @@ if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
}
#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 jdwellAngleDurationust 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.dwellDurationAngle;
floatms_t sparkDwell = engine->ignitionState.sparkDwell;
if (cisnan(dwellAngleDuration) || cisnan(sparkDwell)) {
// we are here if engine has just stopped
@ -410,7 +410,7 @@ static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
void initializeIgnitionActions() {
IgnitionEventList *list = &engine->ignitionEvents;
angle_t dwellAngle = engine->ignitionState.dwellAngle;
angle_t dwellAngle = engine->ignitionState.dwellDurationAngle;
floatms_t sparkDwell = engine->ignitionState.sparkDwell;
if (cisnan(engine->engineState.timingAdvance[0]) || cisnan(dwellAngle)) {
// error should already be reported
@ -444,11 +444,11 @@ static void prepareIgnitionSchedule() {
maxAllowedDwellAngle = getEngineCycle(operationMode) / engineConfiguration->cylindersCount / 1.1;
}
if (engine->ignitionState.dwellAngle == 0) {
if (engine->ignitionState.dwellDurationAngle == 0) {
warning(ObdCode::CUSTOM_ZERO_DWELL, "dwell is zero?");
}
if (engine->ignitionState.dwellAngle > maxAllowedDwellAngle) {
warning(ObdCode::CUSTOM_DWELL_TOO_LONG, "dwell angle too long: %.2f", engine->ignitionState.dwellAngle);
if (engine->ignitionState.dwellDurationAngle > maxAllowedDwellAngle) {
warning(ObdCode::CUSTOM_DWELL_TOO_LONG, "dwell angle too long: %.2f", engine->ignitionState.dwellDurationAngle);
}
// todo: add some check for dwell overflow? like 4 times 6 ms while engine cycle is less then that

View File

@ -237,7 +237,7 @@ TEST(misc, testRpmCalculator) {
eth.firePrimaryTriggerRise();
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));
assertEqualsM("dwell", 4.5, engine->ignitionState.dwellAngle);
assertEqualsM("dwell", 4.5, engine->ignitionState.dwellDurationAngle);
assertEqualsM("fuel #2", 4.5450, engine->engineState.injectionDuration);
assertEqualsM("one degree", 111.1111, engine->rpmCalculator.oneDegreeUs);
ASSERT_EQ( 1, ilist->isReady) << "size #2";
@ -287,7 +287,7 @@ TEST(misc, testRpmCalculator) {
eth.fireRise(5);
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.3";
assertEqualsM("dwell", 4.5, eth.engine.ignitionState.dwellAngle);
assertEqualsM("dwell", 4.5, eth.engine.ignitionState.dwellDurationAngle);
assertEqualsM("fuel #3", 4.5450, eth.engine.engineState.injectionDuration);
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));