|
|
|
@ -148,20 +148,20 @@ bool addr_safety_check(CAN_FIFOMailBox_TypeDef *to_push, |
|
|
|
|
|
|
|
|
|
if (index != -1) { |
|
|
|
|
// checksum check
|
|
|
|
|
if ((get_checksum != NULL) && (compute_checksum != NULL)) { |
|
|
|
|
if (rx_checks[index].check_checksum) { |
|
|
|
|
if ((get_checksum != NULL) && (compute_checksum != NULL) && rx_checks[index].check_checksum) { |
|
|
|
|
uint8_t checksum = get_checksum(to_push); |
|
|
|
|
uint8_t checksum_comp = compute_checksum(to_push); |
|
|
|
|
rx_checks[index].valid_checksum = checksum_comp == checksum; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
rx_checks[index].valid_checksum = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// counter check
|
|
|
|
|
if (get_counter != NULL) { |
|
|
|
|
if (rx_checks[index].max_counter > 0U) { |
|
|
|
|
// counter check (max_counter == 0 means skip check)
|
|
|
|
|
if ((get_counter != NULL) && (rx_checks[index].max_counter > 0U)) { |
|
|
|
|
uint8_t counter = get_counter(to_push); |
|
|
|
|
update_counter(rx_checks, index, counter); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
rx_checks[index].wrong_counters = 0U; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return is_msg_valid(rx_checks, index); |
|
|
|
|