From feb57c3eb0a104c4c09f868d4cb7f61d7792f407 Mon Sep 17 00:00:00 2001 From: jbernardis Date: Tue, 21 Jul 2015 20:50:13 -0400 Subject: [PATCH] Configtool: Steinhart-Hart temperature fields should allow floats. This is, the parameter entry fields in the GUI, not in the generated temperature table. Allowing floats is a tiny bit more precise and also, more importantly, less confusing for the user. --Traumflug This is related to issue #176. --- configtool/addsensordlg.py | 12 ++++++------ configtool/thermistortablefile.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configtool/addsensordlg.py b/configtool/addsensordlg.py index f51f256..187bb85 100644 --- a/configtool/addsensordlg.py +++ b/configtool/addsensordlg.py @@ -410,7 +410,10 @@ class AddSensorDlg(wx.Dialog): def onParam1Entry(self, evt): if self.currentMode == MODE_THERMISTOR: - self.param1Valid = self.onTextCtrlInteger(self.param1, True) + if self.currentMethod == METHOD_BETA: + self.param1Valid = self.onTextCtrlInteger(self.param1, True) + else: + self.param1Valid = self.onTextCtrlFloat(self.param1, True) self.checkValuesForPreset() else: self.param1Valid = True @@ -432,10 +435,7 @@ class AddSensorDlg(wx.Dialog): def onParam3Entry(self, evt): if self.currentMode == MODE_THERMISTOR: - if self.currentMethod == METHOD_BETA: - self.param3Valid = self.onTextCtrlFloat(self.param3, True) - else: - self.param3Valid = self.onTextCtrlInteger(self.param3, True) + self.param3Valid = self.onTextCtrlFloat(self.param3, True) self.checkValuesForPreset() else: self.param3Valid = True @@ -463,7 +463,7 @@ class AddSensorDlg(wx.Dialog): if self.currentMethod == METHOD_BETA: self.param5Valid = True else: - self.param5Valid = self.onTextCtrlInteger(self.param5, True) + self.param5Valid = self.onTextCtrlFloat(self.param5, True) self.checkValuesForPreset() else: self.param5Valid = True diff --git a/configtool/thermistortablefile.py b/configtool/thermistortablefile.py index 81b6afc..b549bf2 100644 --- a/configtool/thermistortablefile.py +++ b/configtool/thermistortablefile.py @@ -131,8 +131,8 @@ def SteinhartHartTable(ofp, params, names, idx, settings, finalTable): params[6])) ofp.output(" {") - thrm = SHThermistor(int(params[0]), int(params[1]), int(params[2]), - int(params[3]), int(params[4]), int(params[5]), + thrm = SHThermistor(int(params[0]), float(params[1]), int(params[2]), + float(params[3]), int(params[4]), float(params[5]), int(params[6])) for t in idx: