From a2b00731cb5883ecda4052484b3d0fd630812fb3 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Tue, 2 Jul 2019 16:06:50 +1000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8F=83=E6=95=B8=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=E5=B0=87=E8=87=AA=E5=8B=95=E9=97=9C=E6=A9=9F=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E5=96=AE=E4=BD=8D=E6=8F=9B=E6=88=90=E5=88=86=E9=90=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3dragonconf=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/params.py | 2 +- selfdrive/controls/lib/driver_monitor.py | 2 +- selfdrive/dragonpilot/dragonconf/__init__.py | 9 +++++---- selfdrive/dragonpilot/shutdownd/shutdownd.py | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/params.py b/common/params.py index ad4b1ac62..3747b6e35 100755 --- a/common/params.py +++ b/common/params.py @@ -79,7 +79,7 @@ keys = { "Version": [TxType.PERSISTENT], #dragonpilot config "DragonEnableDashcam": [TxType.PERSISTENT], - "DragonEnableDriverMonitor": [TxType.PERSISTENT], + "DragonDisableDriverSafetyCheck": [TxType.PERSISTENT], "DragonAutoShutdownAt": [TxType.PERSISTENT], "DragonTempDisableSteerOnSignal": [TxType.PERSISTENT], } diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index 3c036cf9f..3de48036d 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -145,7 +145,7 @@ class DriverStatus(): not (standstill and self.awareness - self.step_change <= self.threshold_prompt): self.awareness = max(self.awareness - self.step_change, -0.1) - if params.get("DragonEnableDriverMonitor") == "1": + if params.get("DragonDisableDriverSafetyCheck") == "1": alert = None if self.awareness <= 0.: # terminal red alert: disengagement required diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index cbc39390b..c9429015b 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -7,8 +7,8 @@ file = '/data/dragonpilot.json' default_conf = { 'DragonEnableDashcam': '1', - 'DragonEnableDriverMonitor': '1', - 'DragonAutoShutdownAt': '1800', # shutdown after 30 mins + 'DragonDisableDriverSafetyCheck': '1', + 'DragonAutoShutdownAt': '30', # in minute 'DragonTempDisableSteerOnSignal': '0', } @@ -40,10 +40,11 @@ def dragonpilot_set_params(params): json_update_needed = True config.pop(key, None) - # write to json if it's been updated + # write to json if update needed if json_update_needed: write_json_config(config) # set params for key, val in config.items(): - params.put(key, str(val)) + if params.get(key) is None: + params.put(key, str(val)) diff --git a/selfdrive/dragonpilot/shutdownd/shutdownd.py b/selfdrive/dragonpilot/shutdownd/shutdownd.py index 13eb20183..b99b1b287 100644 --- a/selfdrive/dragonpilot/shutdownd/shutdownd.py +++ b/selfdrive/dragonpilot/shutdownd/shutdownd.py @@ -32,7 +32,7 @@ def get_shutdown_val(): if val is None: return None else: - return int(val) + return int(val)*60 # convert to seconds if __name__ == "__main__":