From 8b68e26b36bd16e2af60a58979fa43f9a60fa1d5 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Fri, 13 Sep 2019 11:31:48 +1000 Subject: [PATCH] Update shutdownd logic - reported by loveloveses@wechat --- selfdrive/dragonpilot/shutdownd/shutdownd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/dragonpilot/shutdownd/shutdownd.py b/selfdrive/dragonpilot/shutdownd/shutdownd.py index 40fd07720..552729534 100644 --- a/selfdrive/dragonpilot/shutdownd/shutdownd.py +++ b/selfdrive/dragonpilot/shutdownd/shutdownd.py @@ -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: