Skip to content

Commit

Permalink
Minor printing changes to BMS
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayamelon committed May 7, 2024
1 parent 8fb0323 commit 5750b42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bms/src/BmsConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extern DigitalOut* chargerControl;
//
// Units: millivolts
#ifndef BMS_BALANCE_THRESHOLD
#define BMS_BALANCE_THRESHOLD 3900
#define BMS_BALANCE_THRESHOLD 3700
#endif


Expand Down
5 changes: 3 additions & 2 deletions bms/src/BmsThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void BMSThread::threadWorker() {

balanceAllowed = mainToBMSEvent->balanceAllowed;
charging = mainToBMSEvent->charging;
// printf("Balance Allowed: %x\nCharging: %x\n", balanceAllowed, charging);
delete mainToBMSEvent;
}

Expand Down Expand Up @@ -218,7 +219,7 @@ void BMSThread::threadWorker() {
if (index != -1) {
allVoltages[(BMS_BANK_CELL_COUNT * i) + index] = voltage;

// printf("%d: V: %d\n", index, voltage);
printf("%d: V: %d\n", index, voltage);
}
}
}
Expand Down Expand Up @@ -266,7 +267,7 @@ void BMSThread::threadWorker() {
uint16_t cellVoltage = allVoltages[i * BMS_BANK_CELL_COUNT + cellNum];
if (cellVoltage >= BMS_BALANCE_THRESHOLD &&
cellVoltage >= minVoltage + BMS_DISCHARGE_THRESHOLD) {
// printf("Balancing cell %d\n", cellNum);
printf("Balancing cell %d\n", cellNum);
dischargeValue |= (0x1 << j);
}
}
Expand Down
3 changes: 3 additions & 0 deletions bms/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ int main() {
for (int i = 0; i < BMS_BANK_COUNT*BMS_BANK_CELL_COUNT; i++) {
allVoltages[i] = bmsEvent->voltageValues[i];
tsVoltage += allVoltages[i];
//printf("%d, V: %d\n", i, allVoltages[i]);
}
for (int i = 0; i < BMS_BANK_COUNT*BMS_BANK_TEMP_COUNT; i++) {
allTemps[i] = bmsEvent->temperatureValues[i];
//printf("%d, V: %d\n", i, allTemps[i]);
}

break;
Expand Down Expand Up @@ -150,6 +152,7 @@ int main() {
}

isCharging = charge_state_pin;
// printf("charge state: %x\n", isCharging);

charge_enable_pin = isCharging && !hasBmsFault && shutdown_measure_pin;

Expand Down

0 comments on commit 5750b42

Please sign in to comment.