forked from M-Labs/thermostat
Zero limits warning cleanup
This commit is contained in:
parent
f0e7488682
commit
66303efd11
@ -231,8 +231,6 @@ class CtrlPanel(QObject):
|
|||||||
|
|
||||||
@pyqtSlot("QVariantList")
|
@pyqtSlot("QVariantList")
|
||||||
def update_pwm(self, pwm_data):
|
def update_pwm(self, pwm_data):
|
||||||
channels_zeroed_limits = [set() for i in range(self.NUM_CHANNELS)]
|
|
||||||
|
|
||||||
for pwm_params in pwm_data:
|
for pwm_params in pwm_data:
|
||||||
channel = pwm_params["channel"]
|
channel = pwm_params["channel"]
|
||||||
with QSignalBlocker(self.params[channel]):
|
with QSignalBlocker(self.params[channel]):
|
||||||
@ -246,11 +244,6 @@ class CtrlPanel(QObject):
|
|||||||
"Output Config", "Limits", "Max Heating Current"
|
"Output Config", "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":
|
|
||||||
if pwm_params[limit]["value"] == 0.0:
|
|
||||||
channels_zeroed_limits[channel].add(limit)
|
|
||||||
self.set_zero_limits_warning_sig.emit(channels_zeroed_limits)
|
|
||||||
|
|
||||||
@pyqtSlot("QVariantList")
|
@pyqtSlot("QVariantList")
|
||||||
def update_postfilter(self, postfilter_data):
|
def update_postfilter(self, postfilter_data):
|
||||||
for postfilter_params in postfilter_data:
|
for postfilter_params in postfilter_data:
|
||||||
|
@ -3,15 +3,24 @@ from PyQt6 import QtWidgets, QtGui
|
|||||||
|
|
||||||
|
|
||||||
class ZeroLimitsWarningView(QObject):
|
class ZeroLimitsWarningView(QObject):
|
||||||
def __init__(self, style, limit_warning):
|
def __init__(self, thermostat, style, limit_warning):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self._thermostat = thermostat
|
||||||
|
self._thermostat.pwm_update.connect(self.set_limits_warning)
|
||||||
self._lbl = limit_warning
|
self._lbl = limit_warning
|
||||||
self._style = style
|
self._style = style
|
||||||
|
|
||||||
@pyqtSlot("QVariantList")
|
@pyqtSlot("QVariantList")
|
||||||
def set_limits_warning(self, channels_zeroed_limits: list):
|
def set_limits_warning(self, pwm_data: list):
|
||||||
channel_disabled = [False, False]
|
channels_zeroed_limits = [set() for i in range(self._thermostat.NUM_CHANNELS)]
|
||||||
|
|
||||||
|
for pwm_params in pwm_data:
|
||||||
|
channel = pwm_params["channel"]
|
||||||
|
for limit in "max_i_pos", "max_i_neg", "max_v":
|
||||||
|
if pwm_params[limit]["value"] == 0.0:
|
||||||
|
channels_zeroed_limits[channel].add(limit)
|
||||||
|
|
||||||
|
channel_disabled = [False, False]
|
||||||
report_str = "The following output limit(s) are set to zero:\n"
|
report_str = "The following output limit(s) are set to zero:\n"
|
||||||
for ch, zeroed_limits in enumerate(channels_zeroed_limits):
|
for ch, zeroed_limits in enumerate(channels_zeroed_limits):
|
||||||
if {"max_i_pos", "max_i_neg"}.issubset(zeroed_limits):
|
if {"max_i_pos", "max_i_neg"}.issubset(zeroed_limits):
|
||||||
|
@ -116,10 +116,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
# Status line
|
# Status line
|
||||||
self.zero_limits_warning = ZeroLimitsWarningView(
|
self.zero_limits_warning = ZeroLimitsWarningView(
|
||||||
self.style(), self.limits_warning
|
self.thermostat, self.style(), self.limits_warning
|
||||||
)
|
|
||||||
self.ctrl_panel_view.set_zero_limits_warning_sig.connect(
|
|
||||||
self.zero_limits_warning.set_limits_warning
|
|
||||||
)
|
)
|
||||||
self.loading_spinner.hide()
|
self.loading_spinner.hide()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user