Merge pull request #372 from aceinnolab/feature/#370
improve handling when piSugar is off
This commit is contained in:
@@ -163,6 +163,11 @@ class Inkycal:
|
||||
self.pisugar = PiSugar()
|
||||
|
||||
self.battery_capacity = self.pisugar.get_battery()
|
||||
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user