Compare commits

...

2 Commits

Author SHA1 Message Date
36b2afd00a Control Panel: Improve postfilter description 2025-03-31 13:42:02 +08:00
cd443761a5 Control Panel: Improve parameter tree descriptions
Add tooltips and titles, so that users can better understand parameters.
2025-03-31 13:38:50 +08:00
3 changed files with 57 additions and 21 deletions

View File

@ -45,6 +45,13 @@ class MutexParameter(pTypes.ListParameter):
registerParameterType("mutex", MutexParameter)
def set_tree_label_tips(tree):
for item in tree.listAllItems():
p = item.param
if "tip" in p.opts:
item.setToolTip(0, p.opts["tip"])
class CtrlPanel(QObject):
def __init__(
self,
@ -84,6 +91,8 @@ class CtrlPanel(QObject):
self.params[i].setValue = self._setValue
self.params[i].sigTreeStateChanged.connect(self.send_command)
set_tree_label_tips(tree)
self.params[i].child("Save to flash").sigActivated.connect(
partial(self.save_settings, i)
)
@ -146,7 +155,7 @@ class CtrlPanel(QObject):
# Handle thermostat command irregularities
match inner_param.name(), new_value:
case "Postfilter Rate", None:
case "50/60 Hz Rejection Filter", None:
thermostat_param = thermostat_param.copy()
thermostat_param["field"] = "off"
new_value = ""
@ -186,7 +195,7 @@ class CtrlPanel(QObject):
"PID Config", "PID Output Clamping", "Maximum"
).setValue(settings["parameters"]["output_max"] * 1000)
self.params[channel].child(
"Output Config", "Control Method", "Set Temperature"
"Output Config", "Control Method", "Setpoint"
).setValue(settings["target"])
@pyqtSlot(list)
@ -230,7 +239,7 @@ class CtrlPanel(QObject):
channel = output_params["channel"]
with QSignalBlocker(self.params[channel]):
self.params[channel].child(
"Output Config", "Limits", "Max Voltage Difference"
"Output Config", "Limits", "Max Absolute Voltage"
).setValue(output_params["max_v"])
self.params[channel].child(
"Output Config", "Limits", "Max Cooling Current"
@ -245,7 +254,7 @@ class CtrlPanel(QObject):
channel = postfilter_params["channel"]
with QSignalBlocker(self.params[channel]):
self.params[channel].child(
"Thermistor Config", "Postfilter Rate"
"Thermistor Config", "50/60 Hz Rejection Filter"
).setValue(postfilter_params["rate"])
def update_pid_autotune(self, ch, state):

View File

@ -4,19 +4,22 @@
"name": "Temperature",
"type": "float",
"format": "{value:.4f} °C",
"readonly": true
"readonly": true,
"tip": "The measured temperature at the thermistor"
},
{
"name": "Current through TEC",
"type": "float",
"suffix": "mA",
"decimals": 6,
"readonly": true
"readonly": true,
"tip": "The measured current through the TEC"
},
{
"name": "Output Config",
"expanded": true,
"type": "group",
"tip": "Settings of the output to the TEC",
"children": [
{
"name": "Control Method",
@ -30,6 +33,7 @@
"topic": "output",
"field": "pid"
},
"tip": "Select control method of output",
"children": [
{
"name": "Set Current",
@ -48,10 +52,11 @@
"topic": "output",
"field": "i_set"
},
"tip": "The set current through TEC",
"lock": false
},
{
"name": "Set Temperature",
"name": "Setpoint",
"type": "float",
"value": 25,
"step": 0.1,
@ -65,6 +70,7 @@
"topic": "pid",
"field": "target"
},
"tip": "The temperature setpoint of the TEC",
"lock": false
}
]
@ -73,6 +79,7 @@
"name": "Limits",
"expanded": true,
"type": "group",
"tip": "The limits of output, with the polarity at the front panel as reference",
"children": [
{
"name": "Max Cooling Current",
@ -90,6 +97,7 @@
"topic": "output",
"field": "max_i_pos"
},
"tip": "The maximum cooling (+ve) current through the output pins",
"lock": false
},
{
@ -108,10 +116,11 @@
"topic": "output",
"field": "max_i_neg"
},
"tip": "The maximum heating (-ve) current through the output pins",
"lock": false
},
{
"name": "Max Voltage Difference",
"name": "Max Absolute Voltage",
"type": "float",
"value": 0,
"step": 0.1,
@ -126,6 +135,7 @@
"topic": "output",
"field": "max_v"
},
"tip": "The maximum voltage (in both directions) across the output pins",
"lock": false
}
]
@ -136,6 +146,7 @@
"name": "Thermistor Config",
"expanded": true,
"type": "group",
"tip": "Settings of the connected thermistor\n- Parameters for the resistance to temperature conversion (with the B-Parameter equation)\n- Settings for the 50/60 Hz filter with the thermistor",
"children": [
{
"name": "T₀",
@ -152,6 +163,7 @@
"topic": "b-p",
"field": "t0"
},
"tip": "The base temperature",
"lock": false
},
{
@ -166,6 +178,7 @@
"topic": "b-p",
"field": "r0"
},
"tip": "The resistance of the thermistor at base temperature T₀",
"lock": false
},
{
@ -180,10 +193,11 @@
"topic": "b-p",
"field": "b"
},
"tip": "The Beta Parameter",
"lock": false
},
{
"name": "Postfilter Rate",
"name": "50/60 Hz Rejection Filter",
"type": "list",
"value": 16.67,
"thermostat:set_param": {
@ -191,12 +205,13 @@
"field": "rate"
},
"limits": {
"Off": null,
"16.667 Hz": 16.667,
"20 Hz": 20.0,
"25 Hz": 25,
"27.27 Hz": 27.27
"16.667 SPS": 16.667,
"20 SPS": 20.0,
"25 SPS": 25,
"27.27 SPS": 27.27,
"Off": null
},
"tip": "Adjust the output data rate of the enhanced 50 Hz & 60 Hz rejection filter\n(Helps avoid mains interference)",
"lock": false
}
]
@ -205,6 +220,7 @@
"name": "PID Config",
"expanded": true,
"type": "group",
"tip": "Settings of PID parameters and clamping",
"children": [
{
"name": "Kp",
@ -216,6 +232,7 @@
"topic": "pid",
"field": "kp"
},
"tip": "Proportional gain",
"lock": false
},
{
@ -228,6 +245,7 @@
"topic": "pid",
"field": "ki"
},
"tip": "Integral gain",
"lock": false
},
{
@ -240,12 +258,14 @@
"topic": "pid",
"field": "kd"
},
"tip": "Differential gain",
"lock": false
},
{
"name": "PID Output Clamping",
"expanded": true,
"type": "group",
"tip": "Clamps PID outputs to specified range\nCould be different than output limits",
"children": [
{
"name": "Minimum",
@ -262,6 +282,7 @@
"topic": "pid",
"field": "output_min"
},
"tip": "Minimum PID output",
"lock": false
},
{
@ -279,6 +300,7 @@
"topic": "pid",
"field": "output_max"
},
"tip": "Maximum PID output",
"lock": false
}
]
@ -287,6 +309,7 @@
"name": "PID Auto Tune",
"expanded": false,
"type": "group",
"tip": "Automatically tune PID parameters",
"children": [
{
"name": "Target Temperature",
@ -295,7 +318,8 @@
"step": 0.1,
"format": "{value:.4f} °C",
"compactHeight": false,
"pid_autotune": "target_temp"
"pid_autotune": "target_temp",
"tip": "The target temperature to autotune for"
},
{
"name": "Test Current",
@ -309,7 +333,8 @@
],
"suffix": "mA",
"compactHeight": false,
"pid_autotune": "test_current"
"pid_autotune": "test_current",
"tip": "The testing current when autotuning"
},
{
"name": "Temperature Swing",
@ -319,7 +344,8 @@
"prefix": "±",
"format": "{value:.4f} °C",
"compactHeight": false,
"pid_autotune": "temp_swing"
"pid_autotune": "temp_swing",
"tip": "The temperature swing around the target"
},
{
"name": "Lookback",
@ -328,12 +354,13 @@
"step": 0.1,
"format": "{value:.4f} s",
"compactHeight": false,
"pid_autotune": "lookback"
"pid_autotune": "lookback",
"tip": "Amount of time referenced for tuning"
},
{
"name": "Run",
"type": "action",
"tip": "Run"
"tip": "Run PID Autotune with above settings"
}
]
}
@ -347,7 +374,7 @@
{
"name": "Load from flash",
"type": "action",
"tip": "Load config from flash"
"tip": "Load config from thermostat"
}
]
}

View File

@ -30,7 +30,7 @@ class ZeroLimitsWarningView(QObject):
if "max_v" in zeroed_limits:
if channel_disabled[ch]:
report_str += ", "
report_str += "Max Voltage Difference"
report_str += "Max Absolute Voltage"
channel_disabled[ch] = True
if channel_disabled[ch]: