Disable manual sliders during sud, track live values continuously

During a running sud, all four manual sliders (temp soll, heat rate,
heater power, stirrer speed) are disabled for user input but update
their positions continuously from server pushes. They re-enable when
the sud stops or is paused, or on disconnect. Browser client also
resets initial-sync flags on reconnect so sliders re-sync correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DF16nV2ispNw1C9SbvqbRQ
This commit is contained in:
2026-06-27 21:10:40 +02:00
co-authored by Claude Sonnet 4.6
parent 734da781f8
commit ce6f14eccf
2 changed files with 50 additions and 18 deletions
+23 -11
View File
@@ -722,6 +722,9 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.sud_state = None
self.sud_user_message = None
self._close_confirm_dialog()
for w in (self.Slider_temp_soll, self.doubleSpinBox_heatrate_soll,
self.Slider_pwr_soll, self.Slider_speed_soll):
w.setEnabled(True)
# ambient_temp (the server's last echoed reading, shown in the
# status bar) is no longer trustworthy, but the spinbox itself is
# a client-owned setting (see closeEvent()/connect()) - leave it
@@ -912,16 +915,13 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
if 'Temp' in submsg:
self.plot_temp_soll = submsg['Temp']
self.lcdNumber_temp_soll.display(f'{submsg["Temp"]:.1f}')
if self.slider_temp_soll_initial_update:
# blockSignals: setValue() here is just syncing the
# slider's display to the server's current value, not
# a user edit - without this it would also fire
# valueChanged and echo the value straight back as a
# command.
sud_running = self.sud_state in SUD_RUNNING_STATES
if self.slider_temp_soll_initial_update or sud_running:
self.Slider_temp_soll.blockSignals(True)
self.Slider_temp_soll.setValue(int(round(submsg['Temp'])))
self.Slider_temp_soll.blockSignals(False)
self.slider_temp_soll_initial_update = False
if not sud_running:
self.slider_temp_soll_initial_update = False
if 'Rate' in submsg:
subsubmsg = submsg['Rate']
for subkey in subsubmsg:
@@ -929,11 +929,13 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.plot_rate_soll = subsubmsg['Current']
self.lcdNumber_heatrate_soll.display(f'{subsubmsg["Current"]:.1f}')
if "Set" in subkey:
if self.heatrate_soll_initial_update:
self.heatrate_soll_initial_update = False
sud_running = self.sud_state in SUD_RUNNING_STATES
if self.heatrate_soll_initial_update or sud_running:
self.doubleSpinBox_heatrate_soll.blockSignals(True)
self.doubleSpinBox_heatrate_soll.setValue(subsubmsg['Set'])
self.doubleSpinBox_heatrate_soll.blockSignals(False)
if not sud_running:
self.heatrate_soll_initial_update = False
if "Ist" in key:
submsg = msg['Ist']
if 'Temp' in submsg:
@@ -949,6 +951,10 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
if "PowerSet" in key:
self.plot_power_set = msg['PowerSet']
self.lcdNumber_power_heater.display(msg['PowerSet'])
if self.sud_state in SUD_RUNNING_STATES:
self.Slider_pwr_soll.blockSignals(True)
self.Slider_pwr_soll.setValue(int(round(msg['PowerSet'])))
self.Slider_pwr_soll.blockSignals(False)
elif "Power" in key:
self.plot_power_eff = msg['Power']
self.lcdNumber_power_pot.display(msg['Power'])
@@ -977,11 +983,13 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
if "Speed" in key:
self.stirrer_speed_ist = msg['Speed']
self._update_step_plates()
if self.slider_speed_initial_update:
sud_running = self.sud_state in SUD_RUNNING_STATES
if self.slider_speed_initial_update or sud_running:
self.Slider_speed_soll.blockSignals(True)
self.Slider_speed_soll.setValue(int(round(msg['Speed'])))
self.Slider_speed_soll.blockSignals(False)
self.slider_speed_initial_update = False
if not sud_running:
self.slider_speed_initial_update = False
elif "Capabilities" in key:
submsg = msg['Capabilities']
if "Power" in submsg:
@@ -1008,6 +1016,10 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
elif "State" in key:
prev_state = self.sud_state
self.sud_state = msg['State']
running = self.sud_state in SUD_RUNNING_STATES
for w in (self.Slider_temp_soll, self.doubleSpinBox_heatrate_soll,
self.Slider_pwr_soll, self.Slider_speed_soll):
w.setEnabled(not running)
if self.sud_state in SUD_RUNNING_STATES and self.sud_elapsed_seconds is None:
self.sud_elapsed_seconds = 0.0