class UltimakerCheckupPage(InfoPage):\r
def __init__(self, parent):\r
super(UltimakerCheckupPage, self).__init__(parent, "Ultimaker Checkup")\r
- self.AddText('It is a good idea to do a few sanity checks\nnow on your Ultimaker. But you can skip these\nif you know your machine is functional.')\r
+ self.AddText('It is a good idea to do a few sanity checks\nnow on your Ultimaker.\nBut you can skip these if you know your\nmachine is functional.')\r
b1, b2 = self.AddDualButton('Run checks', 'Skip checks')\r
b1.Bind(wx.EVT_BUTTON, self.OnCheckClick)\r
b2.Bind(wx.EVT_BUTTON, self.OnSkipClick)\r
\r
wx.MessageBox('Please move the printer head to the center of the machine\nalso move the platform so it is not at the highest or lowest position,\nand make sure the machine is powered on.', 'Machine check', wx.OK | wx.ICON_INFORMATION)\r
wx.CallAfter(self.AddProgressText, "Checking endstops")\r
- if self.DoCommCommandWithTimeout('M119') != "ok x_min:l x_max:l y_min:l y_max:l z_min:l z_max:l":\r
- wx.CallAfter(self.AddProgressText, "Error: There is a problem in your endstops!")\r
- wx.CallAfter(self.AddProgressText, "Error: One of them seems to be pressed while it shouldn't")\r
+ if not self.DoCommCommandWithTimeout('M119') != "ok x_min:l x_max:l y_min:l y_max:l z_min:l z_max:l":\r
+ wx.CallAfter(self.AddProgressText, "Error: There is a problem in your endstops!\nOne of them seems to be pressed while it shouldn't\ncheck the cable connections and the switches themselfs.")\r
+ return\r
+\r
+ wx.CallAfter(self.AddProgressText, "Please press the X end switch in the front left corner.")\r
+ if not self.DoCommCommandAndWaitForReply('M119', "ok x_min:h x_max:l y_min:l y_max:l z_min:l z_max:l"):\r
+ wx.CallAfter(self.AddProgressText, "Failed to check the x_min endstop!")\r
return\r
\r
wx.CallAfter(self.AddProgressText, "Done!")\r
wx.CallAfter(self.GetParent().FindWindowById(wx.ID_FORWARD).Enable)\r
self.comm.close()\r
\r
+ def DoCommCommandAndWaitForReply(self, cmd, reply):\r
+ while True:\r
+ ret = DoCommCommandWithTimeout(cmd)\r
+ if ret == reply:\r
+ return True\r
+ if ret == False:\r
+ return False\r
+ \r
def DoCommCommandWithTimeout(self, cmd = None, replyStart = 'ok'):\r
if cmd != None:\r
self.comm.sendCommand(cmd)\r