forked from collin80/TeslaBMS
-
Notifications
You must be signed in to change notification settings - Fork 11
/
CONFIG.H
58 lines (50 loc) · 1.68 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
#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
// victron serial VE direct bus config
#define VE Serial2
#define REG_DEV_STATUS 1
#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 0x10 //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 OverTSetpoint;
float UnderTSetpoint;
float ChargeTSetpoint;
float DisTSetpoint;
uint8_t IgnoreTemp;
float IgnoreVolt;
float balanceVoltage;
float balanceHyst;
} EEPROMSettings;