forked from M-Labs/thermostat
Config -> Settings
This commit is contained in:
parent
cca0e3c746
commit
dc8e682ac6
@ -125,23 +125,23 @@ class CtrlPanel(QObject):
|
|||||||
for settings in pid_settings:
|
for settings in pid_settings:
|
||||||
channel = settings["channel"]
|
channel = settings["channel"]
|
||||||
with QSignalBlocker(self.params[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"]
|
settings["parameters"]["kp"]
|
||||||
)
|
)
|
||||||
self.params[channel].child("PID Config", "Ki").setValue(
|
self.params[channel].child("PID Settings", "Ki").setValue(
|
||||||
settings["parameters"]["ki"]
|
settings["parameters"]["ki"]
|
||||||
)
|
)
|
||||||
self.params[channel].child("PID Config", "Kd").setValue(
|
self.params[channel].child("PID Settings", "Kd").setValue(
|
||||||
settings["parameters"]["kd"]
|
settings["parameters"]["kd"]
|
||||||
)
|
)
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"PID Config", "PID Output Clamping", "Minimum"
|
"PID Settings", "PID Output Clamping", "Minimum"
|
||||||
).setValue(settings["parameters"]["output_min"] * 1000)
|
).setValue(settings["parameters"]["output_min"] * 1000)
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"PID Config", "PID Output Clamping", "Maximum"
|
"PID Settings", "PID Output Clamping", "Maximum"
|
||||||
).setValue(settings["parameters"]["output_max"] * 1000)
|
).setValue(settings["parameters"]["output_max"] * 1000)
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Output Config", "Control Method", "Set Temperature"
|
"Output Settings", "Control Method", "Set Temperature"
|
||||||
).setValue(settings["target"])
|
).setValue(settings["target"])
|
||||||
|
|
||||||
@pyqtSlot("QVariantList")
|
@pyqtSlot("QVariantList")
|
||||||
@ -149,11 +149,11 @@ class CtrlPanel(QObject):
|
|||||||
for settings in report_data:
|
for settings in report_data:
|
||||||
channel = settings["channel"]
|
channel = settings["channel"]
|
||||||
with QSignalBlocker(self.params[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"
|
"Temperature PID" if settings["pid_engaged"] else "Constant Current"
|
||||||
)
|
)
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Output Config", "Control Method", "Set Current"
|
"Output Settings", "Control Method", "Set Current"
|
||||||
).setValue(settings["i_set"] * 1000)
|
).setValue(settings["i_set"] * 1000)
|
||||||
if settings["temperature"] is not None:
|
if settings["temperature"] is not None:
|
||||||
self.params[channel].child("Temperature").setValue(
|
self.params[channel].child("Temperature").setValue(
|
||||||
@ -169,13 +169,13 @@ class CtrlPanel(QObject):
|
|||||||
for sh_param in sh_data:
|
for sh_param in sh_data:
|
||||||
channel = sh_param["channel"]
|
channel = sh_param["channel"]
|
||||||
with QSignalBlocker(self.params[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
|
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"]
|
sh_param["params"]["r0"]
|
||||||
)
|
)
|
||||||
self.params[channel].child("Thermistor Config", "B").setValue(
|
self.params[channel].child("Thermistor Settings", "B").setValue(
|
||||||
sh_param["params"]["b"]
|
sh_param["params"]["b"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -187,13 +187,13 @@ class CtrlPanel(QObject):
|
|||||||
channel = pwm_params["channel"]
|
channel = pwm_params["channel"]
|
||||||
with QSignalBlocker(self.params[channel]):
|
with QSignalBlocker(self.params[channel]):
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Output Config", "Limits", "Max Voltage Difference"
|
"Output Settings", "Limits", "Max Voltage Difference"
|
||||||
).setValue(pwm_params["max_v"]["value"])
|
).setValue(pwm_params["max_v"]["value"])
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Output Config", "Limits", "Max Cooling Current"
|
"Output Settings", "Limits", "Max Cooling Current"
|
||||||
).setValue(pwm_params["max_i_pos"]["value"] * 1000)
|
).setValue(pwm_params["max_i_pos"]["value"] * 1000)
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Output Config", "Limits", "Max Heating Current"
|
"Output Settings", "Limits", "Max Heating Current"
|
||||||
).setValue(pwm_params["max_i_neg"]["value"] * 1000)
|
).setValue(pwm_params["max_i_neg"]["value"] * 1000)
|
||||||
|
|
||||||
for limit in "max_i_pos", "max_i_neg", "max_v":
|
for limit in "max_i_pos", "max_i_neg", "max_v":
|
||||||
@ -207,5 +207,5 @@ class CtrlPanel(QObject):
|
|||||||
channel = postfilter_params["channel"]
|
channel = postfilter_params["channel"]
|
||||||
with QSignalBlocker(self.params[channel]):
|
with QSignalBlocker(self.params[channel]):
|
||||||
self.params[channel].child(
|
self.params[channel].child(
|
||||||
"Thermistor Config", "Postfilter Rate"
|
"Thermistor Settings", "Postfilter Rate"
|
||||||
).setValue(postfilter_params["rate"])
|
).setValue(postfilter_params["rate"])
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"readonly":true
|
"readonly":true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Output Config",
|
"name":"Output Settings",
|
||||||
"expanded":true,
|
"expanded":true,
|
||||||
"type":"group",
|
"type":"group",
|
||||||
"children":[
|
"children":[
|
||||||
@ -136,10 +136,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Thermistor Config",
|
"name":"Thermistor Settings",
|
||||||
"expanded":true,
|
"expanded":true,
|
||||||
"type":"group",
|
"type":"group",
|
||||||
"tip": "Configuration of the connected Thermistor",
|
"tip": "Settings of the connected Thermistor",
|
||||||
"children":[
|
"children":[
|
||||||
{
|
{
|
||||||
"name":"T₀",
|
"name":"T₀",
|
||||||
@ -209,7 +209,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"PID Config",
|
"name":"PID Settings",
|
||||||
"expanded":true,
|
"expanded":true,
|
||||||
"type":"group",
|
"type":"group",
|
||||||
"children":[
|
"children":[
|
||||||
@ -357,12 +357,12 @@
|
|||||||
{
|
{
|
||||||
"name":"Save to flash",
|
"name":"Save to flash",
|
||||||
"type":"action",
|
"type":"action",
|
||||||
"tip":"Save config to thermostat, applies on reset"
|
"tip":"Save settings to thermostat, applies on reset"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Load from flash",
|
"name":"Load from flash",
|
||||||
"type":"action",
|
"type":"action",
|
||||||
"tip":"Load config from flash"
|
"tip":"Load settings from flash"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -93,7 +93,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
[["Save to flash"], partial(self.thermostat.save_cfg, ch)],
|
[["Save to flash"], partial(self.thermostat.save_cfg, ch)],
|
||||||
[["Load from flash"], partial(self.thermostat.load_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),
|
partial(self.pid_auto_tune_request, ch),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
@ -327,18 +327,18 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
match self.autotuners.get_state(ch):
|
match self.autotuners.get_state(ch):
|
||||||
case PIDAutotuneState.STATE_OFF:
|
case PIDAutotuneState.STATE_OFF:
|
||||||
self.ctrl_panel_view.change_params_title(
|
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:
|
case PIDAutotuneState.STATE_READY | PIDAutotuneState.STATE_RELAY_STEP_UP | PIDAutotuneState.STATE_RELAY_STEP_DOWN:
|
||||||
self.ctrl_panel_view.change_params_title(
|
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)
|
ch_tuning.append(ch)
|
||||||
|
|
||||||
case PIDAutotuneState.STATE_SUCCEEDED:
|
case PIDAutotuneState.STATE_SUCCEEDED:
|
||||||
self.info_box.display_info_box(
|
self.info_box.display_info_box(
|
||||||
"PID Autotune Success",
|
"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()
|
self.info_box.show()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user