add name
This commit is contained in:
parent
05c212f01d
commit
9e6fb60a71
30
ESPBMS.ino
30
ESPBMS.ino
@ -18,6 +18,7 @@ void setup() {
|
||||
Serial.println("Scanning...");
|
||||
}
|
||||
|
||||
std::__cxx11::string currentName;
|
||||
bool gotBasicInfo;
|
||||
bool gotCellInfo;
|
||||
|
||||
@ -96,6 +97,7 @@ void loop() {
|
||||
|
||||
gotBasicInfo=false;
|
||||
gotCellInfo=false;
|
||||
currentName=advertisedDevice.getName();
|
||||
while(gotBasicInfo==false || gotCellInfo==false){
|
||||
// REQUEST BASIC INFO
|
||||
// header status command length data checksum footer
|
||||
@ -270,15 +272,15 @@ bool processBasicInfo(byte *data, unsigned int dataLen){
|
||||
uint16_t BalanceCodeHigh = (two_ints_into16(data[14], data[15]));
|
||||
uint8_t MosfetStatus = ((byte)data[20]);
|
||||
|
||||
Serial.printf("Total voltage: %f\r\n", (float)Volts / 1000);
|
||||
Serial.printf("Amps: %f\r\n", (float)Amps / 1000);
|
||||
Serial.printf("CapacityRemainAh: %f\r\n", (float)CapacityRemainAh / 1000);
|
||||
Serial.printf("CapacityRemainPercent: %d\r\n", CapacityRemainPercent);
|
||||
Serial.printf("Temp1: %f\r\n", (float)Temp1 / 10);
|
||||
Serial.printf("Temp2: %f\r\n", (float)Temp2 / 10);
|
||||
Serial.printf("Balance Code Low: 0x%x\r\n", BalanceCodeLow);
|
||||
Serial.printf("Balance Code High: 0x%x\r\n", BalanceCodeHigh);
|
||||
Serial.printf("Mosfet Status: 0x%x\r\n", MosfetStatus);
|
||||
Serial.printf("%s Total voltage: %f\r\n",currentName, (float)Volts / 1000);
|
||||
Serial.printf("%s Amps: %f\r\n",currentName, (float)Amps / 1000);
|
||||
Serial.printf("%s CapacityRemainAh: %f\r\n",currentName, (float)CapacityRemainAh / 1000);
|
||||
Serial.printf("%s CapacityRemainPercent: %d\r\n",currentName, CapacityRemainPercent);
|
||||
Serial.printf("%s Temp1: %f\r\n",currentName, (float)Temp1 / 10);
|
||||
Serial.printf("%s Temp2: %f\r\n",currentName, (float)Temp2 / 10);
|
||||
Serial.printf("%s Balance Code Low: 0x%x\r\n",currentName, BalanceCodeLow);
|
||||
Serial.printf("%s Balance Code High: 0x%x\r\n",currentName, BalanceCodeHigh);
|
||||
Serial.printf("%s Mosfet Status: 0x%x\r\n",currentName, MosfetStatus);
|
||||
|
||||
gotBasicInfo=true;
|
||||
|
||||
@ -308,13 +310,13 @@ bool processCellInfo(byte *data, unsigned int dataLen)
|
||||
_cellMin = CellVolt;
|
||||
}
|
||||
|
||||
Serial.printf("Cell %d volt: %f\r\n", i,(float)CellVolt/1000);
|
||||
Serial.printf("%s Cell %d volt: %f\r\n",currentName, i,(float)CellVolt/1000);
|
||||
}
|
||||
|
||||
Serial.printf("Max cell volt: %f\r\n", (float)_cellMax / 1000);
|
||||
Serial.printf("Min cell volt: %f\r\n", (float)_cellMin / 1000);
|
||||
Serial.printf("Difference cell volt: %f\r\n", (float)_cellMax - _cellMin / 1000);
|
||||
Serial.printf("Average cell volt: %f\r\n", (float)_cellSum / NumOfCells / 1000);
|
||||
Serial.printf("%s Max cell volt: %f\r\n",currentName, (float)_cellMax / 1000);
|
||||
Serial.printf("%s Min cell volt: %f\r\n",currentName, (float)_cellMin / 1000);
|
||||
Serial.printf("%s Difference cell volt: %f\r\n",currentName, (float)_cellMax - _cellMin / 1000);
|
||||
Serial.printf("%s Average cell volt: %f\r\n",currentName, (float)_cellSum / NumOfCells / 1000);
|
||||
|
||||
gotCellInfo=true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user