Update shutdownd logic - reported by loveloveses@wechat

This commit is contained in:
dragonpilot
2019-09-13 11:31:48 +10:00
parent d49bd6ac02
commit 8b68e26b36
@@ -10,6 +10,7 @@ def main(gctx=None):
shutdown_count = 0
auto_shutdown_at = get_shutdown_val()
frame = 0
last_shutdown_val = get_shutdown_val()
while 1:
with open("/sys/class/power_supply/usb/present") as f:
@@ -23,6 +24,10 @@ def main(gctx=None):
else:
shutdown_count = 0
if not last_shutdown_val == auto_shutdown_at:
shutdown_count = 0
last_shutdown_val = auto_shutdown_at
if auto_shutdown_at is None:
auto_shutdown_at = get_shutdown_val()
else: