-
Notifications
You must be signed in to change notification settings - Fork 0
/
error_checks.h
37 lines (29 loc) · 1.23 KB
/
error_checks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef ERROR_CHECKS_H
#define ERROR_CHECKS_H
#include <stdbool.h>
#include "canlib/message_types.h"
// for voltages within these ranges, a warning will be sent out over CAN
// values were determined by the given voltage rail range
#define UNDERVOLTAGE_THRESHOLD_BATT_mV 9000
#define OVERVOLTAGE_THRESHOLD_BATT_mV 12600
// at this current, a warning will be sent out over CAN
#define OVERCURRENT_THRESHOLD_BATT_mA 5700 //fuse goes at 6300
// From bus line. At this current, a warning will be sent out over CAN
#define OVERCURRENT_THRESHOLD_5V_mA 1800 //buck rated for 2A max
#define OVERCURRENT_THRESHOLD_13V_mA 2700 //buck rated for 3A max
#if (BOARD_UNIQUE_ID == BOARD_ID_CHARGING_AIRBRAKE)
#define OVERCURRENT_THRESHOLD_MOTOR_mA 4500
#endif
#if (BOARD_UNIQUE_ID == BOARD_ID_CHARGING_PAYLOAD)
#define OVERCURRENT_THRESHOLD_MOTOR_mA 600
#endif
// General board status checkers
bool check_battery_voltage_error(void);
bool check_battery_current_error(void);
#if (BOARD_UNIQUE_ID == BOARD_ID_CHARGING_CAN)
bool check_5v_current_error(void);
bool check_13v_current_error(void);
#elif (BOARD_UNIQUE_ID == BOARD_ID_CHARGING_AIRBRAKE || BOARD_UNIQUE_ID == BOARD_ID_CHARGING_PAYLOAD)
bool check_motor_current_error(void);
#endif
#endif /* ERROR_CHECKS_H */