Skip to content

Commit

Permalink
Fixes Louisvdw#1094 and smaller fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jul 12, 2024
1 parent 26475e1 commit 0b9efa7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

## v1.4.x

* Changed: JKBMS BLE - Fixes wrong max battery voltage https://github.com/Louisvdw/dbus-serialbattery/issues/1094 by @mr-manuel
* Changed: JKBMS PB Model fixes by @KoljaWindeler


Expand Down
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/bms/jkbms_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_settings(self):
self.cell_count = st["cell_count"]
self.max_battery_charge_current = st["max_charge_current"]
self.max_battery_discharge_current = st["max_discharge_current"]
self.max_battery_voltage = st["cell_ovp"] * self.cell_count
self.max_battery_voltage = utils.MAX_CELL_VOLTAGE * self.cell_count
self.min_battery_voltage = st["cell_uvp"] * self.cell_count

# Persist initial OVP and OPVR settings of JK BMS BLE
Expand Down
21 changes: 11 additions & 10 deletions etc/dbus-serialbattery/bms/jkbms_pb.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,17 @@ def read_status_data(self):
temp3 = unpack_from("<h", status_data, 254)[0] / 10
temp4 = unpack_from("<h", status_data, 256)[0] / 10
temp5 = unpack_from("<h", status_data, 258)[0] / 10
if(unpack_from("<B", status_data, 214)[0] & 0x02):
self.to_temp(1, temp1 if temp1 < 99 else (100 - temp1))
if(unpack_from("<B", status_data, 214)[0] & 0x04):
self.to_temp(2, temp2 if temp2 < 99 else (100 - temp2))
if(unpack_from("<B", status_data, 214)[0] & 0x08):
self.to_temp(3, temp3 if temp3 < 99 else (100 - temp3))
if(unpack_from("<B", status_data, 214)[0] & 0x10):
self.to_temp(4, temp4 if temp4 < 99 else (100 - temp4))
if(unpack_from("<B", status_data, 214)[0] & 0x20):
self.to_temp(5, temp5 if temp5 < 99 else (100 - temp5))

if unpack_from("<B", status_data, 214)[0] & 0x02:
self.to_temp(1, temp1 if temp1 < 99 else (100 - temp1))
if unpack_from("<B", status_data, 214)[0] & 0x04:
self.to_temp(2, temp2 if temp2 < 99 else (100 - temp2))
if unpack_from("<B", status_data, 214)[0] & 0x08:
self.to_temp(3, temp3 if temp3 < 99 else (100 - temp3))
if unpack_from("<B", status_data, 214)[0] & 0x10:
self.to_temp(4, temp4 if temp4 < 99 else (100 - temp4))
if unpack_from("<B", status_data, 214)[0] & 0x20:
self.to_temp(5, temp5 if temp5 < 99 else (100 - temp5))

# Battery voltage
self.voltage = unpack_from("<I", status_data, 150)[0] / 1000
Expand Down
4 changes: 2 additions & 2 deletions etc/dbus-serialbattery/dbushelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,10 @@ def publish_battery(self, loop):
if time_since_first_error >= 60 * 20 and not utils.BLOCK_ON_DISCONNECT:
loop.quit()

# This is to mannage CVCL
# This is to manage CVCL
self.battery.manage_charge_voltage()

# This is to mannage CCL\DCL
# This is to manage CCL\DCL
self.battery.manage_charge_current()

# Manage battery state, if not set to error (10)
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.3.20240710dev"
DRIVER_VERSION = "1.4.20240712dev"
zero_char = chr(48)
degree_sign = "\N{DEGREE SIGN}"

Expand Down

0 comments on commit 0b9efa7

Please sign in to comment.