LibreSolar / bms-firmware

Firmware for LibreSolar BMS boards based on bq769x0, bq769x2 or ISL94202
https://libre.solar/bms-firmware/
Apache License 2.0
146 stars 67 forks source link

bq769x2: fix cell detection for floating voltages #73

Closed pasrom closed 2 months ago

pasrom commented 2 months ago

If no cell is connected, the connectors are usually shorted. However, the measured voltage may not be exactly 0, often floating around 0. This can result in negative values being measured, causing incorrect cell detection. The Technical Reference Manual (Table 12-1) describes these values as i2. By using int16_t for voltage, negative values are correctly read as -1 instead of 65535, improving detection accuracy.