From 0ce025b1f502d3ad60f045ef089b6943b9b65b12 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 1 Dec 2021 11:22:13 -0500 Subject: [PATCH] fix vBatt false-detection --- firmware/controllers/algo/engine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index e92e5c9988..491dedddce 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -522,7 +522,9 @@ void Engine::checkShutdown() { // if the ignition key is turned on again, // we cancel the shutdown mode, but only if all shutdown procedures are complete const float vBattThresholdOn = 8.0f; - if ((Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) > vBattThresholdOn) && !isInShutdownMode()) { + // we fallback into zero instead of VBAT_FALLBACK_VALUE because it's not safe to false-trigger the "ignition on" event, + // and we want to turn on the main relay only when 100% sure. + if ((Sensor::get(SensorType::BatteryVoltage).value_or(0) > vBattThresholdOn) && !isInShutdownMode()) { ignitionOnTimeNt = getTimeNowNt(); stopEngineRequestTimeNt = 0; efiPrintf("Ignition voltage detected! Cancel the engine shutdown!");