mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Fix pisugar2.py to check for "new model" and correctly display charging voice.
This commit is contained in:
@ -20,7 +20,6 @@ class PiSugar(plugins.Plugin):
|
|||||||
__description__ = "A plugin that will add a voltage indicator for the PiSugar 2"
|
__description__ = "A plugin that will add a voltage indicator for the PiSugar 2"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.is_charging = False
|
|
||||||
self.is_new_model = False
|
self.is_new_model = False
|
||||||
self.options = dict()
|
self.options = dict()
|
||||||
conn, event_conn = connect_tcp()
|
conn, event_conn = connect_tcp()
|
||||||
@ -31,7 +30,7 @@ class PiSugar(plugins.Plugin):
|
|||||||
|
|
||||||
logging.info("[pisugar2] plugin loaded.")
|
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
|
self.is_new_model = True
|
||||||
else:
|
else:
|
||||||
self.is_new_model = False
|
self.is_new_model = False
|
||||||
@ -77,12 +76,9 @@ class PiSugar(plugins.Plugin):
|
|||||||
if self.is_new_model:
|
if self.is_new_model:
|
||||||
if self.ps.get_battery_power_plugged().value and self.ps.get_battery_allow_charging().value:
|
if self.ps.get_battery_power_plugged().value and self.ps.get_battery_allow_charging().value:
|
||||||
ui.set("chg", "CHG")
|
ui.set("chg", "CHG")
|
||||||
if not self.is_charging:
|
ui.update(force=True, new_data={"status": "Power!! I can feel it!"})
|
||||||
ui.update(force=True, new_data={"status": "Power!! I can feel it!"})
|
|
||||||
self.is_charging = True
|
|
||||||
else:
|
else:
|
||||||
ui.set("chg", "")
|
ui.set("chg", "")
|
||||||
self.is_charging = False
|
|
||||||
|
|
||||||
ui.set("bat", str(capacity) + "%")
|
ui.set("bat", str(capacity) + "%")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user