From b016766e87cb12149dccfedf7f17be6821f498e6 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sun, 15 Dec 2024 00:10:18 +0100 Subject: [PATCH] Fix pisugar2.py to check for "new model" and correctly display charging voice. --- pwnagotchi/plugins/default/pisugar2.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pwnagotchi/plugins/default/pisugar2.py b/pwnagotchi/plugins/default/pisugar2.py index f4d5cb76..81534188 100644 --- a/pwnagotchi/plugins/default/pisugar2.py +++ b/pwnagotchi/plugins/default/pisugar2.py @@ -20,7 +20,6 @@ class PiSugar(plugins.Plugin): __description__ = "A plugin that will add a voltage indicator for the PiSugar 2" def __init__(self): - self.is_charging = False self.is_new_model = False self.options = dict() conn, event_conn = connect_tcp() @@ -31,7 +30,7 @@ class PiSugar(plugins.Plugin): logging.info("[pisugar2] plugin loaded.") - if self.ps.get_battery_led_amount.value == 2: + if self.ps.get_battery_led_amount() == 2: self.is_new_model = True else: self.is_new_model = False @@ -77,12 +76,9 @@ class PiSugar(plugins.Plugin): if self.is_new_model: if self.ps.get_battery_power_plugged().value and self.ps.get_battery_allow_charging().value: ui.set("chg", "CHG") - if not self.is_charging: - ui.update(force=True, new_data={"status": "Power!! I can feel it!"}) - self.is_charging = True + ui.update(force=True, new_data={"status": "Power!! I can feel it!"}) else: ui.set("chg", "") - self.is_charging = False ui.set("bat", str(capacity) + "%")