fix min/max voltage calculation

This commit is contained in:
Kilian Bracher 2025-05-17 22:16:12 +02:00
parent 99dea8f442
commit b9f937d78c
Signed by: k.bracher
SSH Key Fingerprint: SHA256:mXpyZkK7RDiJ7qeHCKJX108woM0cl5TrCvNBJASu6lM

View File

@ -127,10 +127,10 @@ HAL_StatusTypeDef battery_update() {
}
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];
}
if (modules[i].cellVoltages[j] < max_voltage) {
if (modules[i].cellVoltages[j] > max_voltage) {
max_voltage = modules[i].cellVoltages[j];
}
if (modules[i].cellVoltages[j] > module_voltages[i].max) {