From 34d62836fe4892aab9ffa07897be55d7fcbfc7e0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 4 Dec 2024 19:24:21 -0800 Subject: [PATCH] hw: add fan intake and exhaust temps (#34156) * hw: add fan intake and exhaust temps * remove bat --------- Co-authored-by: Comma Device --- cereal/log.capnp | 2 ++ system/hardware/base.py | 2 +- system/hardware/hardwared.py | 2 ++ system/hardware/pc/hardware.py | 2 +- system/hardware/tici/hardware.py | 9 +++++++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cereal/log.capnp b/cereal/log.capnp index 142d4afcb..b6ccf2f55 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -486,6 +486,8 @@ struct DeviceState @0xa4d8b5af2aa492eb { nvmeTempC @35 :List(Float32); modemTempC @36 :List(Float32); pmicTempC @39 :List(Float32); + intakeTempC @46 :Float32; + exhaustTempC @47 :Float32; maxTempC @44 :Float32; # max of other temps, used to control fan thermalZones @38 :List(ThermalZone); thermalStatus @14 :ThermalStatus; diff --git a/system/hardware/base.py b/system/hardware/base.py index fafdbb41d..0f8b7d868 100644 --- a/system/hardware/base.py +++ b/system/hardware/base.py @@ -3,7 +3,7 @@ from collections import namedtuple from cereal import log -ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'bat', 'pmic']) +ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'pmic', 'intake', 'exhaust']) NetworkType = log.DeviceState.NetworkType diff --git a/system/hardware/hardwared.py b/system/hardware/hardwared.py index beb9b4a3a..15b144ec4 100755 --- a/system/hardware/hardwared.py +++ b/system/hardware/hardwared.py @@ -83,6 +83,8 @@ def read_thermal(thermal_config): dat.deviceState.gpuTempC = [read_tz(z) / thermal_config.gpu[1] for z in thermal_config.gpu[0]] dat.deviceState.memoryTempC = read_tz(thermal_config.mem[0]) / thermal_config.mem[1] dat.deviceState.pmicTempC = [read_tz(z) / thermal_config.pmic[1] for z in thermal_config.pmic[0]] + dat.deviceState.intakeTempC = read_tz(thermal_config.intake[0]) / thermal_config.intake[1] + dat.deviceState.exhaustTempC = read_tz(thermal_config.exhaust[0]) / thermal_config.exhaust[1] return dat diff --git a/system/hardware/pc/hardware.py b/system/hardware/pc/hardware.py index c778f6429..a2386b92d 100644 --- a/system/hardware/pc/hardware.py +++ b/system/hardware/pc/hardware.py @@ -54,7 +54,7 @@ class Pc(HardwareBase): print("SHUTDOWN!") def get_thermal_config(self): - return ThermalConfig(cpu=((None,), 1), gpu=((None,), 1), mem=(None, 1), bat=(None, 1), pmic=((None,), 1)) + return ThermalConfig(cpu=((None,), 1), gpu=((None,), 1), mem=(None, 1), pmic=((None,), 1), intake=(None, 1), exhaust=(None, 1)) def set_screen_brightness(self, percentage): pass diff --git a/system/hardware/tici/hardware.py b/system/hardware/tici/hardware.py index c53ef586a..895032984 100644 --- a/system/hardware/tici/hardware.py +++ b/system/hardware/tici/hardware.py @@ -323,12 +323,17 @@ class Tici(HardwareBase): os.system("sudo poweroff") def get_thermal_config(self): + intake, exhaust = (None, 1), (None, 1) + if self.get_device_type() == "mici": + intake = ("intake", 1000) + exhaust = ("exhaust", 1000) return ThermalConfig(cpu=([f"cpu{i}-silver-usr" for i in range(4)] + [f"cpu{i}-gold-usr" for i in range(4)], 1000), gpu=(("gpu0-usr", "gpu1-usr"), 1000), mem=("ddr-usr", 1000), - bat=(None, 1), - pmic=(("pm8998_tz", "pm8005_tz"), 1000)) + pmic=(("pm8998_tz", "pm8005_tz"), 1000), + intake=intake, + exhaust=exhaust) def set_screen_brightness(self, percentage): try: