diff --git a/client/brewpi.ui b/client/brewpi.ui index 4f2ad4f..1599820 100644 --- a/client/brewpi.ui +++ b/client/brewpi.ui @@ -3755,6 +3755,47 @@ Pot reset to ambient temperature + + + + 930 + 500 + 91 + 31 + + + + Pot [°C] + + + Qt::AlignCenter + + + + + + 1030 + 500 + 70 + 31 + + + + Pre-dial the temperature btn_pot_reset applies to the simulated Pot + + + 0 + + + -999.000000000000000 + + + 999.000000000000000 + + + 1.000000000000000 + + diff --git a/client/brewpi_gui.py b/client/brewpi_gui.py index 220aa58..70c17a2 100755 --- a/client/brewpi_gui.py +++ b/client/brewpi_gui.py @@ -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 diff --git a/client/main_window.py b/client/main_window.py index 0b2ff16..111972b 100644 --- a/client/main_window.py +++ b/client/main_window.py @@ -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")) diff --git a/tasks/pot.py b/tasks/pot.py index 603f00c..bdbe81d 100644 --- a/tasks/pot.py +++ b/tasks/pot.py @@ -22,7 +22,12 @@ class PotTask(ATask): async def recv(self, data): for pair in data.items(): if 'Reset' in pair[0]: - self.plant.initial(self.plant.theta_amb) + # The GUI's pot-temp spinbox sends the temperature to reset + # to directly - fall back to ambient for any older/other + # caller that still just sends a bare True. + value = pair[1] + temp = value if isinstance(value, (int, float)) else self.plant.theta_amb + self.plant.initial(temp) async def send(self, data): await self.msg_handler.send(data)