Configtool: move thermistor presets into distribution file.
The problem was, that settings distributed in configtool.default.ini were overridden once a configtool.ini was created. Accordingly, users upgrading sources wouldn't see changes in this file. The solution is to move settings set by the distribution into a separate file which isn't replaced by a user-saved one. This should fix issue #142.
This commit is contained in:
parent
9a10e70e36
commit
e1277e4f4a
|
|
@ -46,23 +46,3 @@ r1 = 0
|
|||
numtemps = 25
|
||||
maxadc = 1023
|
||||
minadc = 0
|
||||
|
||||
|
||||
# Define thermistor presets. These can either be defined to use the
|
||||
# beta argorithm by specifying 4 parameters:
|
||||
# R0, beta, Rp, Vadc
|
||||
#
|
||||
# or to use the Steinhart-Hart algorithm by specifying 7 parameters:
|
||||
# Rp, T0, R0, T1, R1, T2, R2
|
||||
#
|
||||
# TODO: this should be moved into a file which isn't overridden by a local
|
||||
# file (here: configtool.ini). Similar to config/protectedfiles.py.
|
||||
[thermistors]
|
||||
EPCOS 100K (B5754061104) = 100000, 4066, 4700, 5.0
|
||||
EPCOS 100K (B57560G1104F) = 100000, 4092, 4700, 5.0
|
||||
EPCOS 100K (B57560G104F) = 100000, 4036, 4700, 5.0
|
||||
RRRF 100K = 100000, 3960, 4700, 5.0
|
||||
RRRF 10K = 10000, 3964, 1600, 5.0
|
||||
RS 10K = 10000, 3480, 1600, 5.0
|
||||
Honeywell 100K = 100000, 3974, 4700, 5.0
|
||||
ATC Semitec 104GT-2 = 100000, 4267, 4700, 5.0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import wx
|
||||
from configtool.data import (pinNames, BSIZESMALL, sensorTypes, offsetTcLabel,
|
||||
offsetChLabel, reInteger, reFloat)
|
||||
from configtool.thermistorpresets import thermistorPresets
|
||||
|
||||
MODE_NONTHERM = 0
|
||||
MODE_THERMISTOR = 1
|
||||
|
|
@ -27,7 +28,6 @@ class AddSensorDlg(wx.Dialog):
|
|||
self.names = names
|
||||
self.choices = pins
|
||||
self.modify = modify
|
||||
self.presets = parent.thermistorpresets
|
||||
|
||||
if len(params) == 0:
|
||||
self.currentMethod = METHOD_BETA
|
||||
|
|
@ -245,7 +245,7 @@ class AddSensorDlg(wx.Dialog):
|
|||
st.SetFont(font)
|
||||
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||
|
||||
choices = ["<none>"] + sorted(self.presets.keys())
|
||||
choices = ["<none>"] + sorted(thermistorPresets.keys())
|
||||
ch = wx.Choice(self, wx.ID_ANY, choices = choices)
|
||||
ch.SetFont(font)
|
||||
ch.Enable(False)
|
||||
|
|
@ -621,14 +621,14 @@ class AddSensorDlg(wx.Dialog):
|
|||
s = ch.GetSelection()
|
||||
label = ch.GetString(s)
|
||||
if s != 0:
|
||||
self.param0.SetValue(self.presets[label][0])
|
||||
self.param1.SetValue(self.presets[label][1])
|
||||
self.param2.SetValue(self.presets[label][2])
|
||||
self.param3.SetValue(self.presets[label][3])
|
||||
if len(self.presets[label]) == 7:
|
||||
self.param4.SetValue(self.presets[label][4])
|
||||
self.param5.SetValue(self.presets[label][5])
|
||||
self.param6.SetValue(self.presets[label][5])
|
||||
self.param0.SetValue(thermistorPresets[label][0])
|
||||
self.param1.SetValue(thermistorPresets[label][1])
|
||||
self.param2.SetValue(thermistorPresets[label][2])
|
||||
self.param3.SetValue(thermistorPresets[label][3])
|
||||
if len(thermistorPresets[label]) == 7:
|
||||
self.param4.SetValue(thermistorPresets[label][4])
|
||||
self.param5.SetValue(thermistorPresets[label][5])
|
||||
self.param6.SetValue(thermistorPresets[label][5])
|
||||
self.currentMethod = METHOD_SH
|
||||
else:
|
||||
self.currentMethod = METHOD_BETA
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ class BoardPanel(wx.Panel):
|
|||
self.pageValid.append(True)
|
||||
|
||||
self.pgSensors = SensorsPage(self, self.nb, len(self.pages),
|
||||
self.settings.font,
|
||||
self.settings.thermistorpresets)
|
||||
self.settings.font)
|
||||
text = "Temperature Sensors"
|
||||
self.nb.AddPage(self.pgSensors, text)
|
||||
self.pages.append(self.pgSensors)
|
||||
|
|
@ -200,7 +199,6 @@ class BoardPanel(wx.Panel):
|
|||
if path is None:
|
||||
return
|
||||
|
||||
|
||||
self.dir = os.path.dirname(path)
|
||||
rc = self.loadConfigFile(path)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@ from addsensordlg import AddSensorDlg
|
|||
|
||||
|
||||
class SensorsPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg, font, thermistorpresets):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.font = font
|
||||
self.thermistorpresets = thermistorpresets
|
||||
self.id = idPg
|
||||
|
||||
self.sensorTypeKeys = {'TT_MAX6675': 'TEMP_MAX6675',
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ class Settings:
|
|||
self.maxAdc = 1023
|
||||
self.minAdc = 1
|
||||
|
||||
self.thermistorpresets = {}
|
||||
|
||||
self.cfg = ConfigParser.ConfigParser()
|
||||
self.cfg.optionxform = str
|
||||
|
||||
|
|
@ -72,16 +70,6 @@ class Settings:
|
|||
else:
|
||||
print "Missing %s section - assuming defaults." % self.section
|
||||
|
||||
section = "thermistors"
|
||||
if self.cfg.has_section(section):
|
||||
for opt, value in self.cfg.items(section):
|
||||
value = value.strip().replace(" ", "")
|
||||
vl = value.split(",")
|
||||
if len(vl) != 4 and len(vl) != 7:
|
||||
print "Invalid entry for thermistor %s." % opt
|
||||
else:
|
||||
self.thermistorpresets[opt] = vl
|
||||
|
||||
def saveSettings(self):
|
||||
self.section = "configtool"
|
||||
try:
|
||||
|
|
@ -102,15 +90,6 @@ class Settings:
|
|||
self.cfg.set(self.section, "minadc", str(self.minAdc))
|
||||
self.cfg.set(self.section, "uploadspeed", str(self.uploadspeed))
|
||||
|
||||
section = "thermistors"
|
||||
try:
|
||||
self.cfg.add_section(section)
|
||||
except ConfigParser.DuplicateSectionError:
|
||||
pass
|
||||
|
||||
for t in self.thermistorpresets.keys():
|
||||
self.cfg.set(section, t, ", ".join(self.thermistorpresets[t]))
|
||||
|
||||
try:
|
||||
cfp = open(self.inifile, 'wb')
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
# Define thermistor presets. These can either be defined to use the
|
||||
# beta argorithm by specifying 4 parameters:
|
||||
# R0, beta, Rp, Vadc
|
||||
#
|
||||
# or to use the Steinhart-Hart algorithm by specifying 7 parameters:
|
||||
# Rp, T0, R0, T1, R1, T2, R2
|
||||
#
|
||||
thermistorPresets = {
|
||||
"RS 10K": ['10000', '3480', '1600', '5.0'],
|
||||
"RRRF 10K": ['10000', '3964', '1600', '5.0'],
|
||||
"ATC Semitec 104GT-2": ['100000', '4267', '4700', '5.0'],
|
||||
"EPCOS 100K (B57560G1104F)": ['100000', '4092', '4700', '5.0'],
|
||||
"EPCOS 100K (B5754061104)": ['100000', '4066', '4700', '5.0'],
|
||||
"EPCOS 100K (B57560G104F)": ['100000', '4036', '4700', '5.0'],
|
||||
"Honeywell 100K": ['100000', '3974', '4700', '5.0'],
|
||||
"RRRF 100K": ['100000', '3960', '4700', '5.0'],
|
||||
}
|
||||
Loading…
Reference in New Issue