Configtool: distiguish between bootloader and firmware baud rate.
This should solve issue #133.
This commit is contained in:
parent
f734b225eb
commit
ac8890b207
|
|
@ -37,6 +37,9 @@ programmer = stk500v2
|
|||
# The port through which the firmware will be uploaded - passed to avrdude.
|
||||
port = /dev/ttyACM0
|
||||
|
||||
# The baud rate with which to communicate with the bootloader.
|
||||
uploadspeed = 115200
|
||||
|
||||
# Parameters into the thermistor table generation process.
|
||||
t0 = 25
|
||||
r1 = 0
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ class ConfigFrame(wx.Frame):
|
|||
if not self.onSaveConfig(None):
|
||||
return
|
||||
|
||||
f_cpu, cpu, baud = self.pgBoard.getCPUInfo()
|
||||
f_cpu, cpu = self.pgBoard.getCPUInfo()
|
||||
if not cpu:
|
||||
dlg = wx.MessageDialog(self, "Unable to determine CPU type.",
|
||||
"CPU type error", wx.OK | wx.ICON_ERROR)
|
||||
|
|
@ -450,26 +450,13 @@ class ConfigFrame(wx.Frame):
|
|||
dlg.Destroy()
|
||||
return
|
||||
|
||||
if not baud:
|
||||
# TODO: It looks like serial port baud rate is confused with bootloader
|
||||
# baud rate here. These two can be the same, but don't have to.
|
||||
# Bootloader baud rate isn't user selectable, it's a property of
|
||||
# the bootloader and can be changed only by overwriting the
|
||||
# bootloader.
|
||||
dlg = wx.MessageDialog(self, "Unable to determine CPU baud rate.",
|
||||
"CPU baud rate error", wx.OK | wx.ICON_ERROR)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
return
|
||||
|
||||
if buildFlag:
|
||||
# TODO: building the executable needs no baud rate.
|
||||
dlg = Build(self, self.settings, f_cpu, cpu, baud)
|
||||
dlg = Build(self, self.settings, f_cpu, cpu)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
self.checkEnableUpload()
|
||||
else:
|
||||
dlg = Upload(self, self.settings, f_cpu, cpu, baud)
|
||||
dlg = Upload(self, self.settings, f_cpu, cpu)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
|
|
|||
|
|
@ -106,13 +106,7 @@ class BoardPanel(wx.Panel):
|
|||
if 'CPU' in self.cfgValues.keys():
|
||||
vCPU = self.cfgValues['CPU']
|
||||
|
||||
# TODO: this is probably obsolete, because the build process doesn't need
|
||||
# the firmware baud rate, but the bootloader baud rate.
|
||||
vBaud = None
|
||||
if 'BAUD' in self.cfgValues.keys():
|
||||
vBaud = self.cfgValues['BAUD']
|
||||
|
||||
return vF_CPU, vCPU, vBaud
|
||||
return vF_CPU, vCPU
|
||||
|
||||
def assertModified(self, pg, flag = True):
|
||||
self.pageModified[pg] = flag
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class ScriptThread:
|
|||
|
||||
|
||||
class Build(wx.Dialog):
|
||||
def __init__(self, parent, settings, f_cpu, cpu, baud):
|
||||
def __init__(self, parent, settings, f_cpu, cpu):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Build teacup",
|
||||
style = wx.RESIZE_BORDER + wx.DEFAULT_DIALOG_STYLE)
|
||||
self.settings = settings
|
||||
|
|
@ -102,7 +102,6 @@ class Build(wx.Dialog):
|
|||
self.root = self.settings.folder
|
||||
self.f_cpu = f_cpu
|
||||
self.cpu = cpu
|
||||
self.baud = baud
|
||||
self.Bind(wx.EVT_CLOSE, self.onExit)
|
||||
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
|
@ -300,7 +299,7 @@ class Build(wx.Dialog):
|
|||
|
||||
|
||||
class Upload(wx.Dialog):
|
||||
def __init__(self, parent, settings, f_cpu, cpu, baud):
|
||||
def __init__(self, parent, settings, f_cpu, cpu):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Upload teacup",
|
||||
style = wx.RESIZE_BORDER + wx.DEFAULT_DIALOG_STYLE)
|
||||
self.settings = settings
|
||||
|
|
@ -308,7 +307,7 @@ class Upload(wx.Dialog):
|
|||
self.root = self.settings.folder
|
||||
self.f_cpu = f_cpu
|
||||
self.cpu = cpu
|
||||
self.baud = baud
|
||||
self.baud = self.settings.uploadspeed
|
||||
self.Bind(wx.EVT_CLOSE, self.onExit)
|
||||
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class Settings:
|
|||
self.objcopyflags = ""
|
||||
self.programmer = "wiring"
|
||||
self.port = "/dev/ttyACM0"
|
||||
self.uploadspeed = 38400
|
||||
|
||||
self.t0 = 25;
|
||||
self.r1 = 0;
|
||||
|
|
@ -30,6 +31,7 @@ class Settings:
|
|||
|
||||
self.cfg = ConfigParser.ConfigParser()
|
||||
self.cfg.optionxform = str
|
||||
|
||||
if not self.cfg.read(self.inifile):
|
||||
if not self.cfg.read(os.path.join(folder, DEFAULT_INIFILE)):
|
||||
print ("Neither of settings files %s or %s exist. Using default values."
|
||||
|
|
@ -61,6 +63,8 @@ class Settings:
|
|||
self.maxAdc = value
|
||||
elif opt == "minadc":
|
||||
self.minAdc = value
|
||||
elif opt == "uploadspeed":
|
||||
self.uploadspeed = value
|
||||
else:
|
||||
print "Unknown %s option: %s - ignoring." % (self.section, opt)
|
||||
else:
|
||||
|
|
@ -84,6 +88,7 @@ class Settings:
|
|||
self.cfg.set(self.section, "numtemps", str(self.numTemps))
|
||||
self.cfg.set(self.section, "maxadc", str(self.maxAdc))
|
||||
self.cfg.set(self.section, "minadc", str(self.minAdc))
|
||||
self.cfg.set(self.section, "uploadspeed", str(self.uploadspeed))
|
||||
|
||||
try:
|
||||
cfp = open(self.inifile, 'wb')
|
||||
|
|
@ -103,6 +108,7 @@ LDFLAGS = 2
|
|||
OBJCOPYFLAGS= 3
|
||||
PROGRAMMER = 4
|
||||
PORT = 5
|
||||
UPLOADSPEED = 6
|
||||
|
||||
class SettingsDlg(wx.Dialog):
|
||||
def __init__(self, parent, settings):
|
||||
|
|
@ -120,7 +126,8 @@ class SettingsDlg(wx.Dialog):
|
|||
["LD Flags", settings.ldflags, None],
|
||||
["Object Copy Flags", settings.objcopyflags, None],
|
||||
["AVR Programmer", settings.programmer, None],
|
||||
["Port", settings.port, None]]
|
||||
["Port", settings.port, None],
|
||||
["Upload Speed", settings.uploadspeed, None]]
|
||||
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
|
@ -197,6 +204,7 @@ class SettingsDlg(wx.Dialog):
|
|||
self.settings.objcopyflags = self.fields[OBJCOPYFLAGS][2].GetValue()
|
||||
self.settings.programmer = self.fields[PROGRAMMER][2].GetValue()
|
||||
self.settings.port = self.fields[PORT][2].GetValue()
|
||||
self.settings.uploadspeed = self.fields[UPLOADSPEED][2].GetValue()
|
||||
|
||||
self.settings.saveSettings()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue