42 lines
789 B
C
42 lines
789 B
C
#pragma once
|
|
|
|
#define BMS_MAX_CELLS 8
|
|
#define MAX_BLE_SCAN_RESULTS 10
|
|
|
|
struct BleScanResult {
|
|
String name;
|
|
String address;
|
|
int rssi = 0;
|
|
};
|
|
|
|
struct BmsData {
|
|
bool connected = false;
|
|
bool valid = false;
|
|
bool cellsValid = false;
|
|
|
|
float soc = 0;
|
|
float voltage = 0;
|
|
float current = 0;
|
|
float remainingAh = 0;
|
|
float capacityAh = 0;
|
|
float temperatureF = 0;
|
|
|
|
int cycleCount = 0;
|
|
int cellCount = 0;
|
|
int ntcCount = 0;
|
|
|
|
float cellVoltages[BMS_MAX_CELLS] = {0};
|
|
float cellMinVoltage = 0;
|
|
float cellMaxVoltage = 0;
|
|
int cellDeltaMv = 0;
|
|
};
|
|
|
|
extern BmsData bmsData;
|
|
|
|
void initBms();
|
|
void updateBms();
|
|
|
|
int scanBleDevices(uint32_t scanSeconds = 10);
|
|
int getBleScanResultCount();
|
|
const BleScanResult* getBleScanResult(int index);
|