mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-10 23:42:06 +08:00
kernel call optimization
This commit is contained in:
@@ -384,7 +384,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 > 3.:
|
||||
if ts - self.ts_last_check > 5.:
|
||||
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
|
||||
|
||||
@@ -143,7 +143,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 > 3.:
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
|
||||
@@ -302,7 +302,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 > 3.:
|
||||
if ts - self.ts_last_check > 5.:
|
||||
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
|
||||
|
||||
@@ -512,7 +512,7 @@ def controlsd_thread(sm=None, pm=None, can_sock=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 > 3.:
|
||||
if ts - ts_last_check > 5.:
|
||||
dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
dragon_lat_control = False if params.get("DragonLatCtrl") == "0" else True
|
||||
dragon_display_steering_limit_alert = False if params.get("DragonDisplaySteeringLimitAlert") == "0" else True
|
||||
|
||||
@@ -69,7 +69,7 @@ class LanePlanner(object):
|
||||
|
||||
def update_lane(self, v_ego):
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 3.:
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.camera_offset = int(params.get("DragonCameraOffset")) * 0.01
|
||||
self.ts_last_check = ts
|
||||
# only offset left and right lane lines; offsetting p_poly does not make sense
|
||||
|
||||
@@ -17,8 +17,8 @@ def main(gctx=None):
|
||||
usb_online = bool(int(f.read()))
|
||||
|
||||
if not usb_online:
|
||||
# we update the value every 3 seconds in case of user updates it
|
||||
if frame % 3 == 0:
|
||||
# we update the value every 5 seconds in case of user updates it
|
||||
if frame % 5 == 0:
|
||||
auto_shutdown_at = get_shutdown_val()
|
||||
shutdown_count += 1
|
||||
else:
|
||||
|
||||
@@ -153,7 +153,6 @@ def thermald_thread():
|
||||
charging_disabled = False
|
||||
os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled')
|
||||
ts_last_ip = 0.
|
||||
last_ip_addr = '255.255.255.255'
|
||||
ip_addr = '255.255.255.255'
|
||||
|
||||
while 1:
|
||||
@@ -184,7 +183,7 @@ def thermald_thread():
|
||||
msg.thermal.usbOnline = bool(int(f.read()))
|
||||
# update ip every 5 seconds
|
||||
ts = sec_since_boot()
|
||||
if ts - ts_last_ip > 5.:
|
||||
if ts - ts_last_ip > 10.:
|
||||
try:
|
||||
result = subprocess.check_output(["service", "call", "connectivity", "2"]).strip().split("\n")
|
||||
except subprocess.CalledProcessError:
|
||||
@@ -196,12 +195,9 @@ def thermald_thread():
|
||||
result = subprocess.check_output(["ifconfig", "wlan0"])
|
||||
ip_addr = re.findall(r"inet addr:((\d+\.){3}\d+)", result)[0][0]
|
||||
else:
|
||||
ip_addr = ' '
|
||||
ip_addr = '<N/A>'
|
||||
ts_last_ip = ts
|
||||
else:
|
||||
ip_addr = last_ip_addr
|
||||
msg.thermal.ipAddr = ip_addr
|
||||
last_ip_addr = ip_addr
|
||||
|
||||
current_filter.update(msg.thermal.batteryCurrent / 1e6)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user