From 3b1316f62206f831ca0771a599434e285a689f45 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 8 Nov 2024 15:31:27 -0500 Subject: [PATCH] only:secondsSinceIgnVoltage API --- firmware/controllers/ignition_controller.cpp | 2 +- firmware/controllers/ignition_controller.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/ignition_controller.cpp b/firmware/controllers/ignition_controller.cpp index 6d385dc4fe..1c4967afd9 100644 --- a/firmware/controllers/ignition_controller.cpp +++ b/firmware/controllers/ignition_controller.cpp @@ -20,7 +20,7 @@ void IgnitionController::onSlowCallback() { // Ignore low voltage transients - we may see this at the start of cranking // and we don't want to - if (!hasIgnVoltage && !m_timeSinceIgnVoltage.hasElapsedSec(0.2f)) { + if (!hasIgnVoltage && secondsSinceIgnVoltage() < 0.2f) { return; } diff --git a/firmware/controllers/ignition_controller.h b/firmware/controllers/ignition_controller.h index 64e31144c8..acbfaa8b76 100644 --- a/firmware/controllers/ignition_controller.h +++ b/firmware/controllers/ignition_controller.h @@ -16,6 +16,10 @@ public: return m_lastState; } + float secondsSinceIgnVoltage() { + return m_timeSinceIgnVoltage.getElapsedSeconds(); + } + private: Timer m_timeSinceIgnVoltage; bool m_lastState = false;