diff --git a/board/main.c b/board/main.c index 66653b0b..f2c93340 100644 --- a/board/main.c +++ b/board/main.c @@ -28,7 +28,9 @@ // ********************* Serial debugging ********************* bool check_started(void) { - return current_board->check_ignition() || ignition_can; + bool started = current_board->check_ignition() || ignition_can; + ignition_seen |= started; + return started; } void debug_ring_callback(uart_ring *ring) { @@ -419,7 +421,7 @@ int main(void) { } #endif } else { - if (deepsleep_allowed && !usb_enumerated && !check_started()) { + if (deepsleep_allowed && !usb_enumerated && !check_started() && ignition_seen && (heartbeat_counter > 20U)) { usb_soft_disconnect(true); current_board->set_fan_power(0U); current_board->set_usb_power_mode(USB_POWER_CLIENT); diff --git a/board/main_declarations.h b/board/main_declarations.h index f9b08d4e..c1fc8703 100644 --- a/board/main_declarations.h +++ b/board/main_declarations.h @@ -22,6 +22,7 @@ bool heartbeat_disabled = false; // set over USB // Enter deep sleep mode bool deepsleep_allowed = false; +bool ignition_seen = false; // siren state bool siren_enabled = false;