Show battery level of PiSugar when PiSugar support is enabled

This commit is contained in:
Ace
2024-09-21 00:21:00 +02:00
parent 0361d725f1
commit b91d5ff62a

View File

@@ -345,8 +345,12 @@ class Inkycal:
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()