修正參數名,將自動關機設定單位換成分鐘,修正dragonconf logic

This commit is contained in:
Rick Lan
2019-07-02 16:06:50 +10:00
parent d36b78e273
commit a2b00731cb
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -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],
}
+1 -1
View File
@@ -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
+5 -4
View File
@@ -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))
+1 -1
View File
@@ -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__":