Skip to content

Commit

Permalink
Show battery level of PiSugar when PiSugar support is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
aceisace committed Sep 20, 2024
1 parent 0361d72 commit b91d5ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inkycal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,12 @@ async def run(self, run_once=False):
logger.info("All images generated successfully!")
del errors

if self.battery_capacity < 20:
self.info += "Low battery! "
if self.use_pi_sugar:
self.battery_capacity = self.pisugar.get_battery() or 0
if self.battery_capacity < 20:
self.info += f"Low battery! ({self.battery_capacity})% "
else:
self.info += f"Battery: {self.battery_capacity}% "

# Assemble image from each module - add info section if specified
self._assemble()
Expand Down

0 comments on commit b91d5ff

Please sign in to comment.