Skip to content

Commit

Permalink
Fix CAN Ignition for Black Panda and Uno (commaai#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcopenpilot authored May 8, 2020
1 parent 273e388 commit ac1b64e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions board/boards/black.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ void black_enable_can_transciever(uint8_t transciever, bool enabled) {
}

void black_enable_can_transcievers(bool enabled) {
uint8_t t1 = enabled ? 1U : 2U; // leave transciever 1 enabled to detect CAN ignition
for(uint8_t i=t1; i<=4U; i++) {
black_enable_can_transciever(i, enabled);
for(uint8_t i=1U; i<=4U; i++){
// Leave main CAN always on for CAN-based ignition detection
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
black_enable_can_transciever(i, true);
} else {
black_enable_can_transciever(i, enabled);
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion board/boards/uno.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ void uno_enable_can_transciever(uint8_t transciever, bool enabled) {

void uno_enable_can_transcievers(bool enabled) {
for(uint8_t i=1U; i<=4U; i++){
uno_enable_can_transciever(i, enabled);
// Leave main CAN always on for CAN-based ignition detection
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
uno_enable_can_transciever(i, true);
} else {
uno_enable_can_transciever(i, enabled);
}
}
}

Expand Down

0 comments on commit ac1b64e

Please sign in to comment.