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.: