Overdwell at times around syncloss while cranking #6349

only: better handling of existing out-of-order handling
This commit is contained in:
Andrey 2024-04-17 18:54:08 -04:00
parent 59e415728e
commit 6873974c0a
1 changed files with 6 additions and 1 deletions

View File

@ -31,10 +31,15 @@ static void testNoOverdwell(const char* file, bool instantRpm) {
std::vector<efitick_t> coilStartTimes(12);
engine->onIgnitionEvent = [&](IgnitionEvent* event, bool state) {
efitick_t startTime = coilStartTimes[event->coilIndex];
if (state) {
coilStartTimes[event->coilIndex] = getTimeNowNt();
} else if (startTime == 0) {
printf("Interesting: goes LOW without ever going HIGH %d\n", event->coilIndex);
} else {
auto actualDwell = 1e-3 * NT2USF(getTimeNowNt() - coilStartTimes[event->coilIndex]);
auto actualDwell = 1e-3 * NT2USF(getTimeNowNt() - startTime);
coilStartTimes[event->coilIndex] = 0;
EXPECT_LT(actualDwell, 50) << "Overdwell on cylinder " << (int)event->coilIndex << " of " << actualDwell << " ms";
}