| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file shutdown_controller.h | |||
| 3 | * | |||
| 4 | */ | |||
| 5 | ||||
| 6 | #pragma once | |||
| 7 | ||||
| 8 | #include <rusefi/timer.h> | |||
| 9 | ||||
| 10 | enum class StopRequestedReason : uint8_t { | |||
| 11 | None, // 0 | |||
| 12 | StartButton, // 1 | |||
| 13 | Lua, // 2 | |||
| 14 | Console, // 3 | |||
| 15 | TsCommand, // 4 | |||
| 16 | ||||
| 17 | Board1, | |||
| 18 | Board2, | |||
| 19 | Board3, | |||
| 20 | ||||
| 21 | }; | |||
| 22 | ||||
| 23 | void doScheduleStopEngine(StopRequestedReason reason); | |||
| 24 | ||||
| 25 | class ShutdownController { | |||
| 26 | public: | |||
| 27 | void stopEngine(StopRequestedReason reason); | |||
| 28 | ||||
| 29 | 3677 | bool isEngineStop(efitick_t nowNt) const { | ||
| 30 | 3677 | float timeSinceStopRequested = m_engineStopTimer.getElapsedSeconds(nowNt); | ||
| 31 | ||||
| 32 | // If there was stop requested in the past 5 seconds, we're in stop mode | |||
| 33 | 3677 | return timeSinceStopRequested < 5; | ||
| 34 | } | |||
| 35 | ||||
| 36 | private: | |||
| 37 | Timer m_engineStopTimer; | |||
| 38 | }; | |||
| 39 |