dev
This commit is contained in:
parent
8f9e256c64
commit
9f562d5569
3
BLE.ino
3
BLE.ino
@ -121,7 +121,8 @@ void handleBLE(){
|
|||||||
if(ble_packets_received == BLE_PACKETSRECEIVED_BEFORE_STANDBY){
|
if(ble_packets_received == BLE_PACKETSRECEIVED_BEFORE_STANDBY){
|
||||||
debug("BLE: all packets received");
|
debug("BLE: all packets received");
|
||||||
bms_status=true; // BMS was connected, data up-to-date
|
bms_status=true; // BMS was connected, data up-to-date
|
||||||
|
printBasicInfo();
|
||||||
|
printCellInfo();
|
||||||
}else{
|
}else{
|
||||||
debug("BLE: connection timeout");
|
debug("BLE: connection timeout");
|
||||||
bms_status=false; // BMS not (fully) connected
|
bms_status=false; // BMS not (fully) connected
|
||||||
|
@ -217,7 +217,6 @@ bool bmsRequestCellInfo(){
|
|||||||
return sendCommand(data, sizeof(data));
|
return sendCommand(data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void printBasicInfo() //debug all data to uart
|
void printBasicInfo() //debug all data to uart
|
||||||
{
|
{
|
||||||
Serial.printf("Total voltage: %f\n", (float)packBasicInfo.Volts / 1000);
|
Serial.printf("Total voltage: %f\n", (float)packBasicInfo.Volts / 1000);
|
||||||
@ -246,32 +245,6 @@ void printCellInfo() //debug all data to uart
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
void constructBigString() //debug all data to uart
|
|
||||||
{
|
|
||||||
stringBuffer[0] = '\0'; //clear old data
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Total voltage: %f\n", (float)packBasicInfo.Volts / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Amps: %f\n", (float)packBasicInfo.Amps / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "CapacityRemainAh: %f\n", (float)packBasicInfo.CapacityRemainAh / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "CapacityRemainPercent: %d\n", packBasicInfo.CapacityRemainPercent);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Temp1: %f\n", (float)packBasicInfo.Temp1 / 10);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Temp2: %f\n", (float)packBasicInfo.Temp2 / 10);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Balance Code Low: 0x%x\n", packBasicInfo.BalanceCodeLow);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Balance Code High: 0x%x\n", packBasicInfo.BalanceCodeHigh);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Mosfet Status: 0x%x\n", packBasicInfo.MosfetStatus);
|
|
||||||
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Number of cells: %u\n", packCellInfo.NumOfCells);
|
|
||||||
for (byte i = 1; i <= packCellInfo.NumOfCells; i++)
|
|
||||||
{
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Cell no. %u", i);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, " %f\n", (float)packCellInfo.CellVolt[i - 1] / 1000);
|
|
||||||
}
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Max cell volt: %f\n", (float)packCellInfo.CellMax / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Min cell volt: %f\n", (float)packCellInfo.CellMin / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Difference cell volt: %f\n", (float)packCellInfo.CellDiff / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "Average cell volt: %f\n", (float)packCellInfo.CellAvg / 1000);
|
|
||||||
snprintf(stringBuffer, STRINGBUFFERSIZE, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void hexDump(const char *data, uint32_t dataSize) //debug function
|
void hexDump(const char *data, uint32_t dataSize) //debug function
|
||||||
{
|
{
|
||||||
Serial.println("HEX data:");
|
Serial.println("HEX data:");
|
||||||
@ -282,7 +255,6 @@ void hexDump(const char *data, uint32_t dataSize) //debug function
|
|||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
int16_t two_ints_into16(int highbyte, int lowbyte) // turns two bytes into a single long integer
|
int16_t two_ints_into16(int highbyte, int lowbyte) // turns two bytes into a single long integer
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user