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:
\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
\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
if self.serial != None:
self.serial.close()
self.serial = None
+
+ def sendCommand(self, cmd):
+ if self.serial == None:
+ return
+ self.serial.write(cmd + '\n')
+
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:
#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
+++ /dev/null
-CC ?= gcc
-TARGET ?= checkSSE2
-
-$(TARGET): main.c
- $(CC) -o $(TARGET) main.c -Os
-
+++ /dev/null
-#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