mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-09 06:52:05 +08:00
fan: classic fan curve for c3/c3x, keep 0.11.1 on mici
Port min-feat/dev/fan-controller: split FanController.update() by device. mici keeps the verbatim upstream 0.11.1 response (OFFSET == 0 there); the older comma three / three X use the classic pre-0.11.1 curve (setpoint 75) instead of the +5C setpoint bump, which makes them run hotter with less throttle margin.
This commit is contained in:
@@ -6,6 +6,7 @@ from openpilot.system.hardware import HARDWARE
|
||||
|
||||
# raise fan setpoint on tici/tizi to reduce noise
|
||||
# after raising LMH threshold in AGNOS 18.1 to prevent CPU throttling
|
||||
# (evaluates to 0 on mici, i.e. no bump)
|
||||
OFFSET = 0 if HARDWARE.get_device_type() == "mici" else 5
|
||||
|
||||
|
||||
@@ -13,6 +14,9 @@ class FanController:
|
||||
def __init__(self, rate: int) -> None:
|
||||
self.last_ignition = False
|
||||
self.controller = PIDController(k_p=0, k_i=4e-3, rate=rate)
|
||||
# dp: mici keeps the upstream 0.11.1 response; the older comma three / three X
|
||||
# run hotter with the +5C bump, so they use the classic pre-0.11.1 response.
|
||||
self._mici = HARDWARE.get_device_type() == "mici"
|
||||
|
||||
def update(self, cur_temp: float, ignition: bool) -> int:
|
||||
self.controller.pos_limit = 100 if ignition else 30
|
||||
@@ -22,7 +26,15 @@ class FanController:
|
||||
self.controller.reset()
|
||||
self.last_ignition = ignition
|
||||
|
||||
if self._mici:
|
||||
# upstream 0.11.1 (OFFSET == 0 on mici)
|
||||
return int(self.controller.update(
|
||||
error=(cur_temp - (75 + OFFSET)), # temperature setpoint in C
|
||||
feedforward=np.interp(cur_temp, [60.0 + OFFSET, 100.0 + OFFSET], [0, 100])
|
||||
))
|
||||
|
||||
# classic pre-0.11.1 (comma three / three X)
|
||||
return int(self.controller.update(
|
||||
error=(cur_temp - (75 + OFFSET)), # temperature setpoint in C
|
||||
feedforward=np.interp(cur_temp, [60.0 + OFFSET, 100.0 + OFFSET], [0, 100])
|
||||
error=(cur_temp - 75), # temperature setpoint in C
|
||||
feedforward=np.interp(cur_temp, [60.0, 100.0], [0, 100])
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user