Skip to content

Commit

Permalink
fixes Louisvdw#716
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Nov 17, 2023
1 parent a3fe5eb commit 04c7456
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions etc/dbus-serialbattery/bms/jkbms_brn.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def bytearray_to_string(data):
[["settings", "balancing_switch"], 126, "4?"],
]

TRANSLATE_CELL_INFO_16S = [
TRANSLATE_CELL_INFO_24S = [
[["cell_info", "voltages", 32], 6, "<H", 0.001],
[["cell_info", "average_cell_voltage"], 58, "<H", 0.001],
[["cell_info", "delta_cell_voltage"], 60, "<H", 0.001],
Expand Down Expand Up @@ -150,7 +150,7 @@ async def scanForDevices(self):
logger.debug(d)

# check where the bms data starts and
# if the bms is a 16s or 32s type
# if the bms is a 24s or 32s type
def get_bms_max_cell_count(self):
fb = self.frame_buffer
logger.debug(self.frame_buffer)
Expand All @@ -167,16 +167,16 @@ def get_bms_max_cell_count(self):
logger.debug(f"fb[70]: {fb[68]}.{fb[69]}.{fb[70]}.{fb[71]}.{fb[72]}")
logger.debug(f"fb[134]: {fb[132]}.{fb[133]}.{fb[134]}.{fb[135]}.{fb[136]}")
logger.debug(f"fb[144]: {fb[142]}.{fb[143]}.{fb[144]}.{fb[145]}.{fb[146]}")
logger.debug(f"fb[289]: {fb[287]}.{fb[288]}.{fb[289]}.{fb[290]}.{fb[291]}")

# check where data starts
# for 32s it's at fb[70]
if fb[70] == 255:
# if BMS has a max of 32s the data at fb[287] is not empty
if fb[287] > 0:
self.bms_max_cell_count = 32
self.translate_cell_info = TRANSLATE_CELL_INFO_32S
# for 16s it's at fb[54]
# if BMS has a max of 24s the data ends at fb[219]
else:
self.bms_max_cell_count = 16
self.translate_cell_info = TRANSLATE_CELL_INFO_16S
self.bms_max_cell_count = 24
self.translate_cell_info = TRANSLATE_CELL_INFO_24S

logger.debug(f"bms_max_cell_count recognized: {self.bms_max_cell_count}")

Expand Down
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _get_list_from_config(


# Constants
DRIVER_VERSION = "1.0.20231103dev"
DRIVER_VERSION = "1.0.20231117dev"
zero_char = chr(48)
degree_sign = "\N{DEGREE SIGN}"

Expand Down

0 comments on commit 04c7456

Please sign in to comment.