Update pisugarx.py

limits the voltage to x.xx 

Signed-off-by: LH <140523069+renewedbullet@users.noreply.github.com>
This commit is contained in:
LH
2024-12-16 17:50:37 -05:00
committed by GitHub
parent de62008d2d
commit 09ecfeed66

View File

@ -206,7 +206,7 @@ class PiSugar(plugins.Plugin):
self.nextDChg = time.time() + 5 self.nextDChg = time.time() + 5
if self.drot == 0: # show battery voltage if self.drot == 0: # show battery voltage
ui.set('bat', f"{voltage}V") ui.set('bat', f"{voltage:.2f}V")
elif self.drot == 1: # show battery capacity elif self.drot == 1: # show battery capacity
ui.set('bat', f"{capacity}%") ui.set('bat', f"{capacity}%")
else: # show battery temperature else: # show battery temperature
@ -216,4 +216,4 @@ class PiSugar(plugins.Plugin):
logging.info( logging.info(
f"[PiSugarX] Empty battery (<= {self.ps.get_battery_safe_shutdown_level()}%): shutting down" f"[PiSugarX] Empty battery (<= {self.ps.get_battery_safe_shutdown_level()}%): shutting down"
) )
ui.update(force=True, new_data={"status": "Battery exhausted, bye ..."}) ui.update(force=True, new_data={"status": "Battery exhausted, bye ..."})