Skip to content

Commit

Permalink
MISRA
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoung8607 committed Sep 18, 2024
1 parent c4d4e20 commit 583a490
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions board/safety/safety_fca_giorgio.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ static uint32_t fca_giorgio_compute_crc(const CANPacket_t *to_push) {
uint8_t crc = 0U;
uint8_t final_xor = 0U;

for (int i = 0; i < len - 1; i++) {
for (int i = 0; i < (len - 1); i++) {
crc ^= (uint8_t)GET_BYTE(to_push, i);
crc = fca_giorgio_crc8_lut_j1850[crc];
}

// TODO: bruteforce final XORs for Panda relevant messages
if (addr == 0xFFU) {
if (addr == 0xFF) {
final_xor = 0xFFU;
} else {
final_xor = 0x0;
}

return (uint8_t)(crc ^ final_xor);
Expand Down Expand Up @@ -114,7 +116,7 @@ static void fca_giorgio_rx_hook(const CANPacket_t *to_push) {

// Signal: ABS_3.BRAKE_PEDAL_SWITCH
if (addr == FCA_GIORGIO_ABS_3) {
brake_pressed = GET_BIT(to_push, 3);
brake_pressed = GET_BIT(to_push, 3U);
}

generic_rx_checks((addr == FCA_GIORGIO_LKA_COMMAND));
Expand Down

0 comments on commit 583a490

Please sign in to comment.