forked from M-Labs/thermostat
Add thermistor config & sync
Note: The formula is not actually Steinhart-Hart
This commit is contained in:
parent
49c5120600
commit
8291b2052f
|
@ -79,6 +79,7 @@ class ClientWatcher(QObject):
|
|||
pwm_update = pyqtSignal(list)
|
||||
report_update = pyqtSignal(list)
|
||||
pid_update = pyqtSignal(list)
|
||||
thermistor_update = pyqtSignal(list)
|
||||
|
||||
def __init__(self, parent, client, update_s):
|
||||
self.update_s = update_s
|
||||
|
@ -98,6 +99,7 @@ class ClientWatcher(QObject):
|
|||
self.pwm_update.emit(await self.client.get_pwm())
|
||||
self.report_update.emit(await self.client._command("report"))
|
||||
self.pid_update.emit(await self.client.get_pid())
|
||||
self.thermistor_update.emit(await self.client.get_steinhart_hart())
|
||||
|
||||
def start_watching(self):
|
||||
self.watch_task = asyncio.create_task(self.run())
|
||||
|
@ -136,6 +138,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.client_watcher.fan_update.connect(self.fan_update)
|
||||
self.client_watcher.report_update.connect(self.update_report)
|
||||
self.client_watcher.pid_update.connect(self.update_pid)
|
||||
self.client_watcher.thermistor_update.connect(self.update_thermistor)
|
||||
self.report_apply_btn.clicked.connect(
|
||||
lambda: self.client_watcher.set_update_s(self.report_refresh_spin.value())
|
||||
)
|
||||
|
@ -290,6 +293,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
with QSignalBlocker(params[channel]):
|
||||
params[channel].child("Temperature PID").setValue(settings["pid_engaged"])
|
||||
|
||||
@pyqtSlot(list)
|
||||
def update_thermistor(self, sh_data):
|
||||
for sh_param in sh_data:
|
||||
channel = sh_param["channel"]
|
||||
with QSignalBlocker(params[channel]):
|
||||
params[channel].child("Thermistor Config", "T₀").setValue(sh_param["params"]["t0"] - 273.15)
|
||||
params[channel].child("Thermistor Config", "R₀").setValue(sh_param["params"]["r0"])
|
||||
params[channel].child("Thermistor Config", "β").setValue(sh_param["params"]["b"])
|
||||
|
||||
|
||||
async def coro_main():
|
||||
args = get_argparser().parse_args()
|
||||
|
|
Loading…
Reference in New Issue