chiark / gitweb /
Fix problems with serial connection
authorunknown <Daid@DaidLappy.(none)>
Fri, 9 Mar 2012 14:14:12 +0000 (15:14 +0100)
committerunknown <Daid@DaidLappy.(none)>
Fri, 9 Mar 2012 14:14:12 +0000 (15:14 +0100)
Added first version of steps per E
Added more GCode path preview (lower layers)

SkeinPyPy_NewUI/avr_isp/stk500v2.py
SkeinPyPy_NewUI/fabmetheus_utilities/settings.py
SkeinPyPy_NewUI/newui/configWizard.py
SkeinPyPy_NewUI/newui/machineCom.py
SkeinPyPy_NewUI/newui/mainWindow.py
SkeinPyPy_NewUI/newui/preview3d.py
SkeinPyPy_NewUI/skeinpypy.py

index b384d6516534d42135f3d5163236061274a9a320..97cf8a317ae453e1e38b9d3dc3a12191378ea0ad 100644 (file)
@@ -13,7 +13,10 @@ class Stk500v2(ispBase.IspBase):
        def connect(self, port = 'COM3', speed = 115200):\r
                if self.serial != None:\r
                        self.close()\r
-               self.serial = Serial(port, speed, timeout=1)\r
+               try:\r
+                       self.serial = Serial(port, speed, timeout=1)\r
+               except Serial.SerialException as e:\r
+                       raise ispBase.IspError("Failed to open serial port")\r
                self.seq = 1\r
                \r
                #Reset the controller\r
index 6cf7c00c31e23b0b062afb3cc980a60bf7554ed2..fccb85b140c03f79750af973434118d6710be9cb 100644 (file)
@@ -22,8 +22,8 @@ def storedSetting(name):
 def ifSettingAboveZero(name):
        return lambda setting: float(getProfileSetting(name, '0.0')) > 0
 
-def ifSettingIs(name, value):
-       return lambda setting: getProfileSetting(name) == value
+def ifSettingIs(name, value, default):
+       return lambda setting: getProfileSetting(name, default) == value
 
 def storedPercentSetting(name):
        return lambda setting: float(getProfileSetting(name, setting.value)) / 100
@@ -134,10 +134,10 @@ def getSkeinPyPyProfileInformation():
                        'Infill_Begin_Rotation_degrees': DEFSET,
                        'Infill_Begin_Rotation_Repeat_layers': DEFSET,
                        'Infill_Odd_Layer_Extra_Rotation_degrees': DEFSET,
-                       'Grid_Circular': ifSettingIs('infill_type', 'Grid Circular'),
-                       'Grid_Hexagonal': ifSettingIs('infill_type', 'Grid Hexagonal'),
-                       'Grid_Rectangular': ifSettingIs('infill_type', 'Grid Rectangular'),
-                       'Line': ifSettingIs('infill_type', 'Line'),
+                       'Grid_Circular': ifSettingIs('infill_type', 'Grid Circular', 'Line'),
+                       'Grid_Hexagonal': ifSettingIs('infill_type', 'Grid Hexagonal', 'Line'),
+                       'Grid_Rectangular': ifSettingIs('infill_type', 'Grid Rectangular', 'Line'),
+                       'Line': ifSettingIs('infill_type', 'Line', 'Line'),
                        'Infill_Perimeter_Overlap_ratio': DEFSET,
                        'Infill_Solidity_ratio': storedPercentSetting('fill_density'),
                        'Infill_Width': storedSetting("nozzle_size"),
index 2dbeb904d31b645cb0aaed7003392c28c04262dc..1ca0ca0692e1fc4fe22a71eef2366af77e0d41a5 100644 (file)
@@ -176,7 +176,8 @@ class UltimakerCheckupPage(InfoPage):
                        \r
                wx.CallAfter(self.AddProgressText, "Disabling step motors...")\r
                if self.DoCommCommandWithTimeout('M84') == False:\r
-                       wx.CallAfter(self.AddProgressText, "Error: Missing reply to M84.")\r
+                       wx.CallAfter(self.AddProgressText, "Error: Missing reply to Deactivate steppers (M84).")\r
+                       wx.CallAfter(self.AddProgressText, "Possible cause: Temperature MIN/MAX.\nCheck temperature sensor connections.")\r
                        return\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
@@ -184,18 +185,19 @@ class UltimakerCheckupPage(InfoPage):
                idleTemp = self.readTemp()\r
                \r
                wx.CallAfter(self.AddProgressText, "Checking heater and temperature sensor...")\r
+               wx.CallAfter(self.AddProgressText, "(This takes about 30 seconds)")\r
                if self.DoCommCommandWithTimeout("M104 S100") == False:\r
                        wx.CallAfter(self.AddProgressText, "Failed to set temperature")\r
                        return\r
                \r
-               time.sleep(20)\r
+               time.sleep(25)\r
                tempInc = self.readTemp() - idleTemp\r
                \r
                if self.DoCommCommandWithTimeout("M104 S0") == False:\r
                        wx.CallAfter(self.AddProgressText, "Failed to set temperature")\r
                        return\r
                \r
-               if tempInc < 20:\r
+               if tempInc < 15:\r
                        wx.CallAfter(self.AddProgressText, "Your temperature sensor or heater is not working!")\r
                        return\r
                wx.CallAfter(self.AddProgressText, "Heater and temperature sensor working\nWarning: head might still be hot!")\r
@@ -288,24 +290,41 @@ class UltimakerCalibrationPage(InfoPage):
        def StoreData(self):\r
                settings.putProfileSetting('filament_diameter', self.filamentDiameter.GetValue())\r
 \r
+class UltimakerCalibrateStepsPerEPage(InfoPage):\r
+       def __init__(self, parent):\r
+               super(UltimakerCalibrateStepsPerEPage, self).__init__(parent, "Ultimaker Calibration")\r
+               \r
+               self.AddText("Calibrating the Steps Per E requires some manual actions.")\r
+               self.AddText("First remove any filament from your machine.")\r
+               self.AddText("Next put in your filament so the tip is aligned with the\ntop of the extruder drive.")\r
+               self.AddText("We'll push the filament 100mm")\r
+               self.AddText("[BUTTON:PUSH 100mm]")\r
+               self.AddText("Now measure the amount of extruded filament:\n(this can be more or less then 100mm)")\r
+               self.AddText("[INPUT:MEASUREMENT][BUTTON:SAVE]")\r
+               self.AddText("This results in the following steps per E:")\r
+               self.AddText("[INPUT:E_RESULT]")\r
+               self.AddText("You can repeat these steps to get better calibration.")\r
+\r
 class configWizard(wx.wizard.Wizard):\r
        def __init__(self):\r
                super(configWizard, self).__init__(None, -1, "Configuration Wizard")\r
                \r
                self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged)\r
                self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging)\r
-               \r
+\r
                self.firstInfoPage = FirstInfoPage(self)\r
                self.machineSelectPage = MachineSelectPage(self)\r
                self.ultimakerFirmwareUpgradePage = FirmwareUpgradePage(self)\r
                self.ultimakerCheckupPage = UltimakerCheckupPage(self)\r
                self.ultimakerCalibrationPage = UltimakerCalibrationPage(self)\r
+               self.ultimakerCalibrateStepsPerEPage = UltimakerCalibrateStepsPerEPage(self)\r
                self.repRapInfoPage = RepRapInfoPage(self)\r
-               \r
+\r
                wx.wizard.WizardPageSimple.Chain(self.firstInfoPage, self.machineSelectPage)\r
                wx.wizard.WizardPageSimple.Chain(self.machineSelectPage, self.ultimakerFirmwareUpgradePage)\r
                wx.wizard.WizardPageSimple.Chain(self.ultimakerFirmwareUpgradePage, self.ultimakerCheckupPage)\r
                wx.wizard.WizardPageSimple.Chain(self.ultimakerCheckupPage, self.ultimakerCalibrationPage)\r
+               wx.wizard.WizardPageSimple.Chain(self.ultimakerCalibrationPage, self.ultimakerCalibrateStepsPerEPage)\r
                \r
                self.FitToPage(self.firstInfoPage)\r
                self.GetPageAreaSizer().Add(self.firstInfoPage)\r
index c88699b0ef1b2994d3ea7c862e29fbe15840881c..47041ed9066ddfe02e02439bcf82c9beddd9a638 100644 (file)
@@ -25,7 +25,7 @@ def serialList():
                 i+=1
         except:
             pass
-    return baselist+glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') +glob.glob("/dev/tty.*")+glob.glob("/dev/cu.*")+glob.glob("/dev/rfcomm*")
+    return baselist+glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') +glob.glob("/dev/tty.usb*")+glob.glob("/dev/cu.*")+glob.glob("/dev/rfcomm*")
 
 class InstallFirmware(wx.Dialog):
        def __init__(self, filename, port = 'AUTO'):
@@ -61,6 +61,7 @@ class InstallFirmware(wx.Dialog):
                        for self.port in serialList():
                                try:
                                        programmer.connect(self.port)
+                                       break
                                except ispBase.IspError:
                                        pass
                else:
@@ -107,6 +108,7 @@ class MachineCom():
                                        programmer.connect(port)
                                        programmer.close()
                                        self.serial = Serial(port, baudrate, timeout=5)
+                                       break
                                except ispBase.IspError:
                                        pass
                        programmer.close()
index 77ca4ca6138fe4a5649ef81e511b032b27e382ea..b6fb9a3f9df17cc45c9ef2d5209d011c7bfa3496 100644 (file)
@@ -17,6 +17,9 @@ from newui import machineCom
 
 def main():
        app = wx.App(False)
+       if settings.getPreference('wizardDone', 'False') == 'False':
+               configWizard.configWizard()
+               settings.putPreference("wizardDone", "True")
        mainWindow()
        app.MainLoop()
 
@@ -27,9 +30,6 @@ class mainWindow(configBase.configWindowBase):
                
                wx.EVT_CLOSE(self, self.OnClose)
                
-               if settings.getPreference('wizardDone', 'False') == 'False':
-                       configWizard.configWizard()
-               
                menubar = wx.MenuBar()
                fileMenu = wx.Menu()
                i = fileMenu.Append(-1, 'Open Profile...')
index 5120174658bcfa3d13ef125921ada43685a8e63c..0ae626db308757a92605b81db9a1b0e80c9a168e 100644 (file)
@@ -317,8 +317,6 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                                        if path['layerNr'] != self.parent.layerSpin.GetValue():\r
                                                if path['layerNr'] < self.parent.layerSpin.GetValue():\r
                                                        c = 0.5 - (self.parent.layerSpin.GetValue() - path['layerNr']) * 0.1\r
-                                                       if c < -0.5:\r
-                                                               continue\r
                                                        if c < 0.1:\r
                                                                c = 0.1\r
                                                else:\r
@@ -334,7 +332,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                                                        glColor3f(c,0,0)\r
                                        if path['type'] == 'retract':\r
                                                glColor3f(0,c,c)\r
-                                       if path['type'] == 'extrude':\r
+                                       if c > 0.1 and path['type'] == 'extrude':\r
                                                if path['pathType'] == 'FILL':\r
                                                        lineWidth = self.fillLineWidth / 2\r
                                                else:\r
index c701b9b9a85dd2e210cb6c7f87b4241c8a88b4bc..5a706ac4ac9f2ddac2b77a2ed131725c58b037fc 100644 (file)
@@ -10,6 +10,7 @@ The slicing code is the same as Skeinforge. But the UI has been revamped to be..
 """
 
 from __future__ import absolute_import
+import __init__
 
 import sys
 import platform