From 6ee45b481480d033c334b910ecbaab3527f7b889 Mon Sep 17 00:00:00 2001 From: linuswck Date: Wed, 21 Feb 2024 17:37:56 +0800 Subject: [PATCH] thermostat: Limit Pid Temp SetPt to TempMon limits --- src/thermostat/thermostat.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/thermostat/thermostat.rs b/src/thermostat/thermostat.rs index bd7718a..a5e7b5e 100644 --- a/src/thermostat/thermostat.rs +++ b/src/thermostat/thermostat.rs @@ -345,6 +345,8 @@ impl Thermostat{ } pub fn set_temperature_setpoint(&mut self, t: ThermodynamicTemperature) { + let temp_mon_settings = self.temp_mon.get_settings(); + let t = t.min(temp_mon_settings.upper_limit).max(temp_mon_settings.lower_limit); self.pid_ctrl_ch0.set_pid_setpoint(t); self.temp_mon.set_setpoint(t); }