Skip to content

Commit

Permalink
Cleaned up a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
maland16 committed Apr 24, 2022
1 parent 4d08b95 commit bcad8d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions daly-bms-uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Uncomment the below #define to enable debugging print statements.
// NOTE: You must call Serial.being(<baud rate>) in your setup() for this to work
//#define DALY_BMS_DEBUG
// #define DALY_BMS_DEBUG

#define XFER_BUFFER_LENGTH 13

Expand Down Expand Up @@ -42,7 +42,7 @@ class Daly_BMS_UART

/**
* @brief Gets the pack temperature in degrees celsius
* @details This function uses the MIN_MAX_TEMPERATURE command, and averages the
* @details This function uses the MIN_MAX_TEMPERATURE command, and averages the
* min and max temperatures to get the returned value
* @return True on successful aquisition, false otherwise
*/
Expand All @@ -63,7 +63,7 @@ class Daly_BMS_UART
void sendCommand(COMMAND cmdID);

/**
* @brief
* @brief
* @details
* @return True on success, false on failure
*/
Expand Down
14 changes: 8 additions & 6 deletions example-sketch/daly-bms-example/daly-bms-example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
// Constructing the bms driver and passing in the Serial interface (which pins to use)
Daly_BMS_UART bms(Serial1);

void setup() {
void setup()
{
// This is needed to print stuff to the serial monitor
Serial.begin(115200);

// This call sets up the driver
bms.Init();
}

void loop() {
void loop()
{

// Set up some variables to hold the values
float volts = 0;
Expand All @@ -22,21 +24,21 @@ void loop() {
bms.getPackMeasurements(volts, amps, percentage);

// And print them out!
Serial.printf("V: %4.1f, I: %4.1f, \%:%4.1f\n",volts, amps, percentage);
Serial.printf("V: %4.1f, I: %4.1f, SOC:%4.1f\n", volts, amps, percentage);

// Now the same thing, but for temperature
int8_t temp = 0;
bms.getPackTemp(temp);
Serial.printf("Temp: %d\n",temp);
Serial.printf("Temp: %d\n", temp);

// And again, for min/max cell voltages
float maxCellVoltage = 0;
float minCellVoltage = 0;
uint8_t maxCellNumber = 0;
uint8_t minCellNumber = 0;
bms.getMinMaxCellVoltage(minCellVoltage, minCellNumber, maxCellVoltage, maxCellNumber);
Serial.printf("Highest Cell Voltage: Cell #%d with voltage %4.3f\n",maxCellNumber,maxCellVoltage);
Serial.printf("Lowest Cell Voltage: Cell #%d with voltage %4.3f\n",minCellNumber,minCellVoltage);
Serial.printf("Highest Cell Voltage: Cell #%d with voltage %4.3f\n", maxCellNumber, maxCellVoltage);
Serial.printf("Lowest Cell Voltage: Cell #%d with voltage %4.3f\n", minCellNumber, minCellVoltage);

// Lets slow things down a bit...
delay(500);
Expand Down

0 comments on commit bcad8d5

Please sign in to comment.