Skip to content

Commit

Permalink
Merge pull request #372 from aceinnolab/feature/#370
Browse files Browse the repository at this point in the history
improve handling when piSugar is off
  • Loading branch information
aceisace authored Aug 27, 2024
2 parents 5f34162 + bef2efc commit 311c68a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion inkycal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ def __init__(self, settings_path: str or None = None, render: bool = True, use_p
self.pisugar = PiSugar()

self.battery_capacity = self.pisugar.get_battery()
logger.info(f"PiSugar battery capacity: {self.battery_capacity}%")

if not self.battery_capacity:
logger.warning("[PISUGAR] Could not get battery capacity! Is the board off? Setting battery capacity to 0%")
self.battery_capacity = 100
else:
logger.info(f"PiSugar battery capacity: {self.battery_capacity}%")

if self.battery_capacity < 20:
logger.warning("Battery capacity is below 20%!")
Expand Down

0 comments on commit 311c68a

Please sign in to comment.