Skip to content

Commit

Permalink
Limit dynamic CVL to max charge voltage
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel authored May 20, 2023
2 parents 2f6ea71 + 3c21953 commit c0056c6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,19 @@ def manage_charge_voltage_linear(self) -> None:
):
self.linear_cvl_last_set = int(time())

# Keep penalty above min battery voltage
# Keep penalty above min battery voltage and below max battery voltage
self.control_voltage = round(
max(
voltageSum - penaltySum,
utils.MIN_CELL_VOLTAGE * self.cell_count,
min(
max(
voltageSum - penaltySum,
utils.MIN_CELL_VOLTAGE * self.cell_count,
),
utils.MAX_CELL_VOLTAGE * self.cell_count
),
3,
)


self.charge_mode = (
"Bulk dynamic"
# + " (vS: "
Expand Down

0 comments on commit c0056c6

Please sign in to comment.