fix min/max voltage calculation
This commit is contained in:
parent
99dea8f442
commit
b9f937d78c
@ -127,10 +127,10 @@ HAL_StatusTypeDef battery_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t j = 0; j < N_CELLS; j++) {
|
for (size_t j = 0; j < N_CELLS; j++) {
|
||||||
if (modules[i].cellVoltages[j] > min_voltage) {
|
if (modules[i].cellVoltages[j] < min_voltage) {
|
||||||
min_voltage = modules[i].cellVoltages[j];
|
min_voltage = modules[i].cellVoltages[j];
|
||||||
}
|
}
|
||||||
if (modules[i].cellVoltages[j] < max_voltage) {
|
if (modules[i].cellVoltages[j] > max_voltage) {
|
||||||
max_voltage = modules[i].cellVoltages[j];
|
max_voltage = modules[i].cellVoltages[j];
|
||||||
}
|
}
|
||||||
if (modules[i].cellVoltages[j] > module_voltages[i].max) {
|
if (modules[i].cellVoltages[j] > module_voltages[i].max) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user