GUI: add a spinbox to pre-dial the simulated Pot's reset temperature

btn_pot_reset always reset the simulated Pot to the ambient
temperature. Add doubleSpinBox_pot_temp next to it (shown/hidden
together, same as the button) so the user can dial in a different
starting temperature before committing it - it seeds from the same
remembered ambient value on startup but is otherwise independent and
not persisted.

tasks/pot.py's PotTask.recv() now resets the plant to whatever
temperature the 'Reset' message carries, falling back to ambient for
the bare True a caller might still send.
This commit is contained in:
2026-06-23 19:34:33 +02:00
parent e4f8b15ab0
commit f035e1decd
4 changed files with 74 additions and 2 deletions
+41
View File
@@ -3755,6 +3755,47 @@
<string>Pot reset to ambient temperature</string>
</property>
</widget>
<widget class="QLabel" name="label_pot_temp">
<property name="geometry">
<rect>
<x>930</x>
<y>500</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Pot [°C]</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_pot_temp">
<property name="geometry">
<rect>
<x>1030</x>
<y>500</y>
<width>70</width>
<height>31</height>
</rect>
</property>
<property name="toolTip">
<string>Pre-dial the temperature btn_pot_reset applies to the simulated Pot</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-999.000000000000000</double>
</property>
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
+14 -1
View File
@@ -375,10 +375,19 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.doubleSpinBox_ambient.setValue(remembered_ambient)
self.doubleSpinBox_ambient.blockSignals(False)
self.doubleSpinBox_ambient.valueChanged.connect(self.on_ambient_entry_changed)
# Pre-dial the Pot reset target at the same starting point btn_pot_
# reset used to hardcode (ambient) - purely a one-off starting value
# for the user to optionally dial away from before clicking the
# button, so unlike the ambient spinbox it's never persisted/synced
# again afterwards.
if remembered_ambient is not None:
self.doubleSpinBox_pot_temp.setValue(remembered_ambient)
self.btn_pot_reset.clicked.connect(self.on_action_pot_reset)
# Only meaningful (and only shown) once the server confirms its Pot
# is simulated - see on_system_changed()'s "PlantSim" handling.
self.btn_pot_reset.setVisible(False)
self.label_pot_temp.setVisible(False)
self.doubleSpinBox_pot_temp.setVisible(False)
self.send_data = Queue()
self.slider_pwr_initial_update = True
@@ -509,6 +518,8 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
# showing whatever the user last set rather than blanking it.
self.ambient_temp = None
self.btn_pot_reset.setVisible(False)
self.label_pot_temp.setVisible(False)
self.doubleSpinBox_pot_temp.setVisible(False)
self.warp_factor = 1.0
self.sud_elapsed_seconds = None
self.sud_name = ''
@@ -554,10 +565,12 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.warp_factor = msg['WarpFactor']
elif "PlantSim" in key:
self.btn_pot_reset.setVisible(msg['PlantSim'])
self.label_pot_temp.setVisible(msg['PlantSim'])
self.doubleSpinBox_pot_temp.setVisible(msg['PlantSim'])
self.update_status_env_label()
def on_action_pot_reset(self):
self.msg_pot.send({'Reset': True})
self.msg_pot.send({'Reset': self.doubleSpinBox_pot_temp.value()})
def on_ambient_entry_changed(self, value):
# Persisted on shutdown instead (see closeEvent()), not on every
+13
View File
@@ -1247,6 +1247,17 @@ class Ui_MainWindow(object):
self.btn_pot_reset = QtWidgets.QPushButton(self.centralwidget)
self.btn_pot_reset.setGeometry(QtCore.QRect(700, 500, 220, 31))
self.btn_pot_reset.setObjectName("btn_pot_reset")
self.label_pot_temp = QtWidgets.QLabel(self.centralwidget)
self.label_pot_temp.setGeometry(QtCore.QRect(930, 500, 91, 31))
self.label_pot_temp.setAlignment(QtCore.Qt.AlignCenter)
self.label_pot_temp.setObjectName("label_pot_temp")
self.doubleSpinBox_pot_temp = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.doubleSpinBox_pot_temp.setGeometry(QtCore.QRect(1030, 500, 70, 31))
self.doubleSpinBox_pot_temp.setDecimals(0)
self.doubleSpinBox_pot_temp.setMinimum(-999.0)
self.doubleSpinBox_pot_temp.setMaximum(999.0)
self.doubleSpinBox_pot_temp.setSingleStep(1.0)
self.doubleSpinBox_pot_temp.setObjectName("doubleSpinBox_pot_temp")
self.label_8 = QtWidgets.QLabel(self.centralwidget)
self.label_8.setGeometry(QtCore.QRect(200, 500, 67, 31))
self.label_8.setAlignment(QtCore.Qt.AlignCenter)
@@ -1321,6 +1332,8 @@ class Ui_MainWindow(object):
self.doubleSpinBox_ambient.setToolTip(_translate("MainWindow", "Set the simulated/assumed ambient temperature"))
self.btn_pot_reset.setToolTip(_translate("MainWindow", "Only available when the server\'s Pot is simulated"))
self.btn_pot_reset.setText(_translate("MainWindow", "Pot reset to ambient temperature"))
self.label_pot_temp.setText(_translate("MainWindow", "Pot [°C]"))
self.doubleSpinBox_pot_temp.setToolTip(_translate("MainWindow", "Pre-dial the temperature btn_pot_reset applies to the simulated Pot"))
self.label_8.setText(_translate("MainWindow", "Host"))
self.menu_File.setTitle(_translate("MainWindow", "&File"))
self.menu_Help.setTitle(_translate("MainWindow", "&Help"))