adafruit / Adafruit_CircuitPython_Register

Python data descriptor classes to represent hardware registers on I2C devices.
MIT License
47 stars 21 forks source link

Weekday in i2c_bcd_datetime reading incorrectly. #42

Closed TG-Techie closed 3 years ago

TG-Techie commented 3 years ago

While working on a watch with the DS3231 the date was incorrect every other day.

On further inspection, the i2c_bcd_datetime module has a small error, in the get descriptor method has an operator precedence issue. the weekday value should be masked before adjusting for if the weekday starts on a 1 or a 0.

adding parens fixes the issue, tested on the ds3231.