From 4b2a0d64328111241970a4942dbeee7695a2c68d Mon Sep 17 00:00:00 2001 From: 1okko <136616964+1okko@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:04:08 +0800 Subject: [PATCH] Update fan_controller.py --- system/hardware/fan_controller.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/system/hardware/fan_controller.py b/system/hardware/fan_controller.py index f32133f6..49e1c864 100755 --- a/system/hardware/fan_controller.py +++ b/system/hardware/fan_controller.py @@ -28,11 +28,14 @@ class TiciFanController(BaseFanController): self.controller.reset() error = 70 - cur_temp - fan_pwr_out = -int(self.controller.update( - error=error, - feedforward=interp(cur_temp, [60.0, 100.0], [0, -100]) - )) + #fan_pwr_out = -int(self.controller.update( + #error=error, + #feedforward=interp(cur_temp, [60.0, 100.0], [0, -100]) + #)) + fan_pwr_out = int(interp(cur_temp, [60.0, 80.0], [0, 65])) + # 确保风扇功率在 0 到 65 之间 + fan_pwr_out = max(0, min(65, fan_pwr_out)) self.last_ignition = ignition return fan_pwr_out