More sensible names

This commit is contained in:
atse 2024-09-09 12:03:19 +08:00
parent 938d92ce02
commit 2b33d1f75a

View File

@ -61,10 +61,14 @@ class MainWindow(QtWidgets.QMainWindow):
# Models # Models
self._thermostat = Thermostat(self, self.report_refresh_spin.value()) self._thermostat = Thermostat(self, self.report_refresh_spin.value())
self._connecting_task = None self._connecting_task = None
self._thermostat.connection_state_update.connect(self._on_connection_changed) self._thermostat.connection_state_update.connect(
self._on_connection_state_changed
)
self._autotuners = PIDAutoTuner(self, self._thermostat, 2) self._autotuners = PIDAutoTuner(self, self._thermostat, 2)
self._autotuners.autotune_state_changed.connect(self._pid_autotune_handler) self._autotuners.autotune_state_changed.connect(
self._on_pid_autotune_state_changed
)
# Handlers for disconnections # Handlers for disconnections
async def autotune_disconnect(): async def autotune_disconnect():
@ -133,7 +137,7 @@ class MainWindow(QtWidgets.QMainWindow):
pass pass
@pyqtSlot(ThermostatConnectionState) @pyqtSlot(ThermostatConnectionState)
def _on_connection_changed(self, state): def _on_connection_state_changed(self, state):
self.graph_group.setEnabled(state == ThermostatConnectionState.CONNECTED) self.graph_group.setEnabled(state == ThermostatConnectionState.CONNECTED)
self.thermostat_settings.setEnabled( self.thermostat_settings.setEnabled(
state == ThermostatConnectionState.CONNECTED state == ThermostatConnectionState.CONNECTED
@ -159,7 +163,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.report_box.setChecked(False) self.report_box.setChecked(False)
@pyqtSlot(int, PIDAutotuneState) @pyqtSlot(int, PIDAutotuneState)
def _pid_autotune_handler(self, _ch, _state): def _on_pid_autotune_state_changed(self, _ch, _state):
ch_tuning = [] ch_tuning = []
for ch in range(self.NUM_CHANNELS): for ch in range(self.NUM_CHANNELS):
if self._autotuners.get_state(ch) in { if self._autotuners.get_state(ch) in {