Always use the configured serialport/baudrate if none given as parameters
parent
8f7c0a5456
commit
51001d2381
|
@ -9,6 +9,8 @@ from avr_isp import stk500v2
|
|||
from avr_isp import ispBase
|
||||
from avr_isp import intelHex
|
||||
|
||||
from newui import profile
|
||||
|
||||
try:
|
||||
import _winreg
|
||||
except:
|
||||
|
@ -28,8 +30,11 @@ def serialList():
|
|||
return baselist+glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') +glob.glob("/dev/tty.usb*")+glob.glob("/dev/cu.*")+glob.glob("/dev/rfcomm*")
|
||||
|
||||
class InstallFirmware(wx.Dialog):
|
||||
def __init__(self, filename, port = 'AUTO'):
|
||||
def __init__(self, filename, port = None):
|
||||
super(InstallFirmware, self).__init__(parent=None, title="Firmware install", size=(250, 100))
|
||||
if port == None:
|
||||
port = profile.getPreference('serial_port')
|
||||
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.progressLabel = wx.StaticText(self, -1, 'Reading firmware...')
|
||||
|
@ -99,7 +104,11 @@ class InstallFirmware(wx.Dialog):
|
|||
self.Destroy()
|
||||
|
||||
class MachineCom():
|
||||
def __init__(self, port = 'AUTO', baudrate = 250000):
|
||||
def __init__(self, port = None, baudrate = None):
|
||||
if port == None:
|
||||
port = profile.getPreference('serial_port')
|
||||
if baudrate == None:
|
||||
baudrate = profile.getPreference('serial_baud')
|
||||
self.serial = None
|
||||
if port == 'AUTO':
|
||||
programmer = stk500v2.Stk500v2()
|
||||
|
|
|
@ -239,7 +239,7 @@ class mainWindow(configBase.configWindowBase):
|
|||
prefDialog.Show(True)
|
||||
|
||||
def OnDefaultMarlinFirmware(self, e):
|
||||
machineCom.InstallFirmware(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../firmware/default.hex"), profile.getPreference('serial_port'))
|
||||
machineCom.InstallFirmware(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../firmware/default.hex"))
|
||||
|
||||
def OnCustomFirmware(self, e):
|
||||
dlg=wx.FileDialog(self, "Open firmware to upload", self.lastPath, style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
|
||||
|
@ -249,7 +249,7 @@ class mainWindow(configBase.configWindowBase):
|
|||
if not(os.path.exists(filename)):
|
||||
return
|
||||
#For some reason my Ubuntu 10.10 crashes here.
|
||||
machineCom.InstallFirmware(filename, profile.getPreference('serial_port'))
|
||||
machineCom.InstallFirmware(filename)
|
||||
|
||||
def OnFirstRunWizard(self, e):
|
||||
configWizard.configWizard()
|
||||
|
|
Loading…
Reference in New Issue