Config -> Settings

This commit is contained in:
atse 2024-06-24 12:04:34 +08:00
parent cca0e3c746
commit dc8e682ac6
3 changed files with 25 additions and 25 deletions

View File

@ -125,23 +125,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")
@ -149,11 +149,11 @@ 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(
@ -169,13 +169,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"]
)
@ -187,13 +187,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":
@ -207,5 +207,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"])

View File

@ -14,7 +14,7 @@
"readonly":true
},
{
"name":"Output Config",
"name":"Output Settings",
"expanded":true,
"type":"group",
"children":[
@ -136,10 +136,10 @@
]
},
{
"name":"Thermistor Config",
"name":"Thermistor Settings",
"expanded":true,
"type":"group",
"tip": "Configuration of the connected Thermistor",
"tip": "Settings of the connected Thermistor",
"children":[
{
"name":"T₀",
@ -209,7 +209,7 @@
]
},
{
"name":"PID Config",
"name":"PID Settings",
"expanded":true,
"type":"group",
"children":[
@ -357,12 +357,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"
}
]
}

View File

@ -93,7 +93,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),
],
]
@ -327,18 +327,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()