From b84c268b6e551fb63b6e0b98be0c47b6d9dc213b Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Wed, 15 Apr 2026 03:09:41 +0000 Subject: [PATCH] fix: standstill fan clamp 0-30% and bench mode always 30-100% Standstill quiet mode was clamped to 0-10% which is dangerously low under sustained load. Raised to 0-30%. Bench mode now forces 30-100% onroad fan range regardless of standstill to prevent overheating during bench testing. Co-Authored-By: Claude Opus 4.6 (1M context) --- selfdrive/thermald/fan_controller.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/selfdrive/thermald/fan_controller.py b/selfdrive/thermald/fan_controller.py index 3d08282..4a96611 100755 --- a/selfdrive/thermald/fan_controller.py +++ b/selfdrive/thermald/fan_controller.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import os from abc import ABC, abstractmethod from openpilot.common.realtime import DT_TRML @@ -6,6 +7,8 @@ from openpilot.common.numpy_fast import interp from openpilot.common.swaglog import cloudlog from openpilot.selfdrive.controls.lib.pid import PIDController +BENCH_MODE = os.environ.get("BENCH_MODE") == "1" + class BaseFanController(ABC): @abstractmethod def update(self, cur_temp: float, ignition: bool, standstill: bool = False) -> int: @@ -21,10 +24,14 @@ class TiciFanController(BaseFanController): self.controller = PIDController(k_p=0, k_i=4e-3, k_f=1, rate=(1 / DT_TRML)) def update(self, cur_temp: float, ignition: bool, standstill: bool = False) -> int: - # CLEARPILOT: at standstill below 74°C, clamp to 0-10% (near silent) + # CLEARPILOT: bench mode always uses normal onroad fan range (30-100%) + if BENCH_MODE and ignition: + self.controller.neg_limit = -100 + self.controller.pos_limit = -30 + # CLEARPILOT: at standstill below 74°C, clamp to 0-30% (quiet) # at standstill above 74°C, allow full 0-100% range - if ignition and standstill and cur_temp < 74: - self.controller.neg_limit = -10 + elif ignition and standstill and cur_temp < 74: + self.controller.neg_limit = -30 self.controller.pos_limit = 0 elif ignition and standstill: self.controller.neg_limit = -100