adafruit / Adafruit_CircuitPython_LC709203F

Library for I2C LC709203F battery status and fuel gauge
MIT License
4 stars 10 forks source link

fix crc calc for non-express boards #10

Closed noahcoad closed 3 years ago

noahcoad commented 3 years ago

Bug fix for non-Express boards. Library works on Express CircuitPython boards where an integer doesn't have an upper bound, but on non-express boards, like the QT Py M0, int has an upper bound that is getting overflowed and throwing an exception. This fix drops bits above a byte on each CRC calc change to prevent the overflow (which was probably happening in C anyway).

Fix to issue brought up on this forum topic: QTPyM0: "small int overflow" on CRC calc w lc709203