mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-07-26 20:32:04 +08:00
clean up frog puke
This commit is contained in:
Regular → Executable
-42
@@ -3,13 +3,11 @@ import json
|
||||
import math
|
||||
import numpy as np
|
||||
import requests
|
||||
import shutil
|
||||
import subprocess
|
||||
import tarfile
|
||||
import threading
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
from functools import cache
|
||||
@@ -21,7 +19,6 @@ from cereal import log, messaging
|
||||
from opendbc.can.parser import CANParser
|
||||
from openpilot.common.realtime import DT_DMON, DT_HW
|
||||
from openpilot.selfdrive.car.toyota.carcontroller import LOCK_CMD
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
from panda import Panda
|
||||
|
||||
from openpilot.frogpilot.common.frogpilot_variables import EARTH_RADIUS, KONIK_PATH, MAPD_PATH, MAPS_PATH, params, params_cache, params_memory
|
||||
@@ -37,7 +34,6 @@ locks = {
|
||||
"lock_doors": threading.Lock(),
|
||||
"update_checks": threading.Lock(),
|
||||
"update_maps": threading.Lock(),
|
||||
"update_openpilot": threading.Lock(),
|
||||
"update_tinygrad": threading.Lock()
|
||||
}
|
||||
|
||||
@@ -270,44 +266,6 @@ def update_maps(now):
|
||||
|
||||
params.put("LastMapsUpdate", todays_date)
|
||||
|
||||
def update_openpilot():
|
||||
def update_available():
|
||||
run_cmd(["pkill", "-SIGUSR1", "-f", "system.updated.updated"], "Updater check signal sent", "Failed to send updater check signal", report=False)
|
||||
|
||||
while params.get("UpdaterState", encoding="utf-8") != "checking...":
|
||||
time.sleep(1)
|
||||
|
||||
while params.get("UpdaterState", encoding="utf-8") == "checking...":
|
||||
time.sleep(1)
|
||||
|
||||
if not params.get_bool("UpdaterFetchAvailable"):
|
||||
return False
|
||||
|
||||
while params.get("UpdaterState", encoding="utf-8") != "idle":
|
||||
time.sleep(60)
|
||||
|
||||
run_cmd(["pkill", "-SIGHUP", "-f", "system.updated.updated"], "Updater refresh signal sent", "Failed to send updater refresh signal", report=False)
|
||||
|
||||
while not params.get_bool("UpdateAvailable"):
|
||||
time.sleep(60)
|
||||
|
||||
return True
|
||||
|
||||
if params.get("UpdaterState", encoding="utf-8") != "idle":
|
||||
return
|
||||
|
||||
while params.get_bool("IsOnroad") or params_memory.get_bool("UpdateSpeedLimits") or running_threads.get("lock_doors", threading.Thread()).is_alive():
|
||||
time.sleep(60)
|
||||
|
||||
if not update_available():
|
||||
return
|
||||
|
||||
while True:
|
||||
if not update_available():
|
||||
break
|
||||
|
||||
HARDWARE.reboot()
|
||||
|
||||
@cache
|
||||
def use_konik_server():
|
||||
return KONIK_PATH.is_file()
|
||||
|
||||
Regular → Executable
+4
-8
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
import openpilot.system.sentry as sentry
|
||||
@@ -13,8 +12,8 @@ from openpilot.common.time import system_time_valid
|
||||
from openpilot.frogpilot.assets.model_manager import MODEL_DOWNLOAD_ALL_PARAM, MODEL_DOWNLOAD_PARAM, ModelManager
|
||||
from openpilot.frogpilot.assets.theme_manager import THEME_COMPONENT_PARAMS, ThemeManager
|
||||
from openpilot.frogpilot.common.frogpilot_functions import backup_toggles
|
||||
from openpilot.frogpilot.common.frogpilot_utilities import flash_panda, is_url_pingable, lock_doors, run_thread_with_lock, update_maps, update_openpilot
|
||||
from openpilot.frogpilot.common.frogpilot_variables import ERROR_LOGS_PATH, FrogPilotVariables, get_frogpilot_toggles, params, params_cache, params_memory
|
||||
from openpilot.frogpilot.common.frogpilot_utilities import flash_panda, is_url_pingable, lock_doors, run_thread_with_lock, update_maps
|
||||
from openpilot.frogpilot.common.frogpilot_variables import ERROR_LOGS_PATH, FrogPilotVariables, get_frogpilot_toggles, params_cache, params_memory
|
||||
from openpilot.frogpilot.controls.frogpilot_planner import FrogPilotPlanner
|
||||
from openpilot.frogpilot.controls.lib.frogpilot_tracking import FrogPilotTracking
|
||||
|
||||
@@ -52,9 +51,6 @@ def update_checks(model_manager, now, theme_manager, frogpilot_toggles, boot_run
|
||||
|
||||
run_thread_with_lock("update_maps", update_maps, (now,))
|
||||
|
||||
if frogpilot_toggles.automatic_updates:
|
||||
run_thread_with_lock("update_openpilot", update_openpilot)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
def frogpilot_thread():
|
||||
@@ -72,7 +68,7 @@ def frogpilot_thread():
|
||||
model_manager = ModelManager()
|
||||
theme_manager = ThemeManager()
|
||||
|
||||
toggles_last_updated = datetime.datetime.now(datetime.timezone.utc)
|
||||
toggles_last_updated = datetime.datetime.now(datetime.UTC)
|
||||
|
||||
pm = messaging.PubMaster(["frogpilotPlan"])
|
||||
sm = messaging.SubMaster(["carControl", "carState", "controlsState", "deviceState", "driverMonitoringState",
|
||||
@@ -89,7 +85,7 @@ def frogpilot_thread():
|
||||
while True:
|
||||
sm.update()
|
||||
|
||||
now = datetime.datetime.now(datetime.timezone.utc)
|
||||
now = datetime.datetime.now(datetime.UTC)
|
||||
|
||||
started = sm["deviceState"].started
|
||||
|
||||
|
||||
Reference in New Issue
Block a user