mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-23 17:23:51 +08:00
fileserv - 2025-06-17
This commit is contained in:
@@ -26,6 +26,7 @@ from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.system.hardware.power_monitoring import PowerMonitoring
|
||||
from openpilot.system.hardware.fan_controller import TiciFanController
|
||||
from openpilot.system.version import terms_version, training_version
|
||||
import socket
|
||||
|
||||
ThermalStatus = log.DeviceState.ThermalStatus
|
||||
NetworkType = log.DeviceState.NetworkType
|
||||
@@ -456,6 +457,25 @@ def hardware_thread(end_event, hw_queue) -> None:
|
||||
should_start_prev = should_start
|
||||
|
||||
|
||||
def ip_thread(end_event, hw_queue):
|
||||
count = 0
|
||||
params = Params()
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
while not end_event.is_set():
|
||||
# update IP every 10s
|
||||
if count % int(10. / DT_HW) == 0:
|
||||
try:
|
||||
# doesn't even have to be reachable
|
||||
s.connect(('10.255.255.255', 1))
|
||||
ip = s.getsockname()[0]
|
||||
except:
|
||||
ip = ''
|
||||
|
||||
params.put_nonblocking('dp_device_ip', ip.strip())
|
||||
|
||||
count += 1
|
||||
time.sleep(DT_HW)
|
||||
|
||||
def main():
|
||||
hw_queue = queue.Queue(maxsize=1)
|
||||
end_event = threading.Event()
|
||||
@@ -463,6 +483,7 @@ def main():
|
||||
threads = [
|
||||
threading.Thread(target=hw_state_thread, args=(end_event, hw_queue)),
|
||||
threading.Thread(target=hardware_thread, args=(end_event, hw_queue)),
|
||||
threading.Thread(target=ip_thread, args=(end_event, hw_queue)),
|
||||
]
|
||||
|
||||
if TICI:
|
||||
|
||||
@@ -106,6 +106,7 @@ procs = [
|
||||
PythonProcess("updated", "system.updated.updated", only_offroad, enabled=not PC),
|
||||
PythonProcess("uploader", "system.loggerd.uploader", always_run),
|
||||
PythonProcess("statsd", "system.statsd", always_run),
|
||||
PythonProcess("fileserv", "dragonpilot.selfdrive.fileserv.fileserv", always_run),
|
||||
|
||||
# debug procs
|
||||
NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar),
|
||||
|
||||
Reference in New Issue
Block a user