Skip to content

Commit

Permalink
Daly read_capacity change
Browse files Browse the repository at this point in the history
Read capacity from config file, if no value provided by BMS
  • Loading branch information
mr-manuel committed May 6, 2023
1 parent 8953689 commit e794363
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions etc/dbus-serialbattery/bms/daly.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,22 @@ def read_fed_data(self, ser):
self.capacity_remain = capacity_remain / 1000
return True

# new
def read_capacity(self, ser):
capa_data = self.read_serial_data_daly(ser, self.command_rated_params)
# check if connection success
if capa_data is False:
logger.warning("read_capacity")
return False

(capacity, cell_volt) = unpack_from(">LL", capa_data)
self.capacity = capacity / 1000
self.capacity = (
capacity / 1000
if capacity and capacity != "" and capacity > 0
else utils.BATTERY_CAPACITY
)
return True

# new
def read_production_date(self, ser):
production = self.read_serial_data_daly(ser, self.command_batt_details)
# check if connection success
Expand All @@ -411,6 +416,7 @@ def read_production_date(self, ser):
self.production = f"{year + 2000}{month:02d}{day:02d}"
return True

# new
def read_battery_code(self, ser):
lenFixed = (
5 * 13
Expand Down

0 comments on commit e794363

Please sign in to comment.