Skip to content

Commit d85a4fb

Browse files
committed
"engine stopped" timeout was too aggressive
1 parent 37b83a1 commit d85a4fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

firmware/controllers/trigger/trigger_decoder.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ expected<TriggerDecodeResult> TriggerDecoderBase::decodeTriggerEvent(
372372
ScopePerf perf(PE::DecodeTriggerEvent);
373373

374374
// Timeout below approximately 12 rpm, but a maximum of 1 second timeout
375-
float triggerTimeoutPeriod = std::min(5.0f / triggerShape.getLength(), 1.0f);
375+
// Trigger shape length is ~4x tooth count (rise + fall / doubled for 4 stroke),
376+
// so extra multiply by 4 then 5 second maximum revolution
377+
float triggerTimeoutPeriod = clampF(0.1f, 20.0f / triggerShape.getLength(), 1.0f);
376378
if (previousEventTimer.getElapsedSecondsAndReset(nowNt) > triggerTimeoutPeriod) {
377379
/**
378380
* We are here if there is a time gap between now and previous shaft event - that means the engine is not running.

0 commit comments

Comments
 (0)