2022-09-20 07:11:49 +08:00
|
|
|
// When changing these structs, python/__init__.py needs to be kept up to date!
|
2022-09-01 11:46:07 +08:00
|
|
|
|
2023-04-06 13:05:14 +08:00
|
|
|
#define HEALTH_PACKET_VERSION 12
|
2022-01-28 10:12:25 +08:00
|
|
|
struct __attribute__((packed)) health_t {
|
|
|
|
uint32_t uptime_pkt;
|
|
|
|
uint32_t voltage_pkt;
|
|
|
|
uint32_t current_pkt;
|
2022-09-16 04:08:46 +08:00
|
|
|
uint32_t safety_tx_blocked_pkt;
|
|
|
|
uint32_t safety_rx_invalid_pkt;
|
|
|
|
uint32_t tx_buffer_overflow_pkt;
|
|
|
|
uint32_t rx_buffer_overflow_pkt;
|
2022-01-28 10:12:25 +08:00
|
|
|
uint32_t gmlan_send_errs_pkt;
|
|
|
|
uint32_t faults_pkt;
|
|
|
|
uint8_t ignition_line_pkt;
|
|
|
|
uint8_t ignition_can_pkt;
|
|
|
|
uint8_t controls_allowed_pkt;
|
|
|
|
uint8_t gas_interceptor_detected_pkt;
|
|
|
|
uint8_t car_harness_status_pkt;
|
|
|
|
uint8_t safety_mode_pkt;
|
2022-05-03 04:36:19 +08:00
|
|
|
uint16_t safety_param_pkt;
|
2022-01-28 10:12:25 +08:00
|
|
|
uint8_t fault_status_pkt;
|
|
|
|
uint8_t power_save_enabled_pkt;
|
|
|
|
uint8_t heartbeat_lost_pkt;
|
2022-03-25 05:31:31 +08:00
|
|
|
uint16_t alternative_experience_pkt;
|
2022-04-11 17:59:47 +08:00
|
|
|
float interrupt_load;
|
2022-08-18 11:43:49 +08:00
|
|
|
uint8_t fan_power;
|
2022-10-04 07:05:16 +08:00
|
|
|
uint8_t safety_rx_checks_invalid;
|
2023-04-06 13:05:14 +08:00
|
|
|
uint16_t spi_checksum_error_count;
|
2022-01-28 10:12:25 +08:00
|
|
|
};
|
2022-09-20 07:11:49 +08:00
|
|
|
|
2023-01-14 02:59:58 +08:00
|
|
|
#define CAN_HEALTH_PACKET_VERSION 4
|
2022-09-20 07:11:49 +08:00
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
uint8_t bus_off;
|
|
|
|
uint32_t bus_off_cnt;
|
|
|
|
uint8_t error_warning;
|
|
|
|
uint8_t error_passive;
|
|
|
|
uint8_t last_error; // real time LEC value
|
|
|
|
uint8_t last_stored_error; // last LEC positive error code stored
|
|
|
|
uint8_t last_data_error; // DLEC (for CANFD only)
|
|
|
|
uint8_t last_data_stored_error; // last DLEC positive error code stored (for CANFD only)
|
2023-04-14 08:37:48 +08:00
|
|
|
uint8_t receive_error_cnt; // Actual state of the receive error counter, values between 0 and 127. FDCAN_ECR.REC
|
|
|
|
uint8_t transmit_error_cnt; // Actual state of the transmit error counter, values between 0 and 255. FDCAN_ECR.TEC
|
|
|
|
uint32_t total_error_cnt; // How many times any error interrupt was invoked
|
|
|
|
uint32_t total_tx_lost_cnt; // Tx event FIFO element lost
|
|
|
|
uint32_t total_rx_lost_cnt; // Rx FIFO 0 message lost due to FIFO full condition
|
2022-09-20 07:11:49 +08:00
|
|
|
uint32_t total_tx_cnt;
|
|
|
|
uint32_t total_rx_cnt;
|
|
|
|
uint32_t total_fwd_cnt; // Messages forwarded from one bus to another
|
2023-01-14 02:59:58 +08:00
|
|
|
uint32_t total_tx_checksum_error_cnt;
|
2022-09-20 07:11:49 +08:00
|
|
|
uint16_t can_speed;
|
|
|
|
uint16_t can_data_speed;
|
|
|
|
uint8_t canfd_enabled;
|
|
|
|
uint8_t brs_enabled;
|
2022-10-13 06:28:20 +08:00
|
|
|
uint8_t canfd_non_iso;
|
2022-09-20 07:11:49 +08:00
|
|
|
} can_health_t;
|