chiark / gitweb /
Fix temperature graph in printwindow2. Add CURA_PROFILE_STRING to UM2 GCode. Add...
authordaid <daid303@gmail.com>
Mon, 2 Dec 2013 14:55:09 +0000 (15:55 +0100)
committerdaid <daid303@gmail.com>
Mon, 2 Dec 2013 14:55:09 +0000 (15:55 +0100)
Cura/gui/printWindow2.py
Cura/util/objectScene.py
Cura/util/printerConnection/doodle3dConnect.py
Cura/util/profile.py

index 271bab80c5d034868b71e799fb47ea020dc64d38..0c304ace2334aae25542aa1db8af5c78c5c698d4 100644 (file)
@@ -296,6 +296,9 @@ class printWindow(wx.Frame):
 
        def _doPrinterConnectionUpdate(self, connection, extraInfo = None):
                wx.CallAfter(self.__doPrinterConnectionUpdate, connection, extraInfo)
+               temp = [connection.getTemperature(0)]
+               self.temperatureGraph.addPoint(temp, [0], connection.getBedTemperature(), 0)
+
        def __doPrinterConnectionUpdate(self, connection, extraInfo):
                t = time.time()
                if self.lastUpdateTime + 0.5 > t:
@@ -487,6 +490,14 @@ class TemperatureGraph(wx.Panel):
                        self._points.pop(0)
 
        def addPoint(self, temp, tempSP, bedTemp, bedTempSP):
+               if time.time() - self._points[-1][4] < 0.5:
+                       return
+               for n in xrange(0, len(temp)):
+                       if temp[n] is None:
+                               temp[n] = 0
+               for n in xrange(0, len(tempSP)):
+                       if tempSP[n] is None:
+                               tempSP[n] = 0
                if bedTemp is None:
                        bedTemp = 0
                if bedTempSP is None:
index ab9319abdb1049f7870f135a97e9a386aefcf480..f7388b2a29e0dc05f52c12c2fa82ad132f9b0013 100644 (file)
@@ -82,7 +82,7 @@ class _objectOrderFinder(object):
        def _checkHit(self, addIdx, idx):
                obj = self._scene._objectList[idx]
                addObj = self._scene._objectList[addIdx]
-               return polygon.polygonCollision(obj._headAreaHull + obj.getPosition(), addObj._boundaryHull + addObj.getPosition())
+               return polygon.polygonCollision(obj._boundaryHull + obj.getPosition(), addObj._headAreaHull + addObj.getPosition())
 
 class Scene(object):
        def __init__(self):
index 5fa69f6434ade877a48a176986d3442290896367..1cad17e39b0187d83385d1f9e744b6534379c9e7 100644 (file)
@@ -22,6 +22,7 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
                self._isAvailable = False
                self._printing = False
                self._fileBlocks = []
+               self._commandList = []
                self._blockIndex = None
                self._lineCount = 0
                self._progressLine = 0
@@ -91,14 +92,24 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
        def isAvailable(self):
                return self._isAvailable
 
+       #Are we able to send a direct coammand with sendCommand at this moment in time.
+       def isAbleToSendDirectCommand(self):
+               return self._isAvailable and not self._printing
+
+       #Directly send a command to the printer.
+       def sendCommand(self, command):
+               if not self._isAvailable or self._printing:
+                       return
+               self._commandList.append(command)
+
        # Get the connection status string. This is displayed to the user and can be used to communicate
        #  various information to the user.
        def getStatusString(self):
                if not self._isAvailable:
                        return "Doodle3D box not found"
                if self._printing:
-                       if self._fileIndex < len(self._fileBlocks):
-                               return "Sending GCode: %.1f" % (float(self._fileIndex) / float(len(self._fileBlocks)))
+                       if self._blockIndex < len(self._fileBlocks):
+                               return "Sending GCode: %.1f" % (float(self._blockIndex) / float(len(self._fileBlocks)))
                return "TODO"
 
        #Get the temperature of an extruder, returns None is no temperature is known for this extruder
@@ -164,7 +175,11 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
                                        else:
                                                self._printing = False
                                else:
-                                       time.sleep(5)
+                                       if len(self._commandList) > 0:
+                                               if self._request('POST', '/d3dapi/printer/print', {'gcode': self._commandList[0], 'start': 'True', 'first': 'True'}):
+                                                       self._commandList.pop(0)
+                                       else:
+                                               time.sleep(5)
                        elif stateReply['data']['state'] == 'printing':
                                if self._printing:
                                        if self._blockIndex < len(self._fileBlocks):
@@ -181,7 +196,7 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
                                                self._progressLine = stateReply['data']['current_line']
                                else:
                                        #Got a printing state without us having send the print file, set the state to printing, but make sure we never send anything.
-                                       if 'current_line' in stateReply['data'] and 'total_lines' in stateReply['data']:
+                                       if 'current_line' in stateReply['data'] and 'total_lines' in stateReply['data'] and stateReply['data']['total_lines'] > 2:
                                                self._printing = True
                                                self._blockIndex = len(self._fileBlocks)
                                                self._progressLine = stateReply['data']['current_line']
index 475f965522ac76d816fc263c40497421450248b7..65128f0d078ae586a481f08efc887516a7a7f0f1 100644 (file)
@@ -961,7 +961,7 @@ def getAlterationFileContents(filename, extruderCount = 1):
        alterationContents = getAlterationFile(filename)
        if getMachineSetting('gcode_flavor') == 'UltiGCode':
                if filename == 'end.gcode':
-                       return 'M25 ;Stop reading from this point on.\n'
+                       return 'M25 ;Stop reading from this point on.\n;CURA_PROFILE_STRING:%s\n' % (getProfileString())
                return ''
        if filename == 'start.gcode':
                if extruderCount > 1: