From f6322f0262ccb119e7366ef29e2c93c7c2636920 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Mon, 2 Sep 2019 13:24:07 +1000 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BB=B6=E9=81=B2=E9=96=8B?= =?UTF-8?q?=E5=95=9F/=E9=97=9C=E9=96=89=20APP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/dragonpilot/appd/appd.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/selfdrive/dragonpilot/appd/appd.py b/selfdrive/dragonpilot/appd/appd.py index f3f2d4cc6..84fc901eb 100644 --- a/selfdrive/dragonpilot/appd/appd.py +++ b/selfdrive/dragonpilot/appd/appd.py @@ -36,6 +36,9 @@ def main(gctx=None): manual_tomtom = False manual_autonavi = False last_started = False + frame = 0 + start_delay = None + stop_delay = None params.put('DragonRunTomTom', '0') params.put('DragonRunAutonavi', '0') @@ -77,6 +80,9 @@ def main(gctx=None): started = msg.thermal.started # car on if started: + stop_delay = None + if start_delay is None: + start_delay = frame + 5 # # Logic: # if temp reach red, we disable all 3rd party apps. @@ -89,9 +95,9 @@ def main(gctx=None): if allow_auto_boot: # only allow auto boot when thermal status is < red if thermal_status < ThermalStatus.red: - if auto_tomtom and not tomtom_is_running: + if auto_tomtom and not tomtom_is_running and frame > start_delay: tomtom_is_running = execApp('1', tomtom, tomtom_main) - if auto_autonavi and not autonavi_is_running: + if auto_autonavi and not autonavi_is_running and frame > start_delay: autonavi_is_running = execApp('1', autonavi, autonavi_main) else: if auto_tomtom and tomtom_is_running: @@ -107,9 +113,12 @@ def main(gctx=None): # car off else: - if auto_tomtom and tomtom_is_running: + start_delay = None + if stop_delay is None: + stop_delay = frame + 30 + if auto_tomtom and tomtom_is_running and frame > stop_delay: tomtom_is_running = execApp('-1', tomtom, tomtom_main) - if auto_autonavi and autonavi_is_running: + if auto_autonavi and autonavi_is_running and frame > stop_delay: autonavi_is_running = execApp('-1', autonavi, autonavi_main) # if car state changed, we remove manual control state @@ -118,6 +127,7 @@ def main(gctx=None): manual_autonavi = False last_started = started + frame += 3 # every 3 seconds, we re-check status time.sleep(3)