rusefi/firmware/controllers/shutdown_controller.h

39 lines
747 B
C
Raw Normal View History

2022-09-28 19:42:08 -07:00
/*
* @file shutdown_controller.h
*
*/
#pragma once
2023-08-30 20:11:24 -07:00
#include <rusefi/timer.h>
2022-09-28 19:42:08 -07:00
void doScheduleStopEngine();
class ShutdownController {
public:
void stopEngine() {
m_engineStopTimer.reset();
// ignitionOnTimeNt = 0;
}
// float getTimeSinceEngineStop(efitick_t nowNt) const {
// return m_engineStopTimer.getElapsedSeconds(nowNt);
// }
2022-09-28 19:42:08 -07:00
bool isEngineStop(efitick_t nowNt) const {
float timeSinceStopRequested = m_engineStopTimer.getElapsedSeconds(nowNt);
2022-09-28 19:42:08 -07:00
// If there was stop requested in the past 5 seconds, we're in stop mode
return timeSinceStopRequested < 5;
2022-09-28 19:42:08 -07:00
}
private:
Timer m_engineStopTimer;
/**
* this is needed by and checkShutdown()
*/
// is this an unused boolean value?
// efitick_t ignitionOnTimeNt = 0;
};