reset on ignition edge (#22915)

pull/22920/head
Robbe Derks 2021-11-15 17:52:42 +01:00 committed by GitHub
parent 8e12b9ca76
commit 1d03f2a97b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -126,16 +126,23 @@ def handle_fan_uno(controller, max_cpu_temp, fan_speed, ignition):
return new_speed
last_ignition = False
def handle_fan_tici(controller, max_cpu_temp, fan_speed, ignition):
global last_ignition
controller.neg_limit = -(80 if ignition else 30)
controller.pos_limit = -(30 if ignition else 0)
if ignition != last_ignition:
controller.reset()
fan_pwr_out = -int(controller.update(
setpoint=(75 if ignition else (OFFROAD_DANGER_TEMP - 2)),
measurement=max_cpu_temp,
feedforward=interp(max_cpu_temp, [60.0, 100.0], [0, -80])
))
last_ignition = ignition
return fan_pwr_out