fix vBatt false-detection

This commit is contained in:
rusefillc 2021-12-01 11:22:13 -05:00
parent 628e0568f8
commit 0ce025b1f5
1 changed files with 3 additions and 1 deletions

View File

@ -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!");