From 6aef143e3edd56f76110f08c9a1f0af5796803de Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 6 Jan 2025 18:00:34 +0800 Subject: [PATCH] PyThermostat: Remove tec terminology The client controls the Thermostat as a whole and not just a TEC attached to it; adjust variable names accordingly. --- pythermostat/example.py | 16 ++++++++-------- pythermostat/pythermostat/autotune.py | 10 +++++----- pythermostat/pythermostat/client.py | 10 +++++----- pythermostat/pythermostat/plot.py | 10 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pythermostat/example.py b/pythermostat/example.py index 8f59afe..2cfd7b9 100644 --- a/pythermostat/example.py +++ b/pythermostat/example.py @@ -1,13 +1,13 @@ import time from pythermostat.client import Client -tec = Client() #(host="localhost", port=6667) -tec.set_param("b-p", 1, "t0", 20) -print(tec.get_output()) -print(tec.get_pid()) -print(tec.get_output()) -print(tec.get_postfilter()) -print(tec.get_b_parameter()) +thermostat = Client() #(host="localhost", port=6667) +thermostat.set_param("b-p", 1, "t0", 20) +print(thermostat.get_output()) +print(thermostat.get_pid()) +print(thermostat.get_output()) +print(thermostat.get_postfilter()) +print(thermostat.get_b_parameter()) while True: - print(tec.get_report()) + print(thermostat.get_report()) time.sleep(0.05) diff --git a/pythermostat/pythermostat/autotune.py b/pythermostat/pythermostat/autotune.py index dada469..0cd45a4 100644 --- a/pythermostat/pythermostat/autotune.py +++ b/pythermostat/pythermostat/autotune.py @@ -235,16 +235,16 @@ def main(): # logging.basicConfig(level=logging.DEBUG) - tec = Client() + thermostat = Client() - data = tec.get_report() + data = thermostat.get_report() ch = data[channel] tuner = PIDAutotune(target_temperature, output_step, lookback, noiseband, ch['interval']) while True: - data = tec.get_report() + data = thermostat.get_report() ch = data[channel] @@ -255,11 +255,11 @@ def main(): tuner_out = tuner.output() - tec.set_param("output", channel, "i_set", tuner_out) + thermostat.set_param("output", channel, "i_set", tuner_out) time.sleep(0.05) - tec.set_param("output", channel, "i_set", 0) + thermostat.set_param("output", channel, "i_set", 0) if __name__ == "__main__": diff --git a/pythermostat/pythermostat/client.py b/pythermostat/pythermostat/client.py index 60a6b96..c1ad40f 100644 --- a/pythermostat/pythermostat/client.py +++ b/pythermostat/pythermostat/client.py @@ -151,11 +151,11 @@ class Client: """Set configuration parameters Examples:: - tec.set_param("output", 0, "max_v", 2.0) - tec.set_param("pid", 1, "output_max", 2.5) - tec.set_param("b-p", 0, "t0", 20.0) - tec.set_param("center", 0, "vref") - tec.set_param("postfilter", 1, 21) + thermostat.set_param("output", 0, "max_v", 2.0) + thermostat.set_param("pid", 1, "output_max", 2.5) + thermostat.set_param("b-p", 0, "t0", 20.0) + thermostat.set_param("center", 0, "vref") + thermostat.set_param("postfilter", 1, 21) See the firmware's README.md for a full list. """ diff --git a/pythermostat/pythermostat/plot.py b/pythermostat/pythermostat/plot.py index ab09284..794806f 100644 --- a/pythermostat/pythermostat/plot.py +++ b/pythermostat/pythermostat/plot.py @@ -9,8 +9,8 @@ from pythermostat.client import Client def main(): TIME_WINDOW = 300.0 - tec = Client() - target_temperature = tec.get_pid()[0]['target'] + thermostat = Client() + target_temperature = thermostat.get_pid()[0]['target'] print("Channel 0 target temperature: {:.3f}".format(target_temperature)) class Series: @@ -48,10 +48,10 @@ def main(): quit = False - def recv_data(tec): + def recv_data(thermostat): global last_packet_time while True: - data = tec.get_report() + data = thermostat.get_report() ch0 = data[0] series_lock.acquire() try: @@ -67,7 +67,7 @@ def main(): break time.sleep(0.05) - thread = Thread(target=recv_data, args=(tec,)) + thread = Thread(target=recv_data, args=(thermostat,)) thread.start() fig, ax = plt.subplots()