Better catch errors in first run wizard.
This commit is contained in:
parent
5c7c2c20da
commit
db6c7eaa67
2 changed files with 24 additions and 3 deletions
|
@ -175,6 +175,11 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
wx.CallAfter(self.AddProgressText, "Connecting to machine...")
|
wx.CallAfter(self.AddProgressText, "Connecting to machine...")
|
||||||
self.comm = machineCom.MachineCom()
|
self.comm = machineCom.MachineCom()
|
||||||
|
|
||||||
|
if not self.comm.isOpen():
|
||||||
|
wx.CallAfter(self.AddProgressText, "Error: Failed to open serial port to machine")
|
||||||
|
wx.CallAfter(self.AddProgressText, "If this keeps happening, try disconnecting and reconnecting the USB cable")
|
||||||
|
return
|
||||||
|
|
||||||
wx.CallAfter(self.AddProgressText, "Checking start message...")
|
wx.CallAfter(self.AddProgressText, "Checking start message...")
|
||||||
if self.DoCommCommandWithTimeout(None, 'start') == False:
|
if self.DoCommCommandWithTimeout(None, 'start') == False:
|
||||||
wx.CallAfter(self.AddProgressText, "Error: Missing start message.")
|
wx.CallAfter(self.AddProgressText, "Error: Missing start message.")
|
||||||
|
@ -288,10 +293,10 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
t.start()
|
t.start()
|
||||||
while True:
|
while True:
|
||||||
line = self.comm.readline()
|
line = self.comm.readline()
|
||||||
if line == '':
|
if line == '' or line == None:
|
||||||
self.comm.close()
|
self.comm.close()
|
||||||
return False
|
return False
|
||||||
print line
|
print line.rstrip()
|
||||||
if line.startswith(replyStart):
|
if line.startswith(replyStart):
|
||||||
break
|
break
|
||||||
t.cancel()
|
t.cancel()
|
||||||
|
@ -369,6 +374,10 @@ class UltimakerCalibrateStepsPerEPage(InfoPage):
|
||||||
self.extrudeButton.Enable(False)
|
self.extrudeButton.Enable(False)
|
||||||
currentEValue = float(self.stepsPerEInput.GetValue())
|
currentEValue = float(self.stepsPerEInput.GetValue())
|
||||||
self.comm = machineCom.MachineCom()
|
self.comm = machineCom.MachineCom()
|
||||||
|
if not self.comm.isOpen():
|
||||||
|
wx.CallAfter(self.AddProgressText, "Error: Failed to open serial port to machine")
|
||||||
|
wx.CallAfter(self.AddProgressText, "If this keeps happening, try disconnecting and reconnecting the USB cable")
|
||||||
|
return
|
||||||
while True:
|
while True:
|
||||||
line = self.comm.readline()
|
line = self.comm.readline()
|
||||||
if line == '':
|
if line == '':
|
||||||
|
@ -392,6 +401,10 @@ class UltimakerCalibrateStepsPerEPage(InfoPage):
|
||||||
|
|
||||||
def OnHeatRun(self):
|
def OnHeatRun(self):
|
||||||
self.comm = machineCom.MachineCom()
|
self.comm = machineCom.MachineCom()
|
||||||
|
if not self.comm.isOpen():
|
||||||
|
wx.CallAfter(self.AddProgressText, "Error: Failed to open serial port to machine")
|
||||||
|
wx.CallAfter(self.AddProgressText, "If this keeps happening, try disconnecting and reconnecting the USB cable")
|
||||||
|
return
|
||||||
while True:
|
while True:
|
||||||
line = self.comm.readline()
|
line = self.comm.readline()
|
||||||
if line == '':
|
if line == '':
|
||||||
|
|
|
@ -153,12 +153,13 @@ class MachineCom():
|
||||||
programmer = stk500v2.Stk500v2()
|
programmer = stk500v2.Stk500v2()
|
||||||
for port in serialList():
|
for port in serialList():
|
||||||
try:
|
try:
|
||||||
|
print "Connecting to: %s %i" % (port, baudrate)
|
||||||
programmer.connect(port)
|
programmer.connect(port)
|
||||||
programmer.close()
|
programmer.close()
|
||||||
print "Connecting to: %s %i" % (port, baudrate)
|
|
||||||
self.serial = Serial(port, baudrate, timeout=2)
|
self.serial = Serial(port, baudrate, timeout=2)
|
||||||
break
|
break
|
||||||
except ispBase.IspError:
|
except ispBase.IspError:
|
||||||
|
print "Error while connecting to %s %i" % (port, baudrate)
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
|
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
|
||||||
|
@ -170,6 +171,7 @@ class MachineCom():
|
||||||
self.serial = Serial(port, baudrate, timeout=2)
|
self.serial = Serial(port, baudrate, timeout=2)
|
||||||
except:
|
except:
|
||||||
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
|
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
|
||||||
|
print self.serial
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
if self.serial == None:
|
if self.serial == None:
|
||||||
|
@ -184,6 +186,12 @@ class MachineCom():
|
||||||
self.serial.close()
|
self.serial.close()
|
||||||
self.serial = None
|
self.serial = None
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def isOpen(self):
|
||||||
|
return self.serial != None
|
||||||
|
|
||||||
def sendCommand(self, cmd):
|
def sendCommand(self, cmd):
|
||||||
if self.serial == None:
|
if self.serial == None:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue