diff --git a/board/main.c b/board/main.c index 8bc4ac7..e27fc4d 100644 --- a/board/main.c +++ b/board/main.c @@ -469,6 +469,10 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired) can_init(CAN_NUM_FROM_BUS_NUM(setup->b.wValue.w)); } break; + // **** 0xdf: set unsafe mode + case 0xdf: + unsafe_mode = setup->b.wValue.w; + break; // **** 0xe0: uart read case 0xe0: ur = get_ring_by_number(setup->b.wValue.w); diff --git a/board/safety_declarations.h b/board/safety_declarations.h index aa9f7fd..775b434 100644 --- a/board/safety_declarations.h +++ b/board/safety_declarations.h @@ -88,6 +88,12 @@ int gas_interceptor_prev = 0; bool gas_pressed_prev = false; bool brake_pressed_prev = false; +// This can be set with a USB command +// It enables features we consider to be unsafe, but understand others may have different opinions +// One example of such a feature is gas disengage +// It is always off on mainline comma.ai openpilot +bool unsafe_mode = false; + // time since safety mode has been changed uint32_t safety_mode_cnt = 0U; // allow 1s of transition timeout after relay changes state before assessing malfunctioning