diff --git a/etc/dbus-serialbattery/bms/lltjbd.py b/etc/dbus-serialbattery/bms/lltjbd.py index 0d1bbfd9..5c658fac 100644 --- a/etc/dbus-serialbattery/bms/lltjbd.py +++ b/etc/dbus-serialbattery/bms/lltjbd.py @@ -552,7 +552,8 @@ def read_gen_data(self): ) = unpack_from(">HhHHHHhHHBBBBB", gen_data) self.voltage = voltage / 100 self.current = current / 100 - if not self.cycle_capacity: + # https://github.com/Louisvdw/dbus-serialbattery/issues/769#issuecomment-1720805325 + if not self.cycle_capacity or self.cycle_capacity < capacity_remain: self.cycle_capacity = capacity self.soc = round(100 * capacity_remain / self.cycle_capacity, 2) self.capacity_remain = capacity_remain / 100 diff --git a/etc/dbus-serialbattery/utils.py b/etc/dbus-serialbattery/utils.py index e9220e2a..69481ca9 100644 --- a/etc/dbus-serialbattery/utils.py +++ b/etc/dbus-serialbattery/utils.py @@ -38,7 +38,7 @@ def _get_list_from_config( # Constants -DRIVER_VERSION = "1.0.20230919dev" +DRIVER_VERSION = "1.0.20230921dev" zero_char = chr(48) degree_sign = "\N{DEGREE SIGN}"