From b86199244a2b1cd0cdaa5e50d42e9b2bbf0c73f1 Mon Sep 17 00:00:00 2001 From: Igor Biletskyy Date: Mon, 19 Sep 2022 16:11:49 -0700 Subject: [PATCH] merge health.h and can_health.h (#1075) init --- board/can_health.h | 24 ------------------------ board/health.h | 26 +++++++++++++++++++++++++- board/main.c | 3 ++- board/main_comms.h | 2 -- 4 files changed, 27 insertions(+), 28 deletions(-) delete mode 100644 board/can_health.h diff --git a/board/can_health.h b/board/can_health.h deleted file mode 100644 index b0bbbc5020..0000000000 --- a/board/can_health.h +++ /dev/null @@ -1,24 +0,0 @@ -// When changing this struct, python/__init__.py needs to be kept up to date! -#define CAN_HEALTH_PACKET_VERSION 2 -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) - uint8_t receive_error_cnt; // REC - uint8_t transmit_error_cnt; // TEC - uint32_t total_error_cnt; // How many times any error interrupt were invoked - uint32_t total_tx_lost_cnt; // Tx event FIFO element Lost - uint32_t total_rx_lost_cnt; // Rx FIFO 0 message Lost - uint32_t total_tx_cnt; - uint32_t total_rx_cnt; - uint32_t total_fwd_cnt; // Messages forwarded from one bus to another - uint16_t can_speed; - uint16_t can_data_speed; - uint8_t canfd_enabled; - uint8_t brs_enabled; -} can_health_t; diff --git a/board/health.h b/board/health.h index 9b6dafb543..947fdb4015 100644 --- a/board/health.h +++ b/board/health.h @@ -1,4 +1,4 @@ -// When changing this struct, python/__init__.py needs to be kept up to date! +// When changing these structs, python/__init__.py needs to be kept up to date! #define HEALTH_PACKET_VERSION 10 @@ -26,3 +26,27 @@ struct __attribute__((packed)) health_t { float interrupt_load; uint8_t fan_power; }; + +#define CAN_HEALTH_PACKET_VERSION 2 +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) + uint8_t receive_error_cnt; // REC + uint8_t transmit_error_cnt; // TEC + uint32_t total_error_cnt; // How many times any error interrupt were invoked + uint32_t total_tx_lost_cnt; // Tx event FIFO element Lost + uint32_t total_rx_lost_cnt; // Rx FIFO 0 message Lost + uint32_t total_tx_cnt; + uint32_t total_rx_cnt; + uint32_t total_fwd_cnt; // Messages forwarded from one bus to another + uint16_t can_speed; + uint16_t can_data_speed; + uint8_t canfd_enabled; + uint8_t brs_enabled; +} can_health_t; diff --git a/board/main.c b/board/main.c index 8306bc4d33..48ed4c7fe6 100644 --- a/board/main.c +++ b/board/main.c @@ -12,7 +12,8 @@ #include "power_saving.h" #include "safety.h" -#include "can_health.h" +#include "health.h" + #include "drivers/can_common.h" #ifdef STM32H7 diff --git a/board/main_comms.h b/board/main_comms.h index 250c333e47..71488de670 100644 --- a/board/main_comms.h +++ b/board/main_comms.h @@ -1,5 +1,3 @@ -#include "health.h" - extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used // Prototypes