enable unsafe mode, toggle for use by forks that so choose

master
George Hotz 2020-03-30 18:18:44 -07:00
parent de89fcdc4f
commit 4556e7494c
2 changed files with 10 additions and 0 deletions

View File

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

View File

@ -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