From e70b44aa573004b1b45ec587184c4840e2216494 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Wed, 22 May 2019 15:46:45 -0700 Subject: [PATCH] move that to main.c --- board/main.c | 5 +++++ board/safety.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/board/main.c b/board/main.c index e5e4a0b246ef1f..709a2a94357e1d 100644 --- a/board/main.c +++ b/board/main.c @@ -285,6 +285,11 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) { // Allow ELM security mode to be set over wifi. if (hardwired || (setup->b.wValue.w == SAFETY_NOOUTPUT) || (setup->b.wValue.w == SAFETY_ELM327)) { safety_set_mode(setup->b.wValue.w, (int16_t)setup->b.wIndex.w); + if (safety_ignition_hook() != -1) { + // if the ignition hook depends on something other than the started GPIO + // we have to disable power savings (fix for GM and Tesla) + power_save_disable(); + } switch (setup->b.wValue.w) { case SAFETY_NOOUTPUT: can_silent = ALL_CAN_SILENT; diff --git a/board/safety.h b/board/safety.h index 52c65bb7397ae2..722ba3994fe030 100644 --- a/board/safety.h +++ b/board/safety.h @@ -133,11 +133,6 @@ int safety_set_mode(uint16_t mode, int16_t param) { if (safety_hook_registry[i].id == mode) { current_hooks = safety_hook_registry[i].hooks; if (current_hooks->init) current_hooks->init(param); - if (safety_ignition_hook() != -1) { - // if the ignition hook depends on something other than the started GPIO - // we have to disable power savings (fix for GM and Tesla) - power_save_disable(); - } return 0; } }