Skip to content

Commit

Permalink
enable unsafe mode, toggle for use by forks that so choose
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Mar 31, 2020
1 parent de89fcd commit 4556e74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions board/safety_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4556e74

Please sign in to comment.