lewisxhe/XPowersLib

Brackets missing at XPowersLib/Micropython/src/AXP2101.py setButtonBatteryChargeVoltage() line #706

jon-hirst opened this issue · 1 comments

At line 706 and 707 in method setButtonBatteryChargeVoltage() there is a division which should be cast to (int).

But brackets are missing around the division, so the cast to (int) applies only to the dividend (the top part of the division). At runtime this throws an exception trying to OR a float with an int.

With the extra brackets the line becomes:

    val |= (int)((millivolt - _AXP2101_BTN_VOL_MIN) / \
        _AXP2101_BTN_VOL_STEPS)

Thanks for your report and testing