Simply test for connectivity for turning PID off

This commit is contained in:
atse 2024-08-28 13:37:49 +08:00
parent 226ec3b068
commit 78379ddacc
2 changed files with 3 additions and 6 deletions

View File

@ -44,7 +44,8 @@ class PIDAutoTuner(QObject):
async def stop_pid_from_running(self, ch):
self.autotuners[ch].setOff()
self.autotune_state_changed.emit(ch, self.autotuners[ch].state())
await self._thermostat.set_param("pwm", ch, "i_set", 0)
if self._thermostat.connected():
await self._thermostat.set_param("pwm", ch, "i_set", 0)
@asyncSlot(list)
async def tick(self, report):

View File

@ -152,11 +152,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.report_box.setChecked(False)
for ch in range(self.NUM_CHANNELS):
if self.autotuners.get_state(ch) != PIDAutotuneState.STATE_OFF:
if self.thermostat.connection_errored:
# Don't send any commands, just reset local state
self.autotuners.autotuners[ch].setOff()
else:
await self.autotuners.stop_pid_from_running(ch)
await self.autotuners.stop_pid_from_running(ch)
@asyncSlot(int)
async def on_report_box_stateChanged(self, enabled):