Skip to content

Commit

Permalink
merge health.h and can_health.h (commaai#1075)
Browse files Browse the repository at this point in the history
init
  • Loading branch information
briskspirit authored Sep 19, 2022
1 parent a19f125 commit b861992
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
24 changes: 0 additions & 24 deletions board/can_health.h

This file was deleted.

26 changes: 25 additions & 1 deletion board/health.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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;
3 changes: 2 additions & 1 deletion board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions board/main_comms.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "health.h"

extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used

// Prototypes
Expand Down

0 comments on commit b861992

Please sign in to comment.