-
Notifications
You must be signed in to change notification settings - Fork 33
/
config.h
104 lines (97 loc) · 2.57 KB
/
config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include <Arduino.h>
//Set to the proper port for your USB connection - SerialUSB on Due (Native) or Serial for Due (Programming) or Teensy
#define SERIALCONSOLE Serial
//Define this to be the serial port the Tesla BMS modules are connected to.
//On the Due you need to use a USART port (Serial1, Serial2, Serial3) and update the call to serialSpecialInit if not Serial1
//Serial3 for teensy
#define SERIALBMS Serial3
#define REG_DEV_STATUS 0
#define REG_GPAI 1
#define REG_VCELL1 3
#define REG_VCELL2 5
#define REG_VCELL3 7
#define REG_VCELL4 9
#define REG_VCELL5 0xB
#define REG_VCELL6 0xD
#define REG_TEMPERATURE1 0xF
#define REG_TEMPERATURE2 0x11
#define REG_ALERT_STATUS 0x20
#define REG_FAULT_STATUS 0x21
#define REG_COV_FAULT 0x22
#define REG_CUV_FAULT 0x23
#define REG_ADC_CTRL 0x30
#define REG_IO_CTRL 0x31
#define REG_BAL_CTRL 0x32
#define REG_BAL_TIME 0x33
#define REG_ADC_CONV 0x34
#define REG_ADDR_CTRL 0x3B
#define MAX_MODULE_ADDR 0x3E
#define EEPROM_VERSION 0x14 //update any time EEPROM struct below is changed.
#define EEPROM_PAGE 0
typedef struct {
uint8_t version;
uint8_t checksum;
uint32_t canSpeed;
uint8_t batteryID; //which battery ID should this board associate as on the CAN bus
uint8_t logLevel;
float OverVSetpoint;
float UnderVSetpoint;
float DischHys;
float ChargeVsetpoint;
float DischVsetpoint;
float ChargeHys;
float StoreVsetpoint;
float WarnOff;
float OverTSetpoint;
float UnderTSetpoint;
uint16_t triptime;
float ChargeTSetpoint;
float DisTSetpoint;
float WarnToff;
float CellGap;
uint8_t IgnoreTemp;
float IgnoreVolt;
float balanceVoltage;
float balanceHyst;
int Scells;
int Pstrings;
int CAP;
uint16_t chargecurrentmax;
uint16_t chargecurrent2max;
uint16_t chargecurrentend;
uint16_t discurrentmax ;
int socvolt[4];
int invertcur;
int cursens;
int curcan;
int voltsoc;
int Pretime;
int conthold;
int Precurrent;
float convhigh;
float convlow;
int32_t changecur;
uint16_t offset1;
uint16_t offset2;
int balanceDuty;
int ESSmode;
int gaugelow;
int gaugehigh;
int ncur;
int chargertype;
int chargerspd;
uint16_t UnderDur;
uint16_t CurDead;
float DisTaper;
uint8_t ChargerDirect; // bool
uint8_t ExpMess; // bool
uint8_t SerialCan; // bool
uint16_t PulseCh;
uint16_t PulseChDur;
uint16_t PulseDi;
uint16_t PulseDiDur;
uint8_t tripcont;
int chargereff;
int chargerACv;
} EEPROMSettings;