From: daid303 Date: Wed, 13 Feb 2013 14:09:19 +0000 (+0100) Subject: Fix the endstop reading for the new firmware. Fix temperatue update in USB printing. X-Git-Tag: 13.03~48 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=98f47b20050b1533f4dc84c29eb5dfef52dee3f0;p=cura.git Fix the endstop reading for the new firmware. Fix temperatue update in USB printing. --- diff --git a/Cura/gui/configWizard.py b/Cura/gui/configWizard.py index 01645ec7..54e8eb22 100644 --- a/Cura/gui/configWizard.py +++ b/Cura/gui/configWizard.py @@ -392,7 +392,7 @@ class UltimakerCheckupPage(InfoPage): self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton) def __del__(self): - if self.comm != None: + if self.comm is not None: self.comm.close() def AllowNext(self): @@ -465,6 +465,8 @@ class UltimakerCheckupPage(InfoPage): wx.CallAfter(self.infoBox.SetError, 'Temperature measurement FAILED!', 'http://wiki.ultimaker.com/Cura:_Temperature_measurement_problems') self.comm.sendCommand('M104 S0') self.comm.sendCommand('M104 S0') + elif self.checkupState >= 3 and self.checkupState < 10: + self.comm.sendCommand('M119') wx.CallAfter(self.temperatureLabel.SetLabel, 'Head temperature: %d' % (temp)) def mcStateChange(self, state): @@ -484,23 +486,38 @@ class UltimakerCheckupPage(InfoPage): wx.CallAfter(self.machineState.SetLabel, 'Communication State: %s' % (self.comm.getStateString())) def mcMessage(self, message): - if self.checkupState >= 3 and self.checkupState < 10 and 'x_min' in message: + if self.checkupState >= 3 and self.checkupState < 10 and ('_min' in message or '_max' in message): for data in message.split(' '): if ':' in data: - tag, value = data.split(':', 2) + tag, value = data.split(':', 1) if tag == 'x_min': - self.xMinStop = (value == 'H') + self.xMinStop = (value == 'H' or value == 'TRIGGERED') if tag == 'x_max': - self.xMaxStop = (value == 'H') + self.xMaxStop = (value == 'H' or value == 'TRIGGERED') if tag == 'y_min': - self.yMinStop = (value == 'H') + self.yMinStop = (value == 'H' or value == 'TRIGGERED') if tag == 'y_max': - self.yMaxStop = (value == 'H') + self.yMaxStop = (value == 'H' or value == 'TRIGGERED') if tag == 'z_min': - self.zMinStop = (value == 'H') + self.zMinStop = (value == 'H' or value == 'TRIGGERED') if tag == 'z_max': - self.zMaxStop = (value == 'H') - self.comm.sendCommand('M119') + self.zMaxStop = (value == 'H' or value == 'TRIGGERED') + if ':' in message: + tag, value = map(str.strip, message.split(':', 1)) + if tag == 'x_min': + self.xMinStop = (value == 'H' or value == 'TRIGGERED') + if tag == 'x_max': + self.xMaxStop = (value == 'H' or value == 'TRIGGERED') + if tag == 'y_min': + self.yMinStop = (value == 'H' or value == 'TRIGGERED') + if tag == 'y_max': + self.yMaxStop = (value == 'H' or value == 'TRIGGERED') + if tag == 'z_min': + self.zMinStop = (value == 'H' or value == 'TRIGGERED') + if tag == 'z_max': + self.zMaxStop = (value == 'H' or value == 'TRIGGERED') + if 'z_max' in message: + self.comm.sendCommand('M119') if self.checkupState == 3: if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop: @@ -776,7 +793,7 @@ class bedLevelWizardMain(InfoPage): elif self._wizardState == 4: wx.CallAfter(self.infoBox.SetBusy, 'Moving head to back right corner...') self.comm.sendCommand('G1 Z3 F%d' % (feedZ)) - self.comm.sendCommand('G1 X%d Y%d F%d' % (profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth') - 20, feedTravel)) + self.comm.sendCommand('G1 X%d Y%d F%d' % (profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth') - 25, feedTravel)) self.comm.sendCommand('G1 Z0 F%d' % (feedZ)) self.comm.sendCommand('M400') self._wizardState = 5 diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index 9040237f..45c65079 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -70,6 +70,10 @@ class printProcessMonitor(): while len(line) > 0: print line.rstrip() line = p.stdout.readline() + line = p.stderr.readline() + while len(line) > 0: + print line.rstrip() + line = p.stderr.readline() p.communicate() self.handle = None self.thread = None @@ -456,6 +460,7 @@ class printWindow(wx.Frame): self.pauseButton.SetLabel('Pause') self.machineCom.cancelPrint() self.machineCom.sendCommand("M84") + self.machineCom.sendCommand("M104 S0") self.UpdateButtonStates() def OnPause(self, e): @@ -470,7 +475,7 @@ class printWindow(wx.Frame): def OnClose(self, e): global printWindowHandle printWindowHandle = None - if self.machineCom != None: + if self.machineCom is not None: self.machineCom.close() self.Destroy() @@ -581,11 +586,13 @@ class printWindow(wx.Frame): def mcTempUpdate(self, temp, bedTemp, targetTemp, bedTargetTemp): self.temperatureGraph.addPoint(temp, targetTemp, bedTemp, bedTargetTemp) -# ToFix, this causes problems with setting the temperature with the keyboard -# if self.temperatureSelect.GetValue() != targetTemp: -# wx.CallAfter(self.temperatureSelect.SetValue, targetTemp) -# if self.bedTemperatureSelect.GetValue() != bedTargetTemp: -# wx.CallAfter(self.bedTemperatureSelect.SetValue, bedTargetTemp) + wx.CallAfter(self._mcTempUpdate, temp, bedTemp, targetTemp, bedTargetTemp) + + def _mcTempUpdate(self, temp, bedTemp, targetTemp, bedTargetTemp): + if self.temperatureSelect.GetValue() != targetTemp and wx.Window.FindFocus() != self.temperatureSelect: + self.temperatureSelect.SetValue(targetTemp) + if self.bedTemperatureSelect.GetValue() != bedTargetTemp and wx.Window.FindFocus() != self.bedTemperatureSelect: + self.bedTemperatureSelect.SetValue(bedTargetTemp) def mcStateChange(self, state): if self.machineCom is not None: