Skip to content

Commit

Permalink
Honda: fix controls mismatch for stock PCM configs
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed Jan 26, 2022
1 parent 2c419de commit 6f8a0a3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions board/safety/safety_honda.h
Expand Up @@ -95,6 +95,9 @@ static int honda_rx_hook(CANPacket_t *to_push) {
bool valid = addr_safety_check(to_push, &honda_rx_checks,
honda_get_checksum, honda_compute_checksum, honda_get_counter);


const bool pcm_enable = ((honda_hw == HONDA_BOSCH && !honda_bosch_long)) || ((honda_hw == HONDA_NIDEC) && !gas_interceptor_detected);

if (valid) {
int addr = GET_ADDR(to_push);
int len = GET_LEN(to_push);
Expand All @@ -115,9 +118,13 @@ static int honda_rx_hook(CANPacket_t *to_push) {
}
}

// state machine to enter and exit controls
if (pcm_enable && (addr == 0x17C)) {
controls_allowed = GET_BIT(to_push, 38) != 0;
}

// state machine to enter and exit controls for button enabling
// 0x1A6 for the ILX, 0x296 for the Civic Touring
if ((addr == 0x1A6) || (addr == 0x296)) {
if (!pcm_enable && ((addr == 0x1A6) || (addr == 0x296))) {
// check for button presses
int button = (GET_BYTE(to_push, 0) & 0xE0U) >> 5;
switch (button) {
Expand Down

0 comments on commit 6f8a0a3

Please sign in to comment.