diff --git a/selfdrive/hardware/base.py b/selfdrive/hardware/base.py index 0a1976d0c7..359125f9ce 100644 --- a/selfdrive/hardware/base.py +++ b/selfdrive/hardware/base.py @@ -122,6 +122,10 @@ class HardwareBase: def get_modem_version(self): pass + @abstractmethod + def get_modem_temperatures(self): + pass + @abstractmethod def initialize_hardware(self): pass diff --git a/selfdrive/hardware/eon/hardware.py b/selfdrive/hardware/eon/hardware.py index b555ae351b..ae746077da 100644 --- a/selfdrive/hardware/eon/hardware.py +++ b/selfdrive/hardware/eon/hardware.py @@ -389,6 +389,10 @@ class Android(HardwareBase): def get_modem_version(self): return None + def get_modem_temperatures(self): + # Not sure if we can get this on the LeEco + return [] + def initialize_hardware(self): pass diff --git a/selfdrive/hardware/pc/hardware.py b/selfdrive/hardware/pc/hardware.py index 69bca5b624..50a52db48d 100644 --- a/selfdrive/hardware/pc/hardware.py +++ b/selfdrive/hardware/pc/hardware.py @@ -92,6 +92,9 @@ class Pc(HardwareBase): def get_modem_version(self): return None + def get_modem_temperatures(self): + return [] + def initialize_hardware(self): pass diff --git a/selfdrive/hardware/tici/hardware.py b/selfdrive/hardware/tici/hardware.py index a4d527152d..b500e09a6c 100644 --- a/selfdrive/hardware/tici/hardware.py +++ b/selfdrive/hardware/tici/hardware.py @@ -223,6 +223,15 @@ class Tici(HardwareBase): except Exception: return None + def get_modem_temperatures(self): + modem = self.get_modem() + try: + command_timeout = 0.2 + temps = modem.Command("AT+QTEMP", int(command_timeout * 1000), dbus_interface=MM_MODEM, timeout=command_timeout) + return list(map(int, temps.split(' ')[1].split(','))) + except Exception: + return [] + # We don't have a battery, so let's use some sane constants def get_battery_capacity(self): return 100 diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 67cdf70306..b325a08e94 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -69,6 +69,7 @@ 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.ambientTempC = read_tz(thermal_config.ambient[0]) / thermal_config.ambient[1] + dat.deviceState.modemTempC = HARDWARE.get_modem_temperatures() return dat