This commit is contained in:
hamza
2024-07-07 21:16:36 +03:00
parent 5a84a349d9
commit b5410639eb
9 changed files with 34 additions and 22 deletions

View File

@ -47,7 +47,7 @@ struct ADBMS6830_Internal_Status {
typedef struct {
int16_t cellVoltages[MAXIMUM_CELL_VOLTAGES];
int16_t auxVoltages[MAXIMUM_AUX_VOLTAGES];
float auxVoltages[MAXIMUM_AUX_VOLTAGES];
struct ADBMS6830_Internal_Status status;
uint16 internalDieTemp;

View File

@ -12,7 +12,7 @@
#define ERROR_TIME_THRESH 150 // ms
typedef enum {
typedef enum : uint16_t {
SEK_OVERTEMP = 0x0,
SEK_UNDERTEMP = 0x1,
SEK_OVERVOLT = 0x2,
@ -27,7 +27,7 @@ typedef enum {
} SlaveErrorKind;
typedef struct {
int error_sources;
uint16_t error_sources;
SlaveErrorKind data_kind;
uint8_t data[4];
uint32_t errors_since;
@ -35,7 +35,7 @@ typedef struct {
extern SlaveErrorData error_data;
void set_error_source(int source);
void clear_error_source(int source);
void set_error_source(SlaveErrorKind source);
void clear_error_source(SlaveErrorKind source);
#endif // INC_ERRORS_H

View File

@ -25,6 +25,8 @@
#define MAX_CHARGING_CHECK_DURATION 2000 // ms
// Time to wait between closing relays
#define RELAY_CLOSE_WAIT 10 // ms
// Max time to wait for CAN messages. If we reach it then we emergency shutdown.
#define CAN_TIMEOUT 100000
typedef enum { // states -> 3 bit. valid transitions: (all could transition to error)
STATE_INACTIVE, // INACTIVE -> PRECHARGE, CHARGING, ERROR