Add an enable/disable switch for the temperature controller

New TempControllerBase.enabled (default False) forces y=0 in
process_pid() when off, same mechanism as the existing cooling
override - the controller tries not to drive the heater at all.

tasks/tempctrl.py: new 'Enable' recv command and 'Enabled' broadcast
on the TempCtrl channel. tasks/sud.py: SudTask now enables the
controller on any non-IDLE/DONE Sud state and disables it (forcing
power back to 0) on IDLE/DONE, so automatic mode owns it for the
duration of a run and hands back manual control once it stops/finishes.

gui: new "Enabled" checkbox on the Manual tab's Controller group,
synced from the server; the temp/heatrate setpoint controls are
disabled whenever the controller itself is disabled.
This commit is contained in:
2026-06-21 12:54:09 +02:00
parent e2222dae5e
commit 3fea29cc58
6 changed files with 78 additions and 9 deletions
+8
View File
@@ -35,6 +35,10 @@ class TcTask(ATask):
def on_rate_ist_changed(self, value):
asyncio.create_task(self.send({'Ist': {'Rate': value}}))
def on_enabled_changed(self, value):
print("Enabled change to {}".format(value))
asyncio.create_task(self.send({'Enabled': value}))
async def recv(self, msg):
print(msg)
for key in msg.keys():
@@ -45,6 +49,8 @@ class TcTask(ATask):
self.tc.set_theta_soll(submsg['Temp'])
if 'Rate' in subkey:
self.tc.set_heatrate_soll(submsg['Rate'])
if 'Enable' in key:
self.tc.set_enabled(bool(msg['Enable']))
async def send(self, data):
await self.msg_handler.send(data)
@@ -58,9 +64,11 @@ class TcTask(ATask):
self.tc.set_on_changed('theta_soll_set', ChangedFloat(self.on_temp_soll_changed, prec=1).set)
self.tc.set_on_changed('heatrate_soll', ChangedFloat(self.on_rate_soll_curr_changed, prec=1).set)
self.tc.set_on_changed('heatrate_soll_set', ChangedFloat(self.on_rate_soll_set_changed, prec=1).set)
self.tc.set_on_changed('enabled', self.on_enabled_changed)
self.tc.set_theta_soll(20.0)
self.tc.set_heatrate_soll(1.0)
await self.send({'Enabled': self.tc.enabled})
while True:
self.tc.process()