always CANFD

This commit is contained in:
Adeeb Shihadeh
2025-08-26 15:32:06 -07:00
parent 0fe56bc289
commit ac6122e272
6 changed files with 3 additions and 21 deletions

View File

@@ -1,12 +1,7 @@
#pragma once
#define CANPACKET_HEAD_SIZE 6U
#ifdef CANFD
#define CANPACKET_DATA_SIZE_MAX 64U
#else
#define CANPACKET_DATA_SIZE_MAX 8U
#endif
#define CANPACKET_DATA_SIZE_MAX 64U
typedef struct {
unsigned char fd : 1;

View File

@@ -112,7 +112,6 @@ void hyundai_common_cruise_buttons_check(const int cruise_button, const bool mai
}
}
#ifdef CANFD
uint32_t hyundai_common_canfd_compute_checksum(const CANPacket_t *msg) {
int len = GET_LEN(msg);
uint32_t address = msg->addr;
@@ -137,4 +136,3 @@ uint32_t hyundai_common_canfd_compute_checksum(const CANPacket_t *msg) {
return crc;
}
#endif

View File

@@ -25,11 +25,7 @@
#include "opendbc/safety/modes/elm327.h"
#include "opendbc/safety/modes/body.h"
#include "opendbc/safety/modes/psa.h"
// CAN-FD only safety modes
#ifdef CANFD
#include "opendbc/safety/modes/hyundai_canfd.h"
#endif
uint32_t GET_BYTES(const CANPacket_t *msg, int start, int len) {
uint32_t ret = 0U;
@@ -296,7 +292,6 @@ void gen_crc_lookup_table_8(uint8_t poly, uint8_t crc_lut[]) {
}
}
#ifdef CANFD
void gen_crc_lookup_table_16(uint16_t poly, uint16_t crc_lut[]) {
for (uint16_t i = 0; i < 256U; i++) {
uint16_t crc = i << 8U;
@@ -310,7 +305,6 @@ void gen_crc_lookup_table_16(uint16_t poly, uint16_t crc_lut[]) {
crc_lut[i] = crc;
}
}
#endif
// 1Hz safety function called by main. Now just a check for lagging safety messages
void safety_tick(const safety_config *cfg) {
@@ -409,9 +403,7 @@ int set_safety_hooks(uint16_t mode, uint16_t param) {
{SAFETY_FORD, &ford_hooks},
{SAFETY_RIVIAN, &rivian_hooks},
{SAFETY_TESLA, &tesla_hooks},
#ifdef CANFD
{SAFETY_HYUNDAI_CANFD, &hyundai_canfd_hooks},
#endif
#ifdef ALLOW_DEBUG
{SAFETY_PSA, &psa_hooks},
{SAFETY_SUBARU_PREGLOBAL, &subaru_preglobal_hooks},

View File

@@ -230,9 +230,7 @@ void update_sample(struct sample_t *sample, int sample_new);
bool get_longitudinal_allowed(void);
int ROUND(float val);
void gen_crc_lookup_table_8(uint8_t poly, uint8_t crc_lut[]);
#ifdef CANFD
void gen_crc_lookup_table_16(uint16_t poly, uint16_t crc_lut[]);
#endif
bool steer_torque_cmd_checks(int desired_torque, int steer_req, const TorqueSteeringLimits limits);
bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const AngleSteeringLimits limits);
bool steer_angle_cmd_checks_vm(int desired_angle, bool steer_control_enabled, const AngleSteeringLimits limits,

View File

@@ -22,7 +22,6 @@ env = Environment(
'-std=gnu11',
'-Wfatal-errors',
'-Wno-pointer-to-int-cast',
'-DCANFD',
],
CPPPATH=["#", "../../board/"],
tools=["default", "compilation_db"],

View File

@@ -55,8 +55,8 @@ cppcheck() {
PANDA_OPTS=" --enable=all --enable=unusedFunction --addon=misra"
printf "\n${GREEN}** Safety with CANFD **${NC}\n"
cppcheck $PANDA_OPTS -DCANFD $BASEDIR/opendbc/safety/tests/misra/main.c
printf "\n${GREEN}** Safety **${NC}\n"
cppcheck $PANDA_OPTS $BASEDIR/opendbc/safety/tests/misra/main.c
printf "\n${GREEN}Success!${NC} took $SECONDS seconds\n"