From d4dea69c43d337876bd9981d1dc201b408a19329 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Thu, 9 Apr 2020 17:15:35 +1000 Subject: [PATCH] minor improvement --- selfdrive/dragonpilot/appd/appd.py | 12 ++++++------ selfdrive/dragonpilot/dragonconf/__init__.py | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/selfdrive/dragonpilot/appd/appd.py b/selfdrive/dragonpilot/appd/appd.py index a7169efb4..fb4fb9a7c 100644 --- a/selfdrive/dragonpilot/appd/appd.py +++ b/selfdrive/dragonpilot/appd/appd.py @@ -348,11 +348,11 @@ def main(): last_modified = None while 1: #has_enabled_apps: - if not init_done and sec_since_boot() - start_ts >= 10: - init_apps(apps) - init_done = True - - if init_done: + if not init_done: + if sec_since_boot() - start_ts >= 10: + init_apps(apps) + init_done = True + else: enabled_apps = [] has_fullscreen_apps = False modified = dp_get_last_modified() @@ -435,7 +435,7 @@ def main(): last_started = started frame += 3 - time.sleep(3) + time.sleep(3) def system(cmd): try: diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index 984595ebf..ae72236bf 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -2,6 +2,8 @@ from common.params import Params, put_nonblocking import time from math import floor +import os +import subprocess default_conf = { 'DragonEnableDashcam': '0', @@ -96,7 +98,15 @@ deprecated_conf_invert = { def dp_get_last_modified(): return Params().get('DragonLastModified', encoding='utf-8') +def run_patcher(): + if os.path.isfile("/sdcard/dp_patcher.py"): + try: + subprocess.call(["python", "/sdcard/dp_patcher.py"]) + except subprocess.CalledProcessError as e: + pass + def dragonpilot_set_params(params): + run_patcher() # # remove deprecated params # for old, new in deprecated_conf.items(): # if params.get(old) is not None: