thermald: use latest modem temps (#23878)

* thermald: use latest modem temps

* move that
old-commit-hash: 52cd58068e
taco
Adeeb Shihadeh 3 years ago committed by GitHub
parent 98caf30f9b
commit a8fec54e7b
  1. 9
      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""" """Handles non critical hardware state, and sends over queue"""
count = 0 count = 0
registered_count = 0 registered_count = 0
prev_hw_state = None
while not end_event.is_set(): while not end_event.is_set():
# these are expensive calls. update every 10s # these are expensive calls. update every 10s
if (count % int(10. / DT_TRML)) == 0: if (count % int(10. / DT_TRML)) == 0:
try: try:
network_type = HARDWARE.get_network_type() 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( hw_state = HardwareState(
network_type=network_type, network_type=network_type,
network_strength=HARDWARE.get_network_strength(network_type), network_strength=HARDWARE.get_network_strength(network_type),
network_info=HARDWARE.get_network_info(), network_info=HARDWARE.get_network_info(),
nvme_temps=HARDWARE.get_nvme_temperatures(), nvme_temps=HARDWARE.get_nvme_temperatures(),
modem_temps=HARDWARE.get_modem_temperatures(), modem_temps=modem_temps,
) )
try: try:
@ -112,8 +116,9 @@ def hw_state_thread(end_event, hw_queue):
os.system("nmcli conn up lte") os.system("nmcli conn up lte")
registered_count = 0 registered_count = 0
prev_hw_state = hw_state
except Exception: except Exception:
cloudlog.exception("Error getting network status") cloudlog.exception("Error getting hardware state")
count += 1 count += 1
time.sleep(DT_TRML) time.sleep(DT_TRML)

Loading…
Cancel
Save