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
+9 -4
View File
@@ -190,24 +190,27 @@ class Ui_MainWindow(object):
self.groupBox_2.setSizePolicy(sizePolicy)
self.groupBox_2.setMinimumSize(QtCore.QSize(0, 0))
self.groupBox_2.setObjectName("groupBox_2")
self.checkbox_tc_enable = QtWidgets.QCheckBox(self.groupBox_2)
self.checkbox_tc_enable.setGeometry(QtCore.QRect(0, 25, 141, 25))
self.checkbox_tc_enable.setObjectName("checkbox_tc_enable")
self.Slider_temp_soll = QtWidgets.QSlider(self.groupBox_2)
self.Slider_temp_soll.setGeometry(QtCore.QRect(20, 70, 63, 281))
self.Slider_temp_soll.setGeometry(QtCore.QRect(20, 100, 63, 281))
self.Slider_temp_soll.setMinimum(0)
self.Slider_temp_soll.setMaximum(100)
self.Slider_temp_soll.setOrientation(QtCore.Qt.Vertical)
self.Slider_temp_soll.setObjectName("Slider_temp_soll")
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
self.label_6.setGeometry(QtCore.QRect(10, 370, 67, 31))
self.label_6.setGeometry(QtCore.QRect(10, 400, 67, 31))
self.label_6.setAlignment(QtCore.Qt.AlignCenter)
self.label_6.setObjectName("label_6")
self.doubleSpinBox_heatrate_soll = QtWidgets.QDoubleSpinBox(self.groupBox_2)
self.doubleSpinBox_heatrate_soll.setGeometry(QtCore.QRect(80, 370, 51, 31))
self.doubleSpinBox_heatrate_soll.setGeometry(QtCore.QRect(80, 400, 51, 31))
self.doubleSpinBox_heatrate_soll.setDecimals(1)
self.doubleSpinBox_heatrate_soll.setMaximum(3.0)
self.doubleSpinBox_heatrate_soll.setSingleStep(0.1)
self.doubleSpinBox_heatrate_soll.setObjectName("doubleSpinBox_heatrate_soll")
self.label_9 = QtWidgets.QLabel(self.groupBox_2)
self.label_9.setGeometry(QtCore.QRect(0, 30, 141, 31))
self.label_9.setGeometry(QtCore.QRect(0, 60, 141, 31))
self.label_9.setAlignment(QtCore.Qt.AlignCenter)
self.label_9.setObjectName("label_9")
self.horizontalLayout.addWidget(self.groupBox_2)
@@ -1288,6 +1291,8 @@ class Ui_MainWindow(object):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "BrewPi"))
self.groupBox_2.setTitle(_translate("MainWindow", "Controller"))
self.checkbox_tc_enable.setToolTip(_translate("MainWindow", "While disabled, the controller tries not to drive the heater (output forced to 0) and the setpoints below are inactive"))
self.checkbox_tc_enable.setText(_translate("MainWindow", "Enabled"))
self.label_6.setText(_translate("MainWindow", "Heat rate"))
self.label_9.setText(_translate("MainWindow", "Temperature [°C]"))
self.groupBox.setTitle(_translate("MainWindow", "Heater"))