From 4d4c3f021bf756591e19d9a90d15f67eaa87cd7e Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Fri, 12 Jun 2020 15:03:32 -0700 Subject: [PATCH] Cool down device before going onroad if CPU temp over 75 C (#1688) * Block going onroad when temperatures are too high * add relay check old-commit-hash: 955d2aefdd6dd0c4de4820175a18f67c81be6783 --- selfdrive/thermald/thermald.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index a67f086dd1..9e4a26c001 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -184,6 +184,7 @@ def thermald_thread(): should_start_prev = False handle_fan = None is_uno = False + has_relay = False params = Params() pm = PowerMonitoring() @@ -212,6 +213,7 @@ def thermald_thread(): # Setup fan handler on first connect to panda if handle_fan is None and health.health.hwType != log.HealthData.HwType.unknown: is_uno = health.health.hwType == log.HealthData.HwType.uno + has_relay = health.health.hwType in [log.HealthData.HwType.blackPanda, log.HealthData.HwType.uno] if is_uno or not ANDROID: cloudlog.info("Setting up UNO fan handler") @@ -268,8 +270,10 @@ def thermald_thread(): fan_speed = handle_fan(max_cpu_temp, bat_temp, fan_speed, ignition) msg.thermal.fanSpeed = fan_speed - # thermal logic with hysterisis - if max_cpu_temp > 107. or bat_temp >= 63.: + # If device is offroad we want to cool down before going onroad + # since going onroad increases load and can make temps go over 107 + # We only do this if there is a relay that prevents the car from faulting + if max_cpu_temp > 107. or bat_temp >= 63. or (has_relay and (started_ts is None) and max_cpu_temp > 75.0): # onroad not allowed thermal_status = ThermalStatus.danger elif max_comp_temp > 100.0 or bat_temp > 60.: