Add a "Pot reset to ambient temperature" button, sim-only
New btn_pot_reset next to the ambient entry, sends {"Pot": {"Reset":
true}}; tasks/pot.py's PotTask.recv() (previously a no-op) now resets
the plant to its current ambient temperature (Pot.initial()) on that
command.
The button only appears when the server reports its Pot is simulated
(new "PlantSim" field on the System channel, derived from
config.json's previously-unused Controller.plant_name) - resetting a
simulated plant's temperature is meaningless for a real one.
This commit is contained in:
@@ -330,6 +330,10 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.checkbox_heater_activate.stateChanged.connect(self.on_checkbox_changed)
|
||||
self.checkbox_stirrer_activate.stateChanged.connect(self.on_checkbox_stirrer_activate_changed)
|
||||
self.lineEdit_ambient.returnPressed.connect(self.on_ambient_entry_changed)
|
||||
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.send_data = Queue()
|
||||
self.slider_pwr_initial_update = True
|
||||
@@ -462,6 +466,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.sud_user_message = None
|
||||
self.ambient_temp = None
|
||||
self.lineEdit_ambient.clear()
|
||||
self.btn_pot_reset.setVisible(False)
|
||||
self.warp_factor = 1.0
|
||||
self.sud_start_time = None
|
||||
self.sud_paused_total = 0.0
|
||||
@@ -500,8 +505,13 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.lineEdit_ambient.setText("{:.1f}".format(self.ambient_temp))
|
||||
elif "WarpFactor" in key:
|
||||
self.warp_factor = msg['WarpFactor']
|
||||
elif "PlantSim" in key:
|
||||
self.btn_pot_reset.setVisible(msg['PlantSim'])
|
||||
self.update_status_env_label()
|
||||
|
||||
def on_action_pot_reset(self):
|
||||
self.msg_pot.send({'Reset': True})
|
||||
|
||||
def on_ambient_entry_changed(self):
|
||||
try:
|
||||
value = float(self.lineEdit_ambient.text())
|
||||
|
||||
Reference in New Issue
Block a user