chiark / gitweb /
Removed checkSSE2, check is included in pypy now.
authordaid <daid303@gmail.com>
Wed, 7 Mar 2012 11:17:03 +0000 (12:17 +0100)
committerdaid <daid303@gmail.com>
Wed, 7 Mar 2012 11:17:03 +0000 (12:17 +0100)
Updated to the config wizard, check endstops (work in progress, untested)

SkeinPyPy/skeinforge_application/skeinforge.py
SkeinPyPy_NewUI/newui/configWizard.py
SkeinPyPy_NewUI/newui/machineCom.py
SkeinPyPy_NewUI/newui/skeinRun.py
build.sh
checkSSE2/Makefile [deleted file]
checkSSE2/main.c [deleted file]

index 9afb64e843f402b38bbb0a1b742da435104d0162..33279a9a7e3dbd1de88ae16b841a1ae48cfd43bd 100755 (executable)
@@ -579,14 +579,6 @@ class SkeinforgeRepository:
                self.executeTitle = 'Skeinforge a file...'
        
        def getPyPyExe(self):
-               if platform.system() == "Windows":
-                       checkSSE2exe = os.path.dirname(os.path.abspath(__file__)) + "/checkSSE2.exe"
-                       if os.path.exists(checkSSE2exe):
-                               if subprocess.call(checkSSE2exe) != 0:
-                                       print "*****************************************************"
-                                       print "* Your CPU is lacking SSE2 support, cannot use PyPy *"
-                                       print "*****************************************************"
-                                       return False
                if platform.system() == "Windows":
                        pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe"));
                else:
index 89214badcca634c6ec4973dca48d2077cfac3b8f..8c54188b1250ef04c331c968f945810cd4471266 100644 (file)
@@ -150,7 +150,6 @@ class UltimakerCheckupPage(InfoPage):
        \r
        def OnSkipClick(self, e):\r
                self.GetParent().FindWindowById(wx.ID_FORWARD).Enable()\r
-               self.comm.serial.close()\r
        \r
        def OnCheckClick(self, e):\r
                if self.checkPanel != None:\r
@@ -168,27 +167,44 @@ class UltimakerCheckupPage(InfoPage):
        \r
        def OnRun(self):\r
                wx.CallAfter(self.AddProgressText, "Connecting to machine...")\r
-               comm = machineCom.MachineCom()\r
-               self.comm = comm\r
+               self.comm = machineCom.MachineCom()\r
+\r
                wx.CallAfter(self.AddProgressText, "Checking start message...")\r
+               if self.DoCommCommandWithTimeout(None, 'start') == False:\r
+                       wx.CallAfter(self.AddProgressText, "Error: Missing start message.")\r
+                       return\r
+                       \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
+                       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
+               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
+                       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 DoCommCommandWithTimeout(self, cmd = None, replyStart = 'ok'):\r
+               if cmd != None:\r
+                       self.comm.sendCommand(cmd)\r
                t = threading.Timer(5, self.OnSerialTimeout)\r
                t.start()\r
-               line = comm.readline()\r
-               hasStart = False\r
-               while line != '':\r
+               while True:\r
+                       line = self.comm.readline()\r
                        if line.startswith('start'):\r
-                               hasStart = True\r
                                break\r
-                       line = comm.readline()\r
+                       if line == '':\r
+                               self.comm.close()\r
+                               return False\r
                t.cancel()\r
-               if not hasStart:\r
-                       wx.CallAfter(self.AddProgressText, "Error: Missing start message.")\r
-                       comm.close()\r
-                       return\r
-               wx.CallAfter(self.AddProgressText, "Done!")\r
-               wx.CallAfter(self.GetParent().FindWindowById(wx.ID_FORWARD).Enable)\r
-               comm.close()\r
-               \r
+               return line.rstrip()\r
+       \r
        def OnSerialTimeout(self):\r
                self.comm.close()\r
 \r
index a1b37ba68cd6043b716e0797e3a3c54cb647e38c..b9866f5b44817e533397560f78a2695936b9f2a5 100644 (file)
@@ -122,3 +122,9 @@ class MachineCom():
                if self.serial != None:
                        self.serial.close()
                self.serial = None
+       
+       def sendCommand(self, cmd):
+               if self.serial == None:
+                       return
+               self.serial.write(cmd + '\n')
+
index 306d56ceb9858f1703a6b957b640263c7ee45361..bd1c3c93625ed7c5f99262774141d17a0fea9c57 100644 (file)
@@ -6,14 +6,6 @@ from skeinforge_application.skeinforge_utilities import skeinforge_craft
 
 def getPyPyExe():
        "Return the path to the pypy executable if we can find it. Else return False"
-       if platform.system() == "Windows":
-               checkSSE2exe = os.path.dirname(os.path.abspath(__file__)) + "/checkSSE2.exe"
-               if os.path.exists(checkSSE2exe):
-                       if subprocess.call(checkSSE2exe) != 0:
-                               print "*****************************************************"
-                               print "* Your CPU is lacking SSE2 support, cannot use PyPy *"
-                               print "*****************************************************"
-                               return False
        if platform.system() == "Windows":
                pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe"));
        else:
index 382abf568c579838591b509ee51f1f398d721cd8..285b367c1688557e73bf7cb66815bdcb5ce96bda 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -130,16 +130,6 @@ rm -rf ${TARGET_DIR}/pypy/lib-python/2.7/test
 #add Skeinforge
 cp -a SkeinPyPy_NewUI ${TARGET_DIR}/SkeinPyPy
 
-#Add the SSE2 check if we can build it, else we skip it.
-#  If we don't have it SkeinPyPy will still function. But crash on machines that don't have SSE2
-if [ $BUILD_TARGET = "win32" ]; then
-       WINCC=`whereis i386-mingw32-gcc`
-       if [ "$WINCC" != "" ]; then
-               make -C checkSSE2 CC=${WINCC} TARGET=checkSSE2.exe
-               cp checkSSE2/checkSSE2.exe ${TARGET_DIR}/SkeinPyPy
-       fi
-fi
-
 #add printrun
 mv Printrun ${TARGET_DIR}/Printrun
 
diff --git a/checkSSE2/Makefile b/checkSSE2/Makefile
deleted file mode 100644 (file)
index 02d7b57..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-CC ?= gcc
-TARGET ?= checkSSE2
-
-$(TARGET): main.c
-       $(CC) -o $(TARGET) main.c -Os
-
diff --git a/checkSSE2/main.c b/checkSSE2/main.c
deleted file mode 100644 (file)
index 9c66aa9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-//Read CPU flags, and return 0 if we support SSE2, else return 1
-//See: http://en.wikipedia.org/wiki/CPUID#EAX.3D1:_Processor_Info_and_Feature_Bits
-
-int main(int argc, char** argv)
-{
-       int features;
-       
-       //Read the CPU features.
-       asm("mov $1, %%eax\n"
-               "cpuid\n"
-               "mov %%edx, %0"
-               : "=r"(features) : : "%eax", "%edx", "%ecx");
-       
-       //Check bit 26, this indicates SSE2 support
-       if (features & (1 << 26))
-               return 0;
-       return 1;
-}
\ No newline at end of file