Better handling of RPM during stop of cranking #3803

refactoring: reusing existing method
This commit is contained in:
rusefillc 2022-01-17 21:00:49 -05:00
parent c625228aaf
commit 2da6593305
3 changed files with 8 additions and 6 deletions

View File

@ -514,9 +514,7 @@ void Engine::watchdog() {
* todo: better watch dog implementation should be implemented - see * todo: better watch dog implementation should be implemented - see
* http://sourceforge.net/p/rusefi/tickets/96/ * http://sourceforge.net/p/rusefi/tickets/96/
*/ */
float secondsSinceTriggerEvent = engine->triggerCentral.getTimeSinceTriggerEvent(getTimeNowNt()); if (engine->triggerCentral.engineMovedRecently()) {
if (secondsSinceTriggerEvent < 0.5f) {
// Engine moved recently, no need to safe pins. // Engine moved recently, no need to safe pins.
return; return;
} }

View File

@ -105,7 +105,7 @@ bool RpmCalculator::checkIfSpinning(efitick_t nowNt) const {
/** /**
* Also check if there were no trigger events * Also check if there were no trigger events
*/ */
bool noTriggerEventsForTooLong = engine->triggerCentral.getTimeSinceTriggerEvent(nowNt) >= 1; bool noTriggerEventsForTooLong = !engine->triggerCentral.engineMovedRecently(nowNt);
if (noRpmEventsForTooLong || noTriggerEventsForTooLong) { if (noRpmEventsForTooLong || noTriggerEventsForTooLong) {
return false; return false;

View File

@ -70,11 +70,15 @@ public:
return m_lastEventTimer.getElapsedSeconds(nowNt); return m_lastEventTimer.getElapsedSeconds(nowNt);
} }
bool engineMovedRecently() const { bool engineMovedRecently(efitick_t nowNt) const {
// Trigger event some time in the past second = engine moving // Trigger event some time in the past second = engine moving
// distributor single tooth, large engines crank at close to 120 RPM // distributor single tooth, large engines crank at close to 120 RPM
// todo: make this logic account current trigger to stop idle much faster if we have more teeth on trigger wheels? // todo: make this logic account current trigger to stop idle much faster if we have more teeth on trigger wheels?
return getTimeSinceTriggerEvent(getTimeNowNt()) < 1.0f; return getTimeSinceTriggerEvent(nowNt) < 1.0f;
}
bool engineMovedRecently() const {
return engineMovedRecently(getTimeNowNt());
} }
TriggerNoiseFilter noiseFilter; TriggerNoiseFilter noiseFilter;