This commit is contained in:
parent
28a273cae7
commit
3b88f847e0
|
@ -4,7 +4,13 @@
|
|||
|
||||
void MainRelayController::onSlowCallback() {
|
||||
#if EFI_MAIN_RELAY_CONTROL
|
||||
if (engineConfiguration->ignitionKeyDigitalPin != Gpio::Unassigned) {
|
||||
// separate digital input pin just for main relay logic since it's preferred to read voltage from main relay
|
||||
// key-on is usually a bit smaller voltage than main relay but sometimes even 1v off!
|
||||
hasIgnitionVoltage = efiReadPin(engineConfiguration->ignitionKeyDigitalPin);
|
||||
} else {
|
||||
hasIgnitionVoltage = Sensor::getOrZero(SensorType::BatteryVoltage) > 5;
|
||||
}
|
||||
|
||||
if (hasIgnitionVoltage) {
|
||||
m_lastIgnitionTime.reset();
|
||||
|
@ -24,7 +30,7 @@ void MainRelayController::onSlowCallback() {
|
|||
}
|
||||
|
||||
bool MainRelayController::needsDelayedShutoff() {
|
||||
// Prevent main relay from turning off if we had igniton voltage in the past 1 second
|
||||
// Prevent main relay from turning off if we had ignition voltage in the past 1 second
|
||||
// This avoids accidentally killing the car during a transient, for example
|
||||
// right when the starter is engaged.
|
||||
return !m_lastIgnitionTime.hasElapsedSec(1);
|
||||
|
|
Loading…
Reference in New Issue