forked from collin80/TeslaBMS
-
Notifications
You must be signed in to change notification settings - Fork 11
/
BMSModule.h
54 lines (51 loc) · 1.44 KB
/
BMSModule.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
#pragma once
class BMSModule
{
public:
BMSModule();
void readStatus();
bool readModuleValues();
float getCellVoltage(int cell);
float getLowCellV();
float getHighCellV();
float getAverageV();
float getLowTemp();
float getHighTemp();
float getHighestModuleVolt();
float getLowestModuleVolt();
float getHighestCellVolt(int cell);
float getLowestCellVolt(int cell);
float getHighestTemp();
float getLowestTemp();
float getAvgTemp();
float getModuleVoltage();
float getTemperature(int temp);
uint8_t getFaults();
uint8_t getAlerts();
uint8_t getCOVCells();
uint8_t getCUVCells();
void setAddress(int newAddr);
int getAddress();
bool isExisting();
void setExists(bool ex);
void settempsensor(int tempsensor);
void setIgnoreCell(float Ignore);
private:
float cellVolt[6]; // calculated as 16 bit value * 6.250 / 16383 = volts
float lowestCellVolt[6];
float highestCellVolt[6];
float moduleVolt; // calculated as 16 bit value * 33.333 / 16383 = volts
float temperatures[2]; // Don't know the proper scaling at this point
float lowestTemperature;
float highestTemperature;
float lowestModuleVolt;
float highestModuleVolt;
float IgnoreCell;
bool exists;
int alerts;
int faults;
int COVFaults;
int CUVFaults;
int sensor;
uint8_t moduleAddress; //1 to 0x3E
};