diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 03727776bd4a9a..99aae4164eeabd 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -214,14 +214,14 @@ jobs: name: diff_report_${{ github.event.number }} path: selfdrive/test/process_replay/diff_report.txt - name: Checkout ci-artifacts - if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master' + if: github.repository == 'elkoled/openpilot-stock' && github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: - repository: commaai/ci-artifacts + repository: elkoled/ci-artifacts ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }} path: ${{ github.workspace }}/ci-artifacts - name: Push refs - if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master' + if: github.repository == 'elkoled/openpilot-stock' && github.ref == 'refs/heads/master' working-directory: ${{ github.workspace }}/ci-artifacts run: | git checkout --orphan process-replay diff --git a/selfdrive/test/process_replay/test_processes.py b/selfdrive/test/process_replay/test_processes.py index 7c3318b6a11a44..54af0239610000 100755 --- a/selfdrive/test/process_replay/test_processes.py +++ b/selfdrive/test/process_replay/test_processes.py @@ -67,7 +67,7 @@ # dashcamOnly makes don't need to be tested until a full port is done excluded_interfaces = ["mock", "body", "psa"] -BASE_URL = "https://raw.githubusercontent.com/commaai/ci-artifacts/refs/heads/process-replay/" +BASE_URL = "https://raw.githubusercontent.com/elkoled/ci-artifacts/refs/heads/process-replay/" REF_COMMIT_FN = os.path.join(PROC_REPLAY_DIR, "ref_commit") EXCLUDED_PROCS = {"modeld", "dmonitoringmodeld"} @@ -188,10 +188,6 @@ def test_process(cfg, lr, segment, ref_log_msgs, new_log_path, ignore_fields=Non if cfg.proc_name not in tested_procs: continue - # to speed things up, we only test all segments on card - if cfg.proc_name not in ('card', 'controlsd', 'lagd') and car_brand not in ('HYUNDAI', 'TOYOTA'): - continue - cur_log_fn = os.path.join(FAKEDATA, f"{segment}_{cfg.proc_name}_{cur_commit}.zst".replace("|", "_")) if args.update_refs: # reference logs will not exist if routes were just regenerated ref_log_path = get_url(*segment.rsplit("--", 1,), "rlog.zst") diff --git a/system/hardware/base.py b/system/hardware/base.py index c12c0758f5069e..f0fd02503e5fd5 100644 --- a/system/hardware/base.py +++ b/system/hardware/base.py @@ -40,8 +40,8 @@ def read(self) -> float: try: with open(f"/sys/devices/virtual/thermal/thermal_zone{self.zone_number}/temp") as f: return int(f.read()) / self.scale - except FileNotFoundError: - return 0 + except Exception: + return float('nan') @dataclass class ThermalConfig: diff --git a/system/hardware/fan_controller.py b/system/hardware/fan_controller.py index b2140d33d41ed6..34489eb1f6dd0d 100755 --- a/system/hardware/fan_controller.py +++ b/system/hardware/fan_controller.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +import math + import numpy as np from openpilot.common.pid import PIDController @@ -17,6 +19,10 @@ def update(self, cur_temp: float, ignition: bool) -> int: self.controller.reset() self.last_ignition = ignition + # guard against NaN/Inf from failed sensor reads + if not math.isfinite(cur_temp): + cur_temp = 0. + return int(self.controller.update( error=(cur_temp - 75), # temperature setpoint in C feedforward=np.interp(cur_temp, [60.0, 100.0], [0, 100]) diff --git a/system/hardware/hardwared.py b/system/hardware/hardwared.py index aad30f77b2b32c..321aef50334912 100755 --- a/system/hardware/hardwared.py +++ b/system/hardware/hardwared.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import fcntl +import math import os import queue import struct @@ -271,15 +272,20 @@ def hardware_thread(end_event, hw_queue) -> None: msg.deviceState.screenBrightnessPercent = HARDWARE.get_screen_brightness() # this subset is only used for offroad + # filter out NaN values from failed sensor reads + def max_valid_temp(temps, default=0.): + valid = [t for t in temps if math.isfinite(t)] + return max(valid, default=default) + temp_sources = [ - msg.deviceState.memoryTempC, - max(msg.deviceState.cpuTempC, default=0.), - max(msg.deviceState.gpuTempC, default=0.), + msg.deviceState.memoryTempC if math.isfinite(msg.deviceState.memoryTempC) else 0., + max_valid_temp(msg.deviceState.cpuTempC), + max_valid_temp(msg.deviceState.gpuTempC), ] offroad_comp_temp = offroad_temp_filter.update(max(temp_sources)) # this drives the thermal status while onroad - temp_sources.append(max(msg.deviceState.pmicTempC, default=0.)) + temp_sources.append(max_valid_temp(msg.deviceState.pmicTempC)) all_comp_temp = all_temp_filter.update(max(temp_sources)) msg.deviceState.maxTempC = all_comp_temp diff --git a/system/hardware/tici/hardware.py b/system/hardware/tici/hardware.py index 5a84afce03b29c..0603806077266a 100644 --- a/system/hardware/tici/hardware.py +++ b/system/hardware/tici/hardware.py @@ -117,12 +117,18 @@ def get_serial(self): return self.get_cmdline()['androidboot.serialno'] def get_voltage(self): - with open("/sys/class/hwmon/hwmon1/in1_input") as f: - return int(f.read()) + try: + with open("/sys/class/hwmon/hwmon1/in1_input") as f: + return int(f.read()) + except Exception: + return 0 def get_current(self): - with open("/sys/class/hwmon/hwmon1/curr1_input") as f: - return int(f.read()) + try: + with open("/sys/class/hwmon/hwmon1/curr1_input") as f: + return int(f.read()) + except Exception: + return 0 def set_ir_power(self, percent: int): if self.get_device_type() == "tizi":