延遲 params check 至3秒以減少 kernel calls

This commit is contained in:
dragonpilot
2019-08-14 10:31:51 +10:00
parent 1c43aefada
commit 1e0f989d3f
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -369,7 +369,7 @@ class CarInterface(object):
def update(self, c, can_strings):
# dragonpilot, don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - self.ts_last_check > 1.:
if ts - self.ts_last_check > 3.:
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
self.ts_last_check = ts
+1 -1
View File
@@ -119,7 +119,7 @@ class CarState(object):
def update(self, cp):
# dragonpilot, don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - self.ts_last_check > 1.:
if ts - self.ts_last_check > 3.:
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
self.ts_last_check = ts
+1 -1
View File
@@ -279,7 +279,7 @@ class CarInterface(object):
def update(self, c, can_strings):
# dragonpilot, don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - self.ts_last_check > 1.:
if ts - self.ts_last_check > 3.:
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
+1 -1
View File
@@ -509,7 +509,7 @@ def controlsd_thread(gctx=None):
while True:
# dragonpilot, don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - ts_last_check > 1.:
if ts - ts_last_check > 3.:
dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
ts_last_check = ts
+2 -2
View File
@@ -152,7 +152,7 @@ class DriverStatus():
# don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - self.ts_last_check > 1.:
if ts - self.ts_last_check > 3.:
self.monitor_param_on = params.get("IsDriverMonitoringEnabled") == "1"
self.ts_last_check = ts
@@ -169,7 +169,7 @@ class DriverStatus():
# don't check for param too often as it's a kernel call
ts = sec_since_boot()
if ts - self.dp_last_check > 1.:
if ts - self.dp_last_check > 3.:
self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True
self.dp_last_check = ts