mirror of https://github.com/commaai/panda.git
fixup can silent on elm327 mode
This commit is contained in:
parent
54efeae177
commit
ddbcd570bc
|
@ -1,5 +1,5 @@
|
|||
// IRQs: CAN1_TX, CAN1_RX0, CAN1_SCE, CAN2_TX, CAN2_RX0, CAN2_SCE, CAN3_TX, CAN3_RX0, CAN3_SCE
|
||||
int can_live = 0, pending_can_live = 0, can_loopback = 0, can_silent = 1;
|
||||
int can_live = 0, pending_can_live = 0, can_loopback = 0, can_silent = 0xff;
|
||||
|
||||
// ********************* instantiate queues *********************
|
||||
|
||||
|
@ -132,7 +132,7 @@ void can_init(uint8_t can_number) {
|
|||
CAN->BTR |= CAN_BTR_SILM | CAN_BTR_LBKM;
|
||||
}
|
||||
|
||||
if (can_silent) {
|
||||
if (can_silent & (1 << can_number)) {
|
||||
CAN->BTR |= CAN_BTR_SILM;
|
||||
}
|
||||
|
||||
|
|
14
board/main.c
14
board/main.c
|
@ -251,9 +251,19 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) {
|
|||
// this is the only way to leave silent mode
|
||||
// and it's blocked over WiFi
|
||||
// Allow ELM security mode to be set over wifi.
|
||||
if (hardwired || setup->b.wValue.w == SAFETY_ELM327) {
|
||||
if (hardwired || setup->b.wValue.w == SAFETY_NOOUTPUT || setup->b.wValue.w == SAFETY_ELM327) {
|
||||
safety_set_mode(setup->b.wValue.w);
|
||||
can_silent = (setup->b.wValue.w == SAFETY_NOOUTPUT);
|
||||
switch (setup->b.wValue.w) {
|
||||
case SAFETY_NOOUTPUT:
|
||||
can_silent = 0xff;
|
||||
break;
|
||||
case SAFETY_ELM327:
|
||||
can_silent = 0xfe;
|
||||
break;
|
||||
default:
|
||||
can_silent = 0;
|
||||
break;
|
||||
}
|
||||
can_init_all();
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue