From 7829ce6adfa16e351d6a701524b5193bfe507fc2 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 24 Jun 2024 12:04:34 +0800 Subject: [PATCH] ctrl_panel: Config -> Settings --- pytec/pytec/gui/model/thermostat.py | 4 ++-- pytec/pytec/gui/view/ctrl_panel.py | 32 +++++++++++++++------------- pytec/pytec/gui/view/param_tree.json | 11 +++++----- pytec/tec_qt.py | 8 +++---- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 75615a2..58fbac7 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -117,14 +117,14 @@ class Thermostat(QObject, metaclass=PropertyMeta): async def save_cfg(self, ch): await self._client.save_config(ch) self.info_box_trigger.emit( - "Config saved", f"Channel {ch} Config has been saved from flash." + "Settings saved", f"Channel {ch} Settings has been saved to flash." ) @asyncSlot() async def load_cfg(self, ch): await self._client.load_config(ch) self.info_box_trigger.emit( - "Config loaded", f"Channel {ch} Config has been loaded from flash." + "Settings loaded", f"Channel {ch} Settings has been loaded from flash." ) async def dfu(self): diff --git a/pytec/pytec/gui/view/ctrl_panel.py b/pytec/pytec/gui/view/ctrl_panel.py index 0c8d9d2..4dc9346 100644 --- a/pytec/pytec/gui/view/ctrl_panel.py +++ b/pytec/pytec/gui/view/ctrl_panel.py @@ -116,23 +116,23 @@ class CtrlPanel(QObject): for settings in pid_settings: channel = settings["channel"] with QSignalBlocker(self.params[channel]): - self.params[channel].child("PID Config", "Kp").setValue( + self.params[channel].child("PID Settings", "Kp").setValue( settings["parameters"]["kp"] ) - self.params[channel].child("PID Config", "Ki").setValue( + self.params[channel].child("PID Settings", "Ki").setValue( settings["parameters"]["ki"] ) - self.params[channel].child("PID Config", "Kd").setValue( + self.params[channel].child("PID Settings", "Kd").setValue( settings["parameters"]["kd"] ) self.params[channel].child( - "PID Config", "PID Output Clamping", "Minimum" + "PID Settings", "PID Output Clamping", "Minimum" ).setValue(settings["parameters"]["output_min"] * 1000) self.params[channel].child( - "PID Config", "PID Output Clamping", "Maximum" + "PID Settings", "PID Output Clamping", "Maximum" ).setValue(settings["parameters"]["output_max"] * 1000) self.params[channel].child( - "Output Config", "Control Method", "Set Temperature" + "Output Settings", "Control Method", "Set Temperature" ).setValue(settings["target"]) @pyqtSlot("QVariantList") @@ -140,11 +140,13 @@ class CtrlPanel(QObject): for settings in report_data: channel = settings["channel"] with QSignalBlocker(self.params[channel]): - self.params[channel].child("Output Config", "Control Method").setValue( + self.params[channel].child( + "Output Settings", "Control Method" + ).setValue( "Temperature PID" if settings["pid_engaged"] else "Constant Current" ) self.params[channel].child( - "Output Config", "Control Method", "Set Current" + "Output Settings", "Control Method", "Set Current" ).setValue(settings["i_set"] * 1000) if settings["temperature"] is not None: self.params[channel].child("Temperature").setValue( @@ -160,13 +162,13 @@ class CtrlPanel(QObject): for sh_param in sh_data: channel = sh_param["channel"] with QSignalBlocker(self.params[channel]): - self.params[channel].child("Thermistor Config", "T₀").setValue( + self.params[channel].child("Thermistor Settings", "T₀").setValue( sh_param["params"]["t0"] - 273.15 ) - self.params[channel].child("Thermistor Config", "R₀").setValue( + self.params[channel].child("Thermistor Settings", "R₀").setValue( sh_param["params"]["r0"] ) - self.params[channel].child("Thermistor Config", "B").setValue( + self.params[channel].child("Thermistor Settings", "B").setValue( sh_param["params"]["b"] ) @@ -178,13 +180,13 @@ class CtrlPanel(QObject): channel = pwm_params["channel"] with QSignalBlocker(self.params[channel]): self.params[channel].child( - "Output Config", "Limits", "Max Voltage Difference" + "Output Settings", "Limits", "Max Voltage Difference" ).setValue(pwm_params["max_v"]["value"]) self.params[channel].child( - "Output Config", "Limits", "Max Cooling Current" + "Output Settings", "Limits", "Max Cooling Current" ).setValue(pwm_params["max_i_pos"]["value"] * 1000) self.params[channel].child( - "Output Config", "Limits", "Max Heating Current" + "Output Settings", "Limits", "Max Heating Current" ).setValue(pwm_params["max_i_neg"]["value"] * 1000) for limit in "max_i_pos", "max_i_neg", "max_v": @@ -198,5 +200,5 @@ class CtrlPanel(QObject): channel = postfilter_params["channel"] with QSignalBlocker(self.params[channel]): self.params[channel].child( - "Thermistor Config", "Postfilter Rate" + "Thermistor Settings", "Postfilter Rate" ).setValue(postfilter_params["rate"]) diff --git a/pytec/pytec/gui/view/param_tree.json b/pytec/pytec/gui/view/param_tree.json index 674506b..ab46a9b 100644 --- a/pytec/pytec/gui/view/param_tree.json +++ b/pytec/pytec/gui/view/param_tree.json @@ -14,7 +14,7 @@ "readonly": true }, { - "name": "Output Config", + "name": "Output Settings", "expanded": true, "type": "group", "children": [ @@ -136,9 +136,10 @@ ] }, { - "name": "Thermistor Config", + "name": "Thermistor Settings", "expanded": true, "type": "group", + "tip": "Settings of the connected Thermistor", "children": [ { "name": "T₀", @@ -206,7 +207,7 @@ ] }, { - "name": "PID Config", + "name": "PID Settings", "expanded": true, "type": "group", "children": [ @@ -354,12 +355,12 @@ { "name": "Save to flash", "type": "action", - "tip": "Save config to thermostat, applies on reset" + "tip": "Save settings to thermostat, applies on reset" }, { "name": "Load from flash", "type": "action", - "tip": "Load config from flash" + "tip": "Load settings from flash" } ] } \ No newline at end of file diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 2393d0a..0dba9d4 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -81,7 +81,7 @@ class MainWindow(QtWidgets.QMainWindow): [["Save to flash"], partial(self.thermostat.save_cfg, ch)], [["Load from flash"], partial(self.thermostat.load_cfg, ch)], [ - ["PID Config", "PID Auto Tune", "Run"], + ["PID Settings", "PID Auto Tune", "Run"], partial(self.pid_auto_tune_request, ch), ], ] @@ -315,18 +315,18 @@ class MainWindow(QtWidgets.QMainWindow): match self.autotuners.get_state(ch): case PIDAutotuneState.STATE_OFF: self.ctrl_panel_view.change_params_title( - ch, ("PID Config", "PID Auto Tune", "Run"), "Run" + ch, ("PID Settings", "PID Auto Tune", "Run"), "Run" ) case PIDAutotuneState.STATE_READY | PIDAutotuneState.STATE_RELAY_STEP_UP | PIDAutotuneState.STATE_RELAY_STEP_DOWN: self.ctrl_panel_view.change_params_title( - ch, ("PID Config", "PID Auto Tune", "Run"), "Stop" + ch, ("PID Settings", "PID Auto Tune", "Run"), "Stop" ) ch_tuning.append(ch) case PIDAutotuneState.STATE_SUCCEEDED: self.info_box.display_info_box( "PID Autotune Success", - f"Channel {ch} PID Config has been loaded to Thermostat. Regulating temperature.", + f"Channel {ch} PID Settings has been loaded to Thermostat. Regulating temperature.", ) self.info_box.show()