forked from mawei/dp
1
0
Fork 0

Update fan_controller.py

This commit is contained in:
1okko 2024-10-08 20:04:08 +08:00 committed by GitHub
parent ae1c4f48b0
commit 4b2a0d6432
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -28,11 +28,14 @@ class TiciFanController(BaseFanController):
self.controller.reset() self.controller.reset()
error = 70 - cur_temp error = 70 - cur_temp
fan_pwr_out = -int(self.controller.update( #fan_pwr_out = -int(self.controller.update(
error=error, #error=error,
feedforward=interp(cur_temp, [60.0, 100.0], [0, -100]) #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 self.last_ignition = ignition
return fan_pwr_out return fan_pwr_out