Add serial log levels
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <NimBLEDevice.h>
|
||||
#include "logger.h"
|
||||
|
||||
static const char* BMS_ADDRESS = "a5:c2:37:2c:05:dc";
|
||||
static const char* BMS_SERVICE_UUID = "ff00";
|
||||
@@ -253,14 +254,16 @@ static bool parseBasicInfo() {
|
||||
bmsData.temperatureF = tempF;
|
||||
bmsData.valid = true;
|
||||
|
||||
Serial.print("BMS: SOC ");
|
||||
Serial.print(bmsData.soc);
|
||||
Serial.print("%, V ");
|
||||
Serial.print(bmsData.voltage);
|
||||
Serial.print(", A ");
|
||||
Serial.print(bmsData.current);
|
||||
Serial.print(", Ah ");
|
||||
Serial.println(bmsData.remainingAh);
|
||||
if (currentLogLevel >= LOG_DEBUG) {
|
||||
Serial.print("BMS: SOC ");
|
||||
Serial.print(bmsData.soc);
|
||||
Serial.print("%, V ");
|
||||
Serial.print(bmsData.voltage);
|
||||
Serial.print(", A ");
|
||||
Serial.print(bmsData.current);
|
||||
Serial.print(", Ah ");
|
||||
Serial.println(bmsData.remainingAh);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -312,15 +315,17 @@ static bool parseCellVoltages() {
|
||||
bmsData.cellDeltaMv = (int)((maxV - minV) * 1000.0 + 0.5);
|
||||
bmsData.cellsValid = true;
|
||||
|
||||
Serial.print("BMS: Cells ");
|
||||
Serial.print(cellsReported);
|
||||
Serial.print(", min ");
|
||||
Serial.print(minV, 3);
|
||||
Serial.print("V, max ");
|
||||
Serial.print(maxV, 3);
|
||||
Serial.print("V, delta ");
|
||||
Serial.print(bmsData.cellDeltaMv);
|
||||
Serial.println("mV");
|
||||
if (currentLogLevel >= LOG_DEBUG) {
|
||||
Serial.print("BMS: Cells ");
|
||||
Serial.print(cellsReported);
|
||||
Serial.print(", min ");
|
||||
Serial.print(minV, 3);
|
||||
Serial.print("V, max ");
|
||||
Serial.print(maxV, 3);
|
||||
Serial.print("V, delta ");
|
||||
Serial.print(bmsData.cellDeltaMv);
|
||||
Serial.println("mV");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user