Skip to content

Inhibit DFCO during cranking and add a startup hold-off - #823

Open
gdiciocco wants to merge 3 commits into
FOME-Tech:masterfrom
gdiciocco:fix/dfco-startup
Open

gdiciocco wants to merge 3 commits into
FOME-Tech:masterfrom
gdiciocco:fix/dfco-startup

Conversation

@gdiciocco

@gdiciocco gdiciocco commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #820.

DFCO can zero after-start enrichment during a warm-start flare. Overlapping cranking and DFCO RPM thresholds can also cancel cranking fuel.

Require RpmCalculator::isRunning() and add dfcoStartupDelay, measured from each transition to RUNNING. The engine-start timer covers direct STOPPED→RUNNING restarts, where the enrichment timer can still contain the previous start's elapsed time.

The setting is 0–255 s, defaulting to 10 s for new tunes. It is independent of scalar/table enrichment and dfcoDelay; choose a duration that covers the configured taper. Zero disables the hold-off while retaining the cranking/spin-up gate. The field reuses padding at byte 1227, preserving existing offsets and configuration sizes. Existing tunes with zero in that byte retain zero delay and need the hold-off configured explicitly.

Validation

  • 733 host tests pass under ASan and Valgrind (zero Memcheck errors), including 13 new startup/restart regressions. The initial 11 regressions fail with the original DFCO logic.
  • Covers cranking above the DFCO threshold, spin-up, hot and direct restarts, 0/3/10 s hold-offs, cut delay, RPM hysteresis and scalar/table enrichment.
  • All 551 existing offset assertions and 1471 existing INI fields remain unchanged; configuration sizes remain 3800/23736 bytes.
  • Core8 firmware builds pass both standalone and combined with Fix trigger scheduler event lifecycle across stop, restart and overdwell #821/Fix ADC conversion start states and add lifecycle diagnostics #822. The gate is in shared engine-control code. No ECU upload or running-engine validation was performed.

Integration

Based directly on master. DFCO merges cleanly with #822 (5a83b5f326) and #821 (c625f3fe9c4), individually in either order and after their combined integration. 759 general + 36 ADCv2 + 21 ADCv4 tests pass together through make -j12 test. Combining #821 and #822 themselves requires retaining both sets of changelog entries; DFCO introduces no additional conflict.

Related: #819, which fixes the separate timing ramp. That combination passed 750 tests with extended ramp coverage. Its ramp test needs an explicit RUNNING state and dfcoStartupDelay = 0 when combined with this gate.

Require RUNNING state and measure a configurable delay from each engine start. Reuse a padding byte to preserve the stored tune layout. Add startup and restart regressions.

Fixes FOME-Tech#820.
The fixture drives RPM directly. The MAF/trigger helper needlessly invokes all configuration-change callbacks and can read an ETB PID configuration left by a previous test. Disable ignition directly and keep the existing DFCO assertions.

Verified all 733 tests with Valgrind (zero errors) and ASan; the recorded restart fuel trace is unchanged.
@mck1117

mck1117 commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

does this need its own threshold? is there another parameter/piece of state we can recycle?

@gdiciocco

Copy link
Copy Markdown
Contributor Author

ASE looks like a suitable state to reuse. I propose keeping the isRunning() gate and inhibiting DFCO while postCrankingFuelCorrection > 1.0, removing the new dfcoStartupDelay setting.

ASE should taper back to 1.0. If the table keeps requesting enrichment, DFCO would remain inhibited; that behavior would be documented as a calibration requirement.

TunerStudio supports conditional text and panels. We could show a note when table-based ASE and DFCO are both enabled, in the ASE table view and the DFCO dialog:

After-start enrichment must taper back to 1.0 to allow DFCO. Fuel cut remains inhibited while the ASE multiplier is above 1.0.

This would retain the protection requested in #820 without adding another tuning parameter. We would also need to calculate the current ASE factor before updating DFCO and handle timer resets on restarts, including transitions to RUNNING without an intervening cranking callback.

Would you agree with this approach?

mck1117 added a commit that referenced this pull request Oct 10, 2026
}

void expectFuel(bool cut) {
EXPECT_EQ(cut, engine->module<DfcoController>()->cutFuel());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't wrap gtest EXPECT... in a helper - it loses the file/line number where the assertion failure happened. If you want a helper, use a #define instead, as that'll expand inline and preserve the error's location.

jcor25 added a commit to jcor25/fome-fw-x-vt that referenced this pull request Oct 15, 2026
27 upstream commits: WiFi reliability fixes, log and ini download over
WiFi (FOME-Tech#842), partial pick of FOME-Tech#823 (inhibit DFCO unless running), ETB idle
range up to 30% (FOME-Tech#845), H7 flash fixes (FOME-Tech#833), MK60e5 speed decode fix.

Conflicts resolved:
- dfco.cpp: upstream's isRunning() check (same code, upstream comment)
  followed by our after-start enrichment check, which upstream lacks
- test_fuelCut.cpp: upstream's RUNNING setup for existing tests; our
  four new tests kept
- CHANGELOG.md: both sides' entries kept

This merge alone overflows vthpnp RAM by 25,744 bytes; the next commit
makes it fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jcor25 added a commit to jcor25/fome-fw-x-vt that referenced this pull request Oct 15, 2026
Per review feedback on FOME-Tech#823: gtest assertions inside a helper function
report the helper's line rather than the test's, and a failed ASSERT only
returns from the helper, so the test carries on. As a macro the
assertions expand in the test body and fail at the right line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DFCO can cut fuel while after-start enrichment is still tapering

2 participants