From a8fec54e7b873547fd021cd77bea199913a960f0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 2 Mar 2022 11:01:06 -0800 Subject: [PATCH] thermald: use latest modem temps (#23878) * thermald: use latest modem temps * move that old-commit-hash: 52cd58068e6412cdbd2d483b864c14fb942542ee --- selfdrive/thermald/thermald.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 8fd0db9711..2add71ea16 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -82,19 +82,23 @@ def hw_state_thread(end_event, hw_queue): """Handles non critical hardware state, and sends over queue""" count = 0 registered_count = 0 + prev_hw_state = None while not end_event.is_set(): # these are expensive calls. update every 10s if (count % int(10. / DT_TRML)) == 0: try: network_type = HARDWARE.get_network_type() + modem_temps = HARDWARE.get_modem_temperatures() + if len(modem_temps) == 0 and prev_hw_state is not None: + modem_temps = prev_hw_state.modem_temps hw_state = HardwareState( network_type=network_type, network_strength=HARDWARE.get_network_strength(network_type), network_info=HARDWARE.get_network_info(), nvme_temps=HARDWARE.get_nvme_temperatures(), - modem_temps=HARDWARE.get_modem_temperatures(), + modem_temps=modem_temps, ) try: @@ -112,8 +116,9 @@ def hw_state_thread(end_event, hw_queue): os.system("nmcli conn up lte") registered_count = 0 + prev_hw_state = hw_state except Exception: - cloudlog.exception("Error getting network status") + cloudlog.exception("Error getting hardware state") count += 1 time.sleep(DT_TRML)