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
|
numtemps = 25
|
||||||
maxadc = 1023
|
maxadc = 1023
|
||||||
minadc = 0
|
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
|
import wx
|
||||||
from configtool.data import (pinNames, BSIZESMALL, sensorTypes, offsetTcLabel,
|
from configtool.data import (pinNames, BSIZESMALL, sensorTypes, offsetTcLabel,
|
||||||
offsetChLabel, reInteger, reFloat)
|
offsetChLabel, reInteger, reFloat)
|
||||||
|
from configtool.thermistorpresets import thermistorPresets
|
||||||
|
|
||||||
MODE_NONTHERM = 0
|
MODE_NONTHERM = 0
|
||||||
MODE_THERMISTOR = 1
|
MODE_THERMISTOR = 1
|
||||||
|
|
@ -27,7 +28,6 @@ class AddSensorDlg(wx.Dialog):
|
||||||
self.names = names
|
self.names = names
|
||||||
self.choices = pins
|
self.choices = pins
|
||||||
self.modify = modify
|
self.modify = modify
|
||||||
self.presets = parent.thermistorpresets
|
|
||||||
|
|
||||||
if len(params) == 0:
|
if len(params) == 0:
|
||||||
self.currentMethod = METHOD_BETA
|
self.currentMethod = METHOD_BETA
|
||||||
|
|
@ -245,7 +245,7 @@ class AddSensorDlg(wx.Dialog):
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
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 = wx.Choice(self, wx.ID_ANY, choices = choices)
|
||||||
ch.SetFont(font)
|
ch.SetFont(font)
|
||||||
ch.Enable(False)
|
ch.Enable(False)
|
||||||
|
|
@ -621,14 +621,14 @@ class AddSensorDlg(wx.Dialog):
|
||||||
s = ch.GetSelection()
|
s = ch.GetSelection()
|
||||||
label = ch.GetString(s)
|
label = ch.GetString(s)
|
||||||
if s != 0:
|
if s != 0:
|
||||||
self.param0.SetValue(self.presets[label][0])
|
self.param0.SetValue(thermistorPresets[label][0])
|
||||||
self.param1.SetValue(self.presets[label][1])
|
self.param1.SetValue(thermistorPresets[label][1])
|
||||||
self.param2.SetValue(self.presets[label][2])
|
self.param2.SetValue(thermistorPresets[label][2])
|
||||||
self.param3.SetValue(self.presets[label][3])
|
self.param3.SetValue(thermistorPresets[label][3])
|
||||||
if len(self.presets[label]) == 7:
|
if len(thermistorPresets[label]) == 7:
|
||||||
self.param4.SetValue(self.presets[label][4])
|
self.param4.SetValue(thermistorPresets[label][4])
|
||||||
self.param5.SetValue(self.presets[label][5])
|
self.param5.SetValue(thermistorPresets[label][5])
|
||||||
self.param6.SetValue(self.presets[label][5])
|
self.param6.SetValue(thermistorPresets[label][5])
|
||||||
self.currentMethod = METHOD_SH
|
self.currentMethod = METHOD_SH
|
||||||
else:
|
else:
|
||||||
self.currentMethod = METHOD_BETA
|
self.currentMethod = METHOD_BETA
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,7 @@ class BoardPanel(wx.Panel):
|
||||||
self.pageValid.append(True)
|
self.pageValid.append(True)
|
||||||
|
|
||||||
self.pgSensors = SensorsPage(self, self.nb, len(self.pages),
|
self.pgSensors = SensorsPage(self, self.nb, len(self.pages),
|
||||||
self.settings.font,
|
self.settings.font)
|
||||||
self.settings.thermistorpresets)
|
|
||||||
text = "Temperature Sensors"
|
text = "Temperature Sensors"
|
||||||
self.nb.AddPage(self.pgSensors, text)
|
self.nb.AddPage(self.pgSensors, text)
|
||||||
self.pages.append(self.pgSensors)
|
self.pages.append(self.pgSensors)
|
||||||
|
|
@ -200,7 +199,6 @@ class BoardPanel(wx.Panel):
|
||||||
if path is None:
|
if path is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
self.dir = os.path.dirname(path)
|
self.dir = os.path.dirname(path)
|
||||||
rc = self.loadConfigFile(path)
|
rc = self.loadConfigFile(path)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,11 @@ from addsensordlg import AddSensorDlg
|
||||||
|
|
||||||
|
|
||||||
class SensorsPage(wx.Panel, Page):
|
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)
|
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||||
Page.__init__(self, font)
|
Page.__init__(self, font)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.font = font
|
self.font = font
|
||||||
self.thermistorpresets = thermistorpresets
|
|
||||||
self.id = idPg
|
self.id = idPg
|
||||||
|
|
||||||
self.sensorTypeKeys = {'TT_MAX6675': 'TEMP_MAX6675',
|
self.sensorTypeKeys = {'TT_MAX6675': 'TEMP_MAX6675',
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ class Settings:
|
||||||
self.maxAdc = 1023
|
self.maxAdc = 1023
|
||||||
self.minAdc = 1
|
self.minAdc = 1
|
||||||
|
|
||||||
self.thermistorpresets = {}
|
|
||||||
|
|
||||||
self.cfg = ConfigParser.ConfigParser()
|
self.cfg = ConfigParser.ConfigParser()
|
||||||
self.cfg.optionxform = str
|
self.cfg.optionxform = str
|
||||||
|
|
||||||
|
|
@ -72,16 +70,6 @@ class Settings:
|
||||||
else:
|
else:
|
||||||
print "Missing %s section - assuming defaults." % self.section
|
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):
|
def saveSettings(self):
|
||||||
self.section = "configtool"
|
self.section = "configtool"
|
||||||
try:
|
try:
|
||||||
|
|
@ -102,15 +90,6 @@ class Settings:
|
||||||
self.cfg.set(self.section, "minadc", str(self.minAdc))
|
self.cfg.set(self.section, "minadc", str(self.minAdc))
|
||||||
self.cfg.set(self.section, "uploadspeed", str(self.uploadspeed))
|
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:
|
try:
|
||||||
cfp = open(self.inifile, 'wb')
|
cfp = open(self.inifile, 'wb')
|
||||||
except:
|
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