From c52cdceec54ed04fe6bd59d3d80e0730a758e5e9 Mon Sep 17 00:00:00 2001 From: topquark12 Date: Mon, 6 Jun 2022 21:28:30 +0800 Subject: [PATCH] fix docs, fix i_set, fix GUI param ranges --- README.md | 2 +- pytec/tecQT.py | 10 +++++----- src/channels.rs | 7 ++++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 10d2fc7..6c3f705 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ postfilter rate can be tuned with the `postfilter` command. - Connect TEC module device 1 to TEC1- and TEC1+. - The GND pin is for shielding not for sinking TEC module currents. -When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to heat up with a positive software current set point, and cool down with a negative current set point. +When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to cool down with a positive software current set point, and heat up with a negative current set point. Testing heat flow direction with a low set current is recommended before installation of the TEC module. diff --git a/pytec/tecQT.py b/pytec/tecQT.py index 45e5c3e..c267d6a 100644 --- a/pytec/tecQT.py +++ b/pytec/tecQT.py @@ -39,17 +39,17 @@ TECparams = [ [ GUIparams = [[ {'name': 'Disable Output', 'type': 'action', 'tip': 'Disable Output'}, {'name': 'Constant Current', 'type': 'group', 'children': [ - {'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 0.1, 'siPrefix': True, 'suffix': 'A'}, + {'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (-3, 3), 'siPrefix': True, 'suffix': 'A'}, ]}, {'name': 'Temperature PID', 'type': 'bool', 'value': False, 'children': [ - {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'siPrefix': True, 'suffix': 'C'}, + {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300), 'siPrefix': True, 'suffix': 'C'}, ]}, {'name': 'Output Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'Max Current', 'type': 'float', 'value': 0, 'step': 0.1, 'siPrefix': True, 'suffix': 'A'}, - {'name': 'Max Voltage', 'type': 'float', 'value': 0, 'step': 0.1, 'siPrefix': True, 'suffix': 'V'}, + {'name': 'Max Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 3), 'siPrefix': True, 'suffix': 'A'}, + {'name': 'Max Voltage', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 5), 'siPrefix': True, 'suffix': 'V'}, ]}, {'name': 'Thermistor Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'T0', 'type': 'float', 'value': 25, 'step': 0.1, 'siPrefix': True, 'suffix': 'C'}, + {'name': 'T0', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-100, 100), 'siPrefix': True, 'suffix': 'C'}, {'name': 'R0', 'type': 'float', 'value': 10000, 'step': 1, 'siPrefix': True, 'suffix': 'Ohm'}, {'name': 'Beta', 'type': 'float', 'value': 3950, 'step': 1}, ]}, diff --git a/src/channels.rs b/src/channels.rs index 7aa34e9..c26a0e2 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -113,7 +113,12 @@ impl Channels { } pub fn get_i(&mut self, channel: usize) -> ElectricCurrent { - let center_point = self.get_center(channel); + let center_point = match channel.into() { + 0 => self.channel0.vref_meas, + 1 => self.channel1.vref_meas, + _ => unreachable!(), + }; + // let center_point = self.get_center(channel); let r_sense = ElectricalResistance::new::(R_SENSE); let voltage = self.get_dac(channel); let i_tec = (voltage - center_point) / (10.0 * r_sense);