Fix timelaps recording support

master
daid303 2012-10-01 14:36:47 +02:00
parent 2ade97783a
commit 718b685a72
5 changed files with 29 additions and 21 deletions

View File

@ -337,12 +337,14 @@ def DrawGCodeLayer(layer):
c = retractColor
else:
c = moveColor
zOffset = 0.01
if path.type == 'extrude':
if path.pathType == 'FILL':
c = fillColorCycle[fillCycle]
fillCycle = (fillCycle + 1) % len(fillColorCycle)
elif path.pathType == 'WALL-INNER':
c = innerWallColor
zOffset = 0.02
elif path.pathType == 'SUPPORT':
c = supportColor
elif path.pathType == 'SKIRT':
@ -375,10 +377,10 @@ def DrawGCodeLayer(layer):
glBegin(GL_QUADS)
glColor3fv(c)
glVertex3f(vv0.x, vv0.y, vv0.z - 0.01)
glVertex3f(vv1.x, vv1.y, vv1.z - 0.01)
glVertex3f(vv3.x, vv3.y, vv3.z - 0.01)
glVertex3f(vv2.x, vv2.y, vv2.z - 0.01)
glVertex3f(vv0.x, vv0.y, vv0.z - zOffset)
glVertex3f(vv1.x, vv1.y, vv1.z - zOffset)
glVertex3f(vv3.x, vv3.y, vv3.z - zOffset)
glVertex3f(vv2.x, vv2.y, vv2.z - zOffset)
glEnd()
if prevNormal != None:
n = (normal + prevNormal)
@ -387,15 +389,15 @@ def DrawGCodeLayer(layer):
vv5 = v0 - n * lineWidth
glBegin(GL_QUADS)
glColor3fv(c)
glVertex3f(vv2.x, vv2.y, vv2.z)
glVertex3f(vv4.x, vv4.y, vv4.z)
glVertex3f(prevVv3.x, prevVv3.y, prevVv3.z)
glVertex3f(v0.x, v0.y, v0.z)
glVertex3f(vv2.x, vv2.y, vv2.z - zOffset)
glVertex3f(vv4.x, vv4.y, vv4.z - zOffset)
glVertex3f(prevVv3.x, prevVv3.y, prevVv3.z - zOffset)
glVertex3f(v0.x, v0.y, v0.z - zOffset)
glVertex3f(vv0.x, vv0.y, vv0.z)
glVertex3f(vv5.x, vv5.y, vv5.z)
glVertex3f(prevVv1.x, prevVv1.y, prevVv1.z)
glVertex3f(v0.x, v0.y, v0.z)
glVertex3f(vv0.x, vv0.y, vv0.z - zOffset)
glVertex3f(vv5.x, vv5.y, vv5.z - zOffset)
glVertex3f(prevVv1.x, prevVv1.y, prevVv1.z - zOffset)
glVertex3f(v0.x, v0.y, v0.z - zOffset)
glEnd()
prevNormal = normal

View File

@ -111,7 +111,7 @@ class printWindow(wx.Frame):
sb = wx.StaticBox(self.panel, label="Statistics")
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
self.statsText = wx.StaticText(self.panel, -1, "Filament: ####.##m #.##g\nPrint time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
self.statsText = wx.StaticText(self.panel, -1, "Filament: ####.##m #.##g\nEstimated print time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
boxsizer.Add(self.statsText, flag=wx.LEFT, border=5)
self.sizer.Add(boxsizer, pos=(0,0), span=(6,1), flag=wx.EXPAND)
@ -244,7 +244,7 @@ class printWindow(wx.Frame):
sizer = wx.GridBagSizer(2, 2)
self.camPage.SetSizer(sizer)
self.timelapsEnable = wx.CheckBox(self.camPage, -1, 'Enable timelaps')
self.timelapsEnable = wx.CheckBox(self.camPage, -1, 'Enable timelaps movie recording')
sizer.Add(self.timelapsEnable, pos=(0,0), span=(1,2), flag=wx.EXPAND)
pages = self.cam.propertyPages()
@ -340,7 +340,7 @@ class printWindow(wx.Frame):
cost = self.gcode.calculateCost()
if cost != False:
status += "Filament cost: %s\n" % (cost)
status += "Print time: %02d:%02d\n" % (int(self.gcode.totalMoveTimeMinute / 60), int(self.gcode.totalMoveTimeMinute % 60))
status += "Estimated print time: %02d:%02d\n" % (int(self.gcode.totalMoveTimeMinute / 60), int(self.gcode.totalMoveTimeMinute % 60))
if self.machineCom == None or not self.machineCom.isPrinting():
self.progress.SetValue(0)
if self.gcodeList != None:
@ -384,8 +384,6 @@ class printWindow(wx.Frame):
self.UpdateButtonStates()
def OnCancel(self, e):
if self.cam != None:
self.cam.endTimelaps()
self.pauseButton.SetLabel('Pause')
self.machineCom.cancelPrint()
self.machineCom.sendCommand("M84")
@ -503,6 +501,8 @@ class printWindow(wx.Frame):
self.temperatureGraph.addPoint(temp, self.temperatureSelect.GetValue(), bedTemp, self.bedTemperatureSelect.GetValue())
def mcStateChange(self, state):
if self.machineCom != None and state == self.machineCom.STATE_OPERATIONAL and self.cam != None:
self.cam.endTimelaps()
wx.CallAfter(self.UpdateButtonStates)
wx.CallAfter(self.UpdateProgress)
@ -513,6 +513,7 @@ class printWindow(wx.Frame):
wx.CallAfter(self.UpdateProgress)
def mcZChange(self, newZ):
self.currentZ = newZ
if self.cam != None:
wx.CallAfter(self.cam.takeNewImage)
wx.CallAfter(self.camPreview.Refresh)

View File

@ -99,6 +99,7 @@ class webcam(object):
self._timelapsFilename = filename
self._snapshotCount = 0
self._doTimelaps = True
print "startTimelaps"
def endTimelaps(self):
if self._doTimelaps:

View File

@ -89,7 +89,7 @@ class VirtualPrinter():
return ''
if self.readList == None:
return ''
time.sleep(0.01)
time.sleep(0.001)
#print "Recv: %s" % (self.readList[0].rstrip())
return self.readList.pop(0)
@ -258,6 +258,7 @@ class MachineCom(object):
def _monitor(self):
timeout = time.time() + 5
tempRequestTimeout = timeout
while True:
line = self._readline()
if line == None:
@ -362,7 +363,8 @@ class MachineCom(object):
if ret == '':
#self._log("Recv: TIMEOUT")
return ''
self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
if ret != 'ok\n':
self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
return ret
def close(self, isError = False):
@ -380,7 +382,8 @@ class MachineCom(object):
def _sendCommand(self, cmd):
if self._serial == None:
return
self._log('Send: %s' % (cmd))
if not cmd.startswith('N'):
self._log('Send: %s' % (cmd))
try:
#TODO: This can throw a write timeout exception, but we do not want timeout on writes. Find a fix for this.
# Oddly enough, the write timeout is not even set and thus we should not get a write timeout.

View File

@ -124,13 +124,14 @@ if [ $BUILD_TARGET = "win32" ]; then
7z x ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe
mkdir -p ${TARGET_DIR}/python
mkdir -p ${TARGET_DIR}/Cura/
mv \$_OUTDIR/App/* ${TARGET_DIR}/python
mv \$_OUTDIR/Lib/site-packages/wx* ${TARGET_DIR}/python/Lib/site-packages/
mv PURELIB/serial ${TARGET_DIR}/python/Lib
mv PURELIB/OpenGL ${TARGET_DIR}/python/Lib
mv PLATLIB/numpy ${TARGET_DIR}/python/Lib
mv VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd ${TARGET_DIR}/python/DLLs
mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura
mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura/
rm -rf \$_OUTDIR
rm -rf PURELIB
rm -rf PLATLIB