Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Configtool: DEFINE_TEMP_SENSOR always wants four paramters.
Browse files Browse the repository at this point in the history
Compilation with something else than a thermistor still doesn't
work, because temp.c insists on a thermistor table, but we're a
step closer.
  • Loading branch information
Traumflug committed Apr 21, 2015
1 parent 29dd85a commit 8408d8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
16 changes: 3 additions & 13 deletions configtool/addsensordlg.py
Expand Up @@ -84,7 +84,6 @@ def __init__(self, parent, names, pins, font):
self.tcAddtl = wx.TextCtrl(self, wx.ID_ANY, "")
self.tcAddtl.SetFont(font)
self.tcAddtl.Bind(wx.EVT_TEXT, self.onAddtlEntry)
self.selectSensorType(sl[0])
lsz.Add(self.tcAddtl)
self.tcAddtl.SetToolTipString("Enter additional information required "
"by the sensor type.")
Expand Down Expand Up @@ -146,12 +145,6 @@ def checkDlgValidity(self):
def onAddtlEntry(self, evt):
evt.Skip()

def selectSensorType(self, lbl):
if lbl == 'Thermistor':
self.tcAddtl.Enable(True);
else:
self.tcAddtl.Enable(False);

def onChoice(self, evt):
pass

Expand All @@ -160,8 +153,6 @@ def onSensorType(self, evt):
s = ch.GetSelection()
label = ch.GetString(s)

self.selectSensorType(label)

evt.Skip()

def getValues(self):
Expand All @@ -170,11 +161,10 @@ def getValues(self):
addtl = self.tcAddtl.GetValue()
stype = self.chType.GetString(self.chType.GetSelection())

if stype in ['Thermistor']:
return (nm, sensorTypes[stype], pin, addtl)
else:
return (nm, sensorTypes[stype], pin)
if stype not in ['Thermistor']:
addtl = "NONE"

return (nm, sensorTypes[stype], pin, addtl)

def onSave(self, evt):
self.EndModal(wx.ID_OK)
Expand Down
16 changes: 4 additions & 12 deletions configtool/boardpanel.py
Expand Up @@ -11,7 +11,7 @@
reCandProcessors, reCandCPUClocks, reFloatAttr,
reDefine, reDefineBL, reDefQS, reDefQSm,
reDefQSm2, reDefBool, reDefBoolBL, reDefHT,
reDefTS, reHeater, reSensor3, reSensor4)
reDefTS, reSensor, reHeater)
from configtool.pinoutspage import PinoutsPage
from configtool.sensorpage import SensorsPage
from configtool.heaterspage import HeatersPage
Expand Down Expand Up @@ -369,16 +369,11 @@ def loadConfigFile(self, fn):
return True

def parseSensor(self, s):
m = reSensor4.search(s)
m = reSensor.search(s)
if m:
t = m.groups()
if len(t) == 4:
return t
m = reSensor3.search(s)
if m:
t = m.groups()
if len(t) == 3:
return t
return None

def parseHeater(self, s):
Expand Down Expand Up @@ -464,11 +459,8 @@ def saveConfigFile(self, path):
fp.write("// name type pin "
"additional\n");
for s in self.sensors:
sstr = "%-10s%-15s" % ((s[0] + ","), (s[1] + ","))
if len(s) == 3:
sstr += "%s" % (s[2])
else: # len(s) == 4
sstr += "%-7s%s" % ((s[2] + ","), s[3])
sstr = "%-10s%-15s%-7s%s" % ((s[0] + ","), (s[1] + ","),
(s[2] + ","), s[3])
fp.write("DEFINE_TEMP_SENSOR(%s)\n" % sstr)
skipToSensorEnd = True
continue
Expand Down
3 changes: 1 addition & 2 deletions configtool/data.py
Expand Up @@ -54,8 +54,7 @@
reHelpTextStart = re.compile("^\s*/\*\*\s+\\\\def\s+(.*)")
reHelpTextEnd = re.compile("^\s*\*/")

reSensor3 = re.compile(".*\\(\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*\\)")
reSensor4 = re.compile(".*\\(\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*\\)")
reSensor = re.compile(".*\\(\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*\\)")
reHeater = re.compile(".*\\(\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*\\)")

reInteger = re.compile("^\d+U?L?$")
Expand Down

0 comments on commit 8408d8c

Please sign in to comment.