From: daid Date: Wed, 7 Mar 2012 11:17:03 +0000 (+0100) Subject: Removed checkSSE2, check is included in pypy now. X-Git-Tag: RC1~130 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b3ed15c2bfcb2b2fca2ad008558f0814354fb9ad;p=cura.git Removed checkSSE2, check is included in pypy now. Updated to the config wizard, check endstops (work in progress, untested) --- diff --git a/SkeinPyPy/skeinforge_application/skeinforge.py b/SkeinPyPy/skeinforge_application/skeinforge.py index 9afb64e8..33279a9a 100755 --- a/SkeinPyPy/skeinforge_application/skeinforge.py +++ b/SkeinPyPy/skeinforge_application/skeinforge.py @@ -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: diff --git a/SkeinPyPy_NewUI/newui/configWizard.py b/SkeinPyPy_NewUI/newui/configWizard.py index 89214bad..8c54188b 100644 --- a/SkeinPyPy_NewUI/newui/configWizard.py +++ b/SkeinPyPy_NewUI/newui/configWizard.py @@ -150,7 +150,6 @@ class UltimakerCheckupPage(InfoPage): def OnSkipClick(self, e): self.GetParent().FindWindowById(wx.ID_FORWARD).Enable() - self.comm.serial.close() def OnCheckClick(self, e): if self.checkPanel != None: @@ -168,27 +167,44 @@ class UltimakerCheckupPage(InfoPage): def OnRun(self): wx.CallAfter(self.AddProgressText, "Connecting to machine...") - comm = machineCom.MachineCom() - self.comm = comm + self.comm = machineCom.MachineCom() + wx.CallAfter(self.AddProgressText, "Checking start message...") + if self.DoCommCommandWithTimeout(None, 'start') == False: + wx.CallAfter(self.AddProgressText, "Error: Missing start message.") + return + + wx.CallAfter(self.AddProgressText, "Disabling step motors...") + if self.DoCommCommandWithTimeout('M84') == False: + wx.CallAfter(self.AddProgressText, "Error: Missing reply to M84.") + return + + 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) + wx.CallAfter(self.AddProgressText, "Checking endstops") + if self.DoCommCommandWithTimeout('M119') != "ok x_min:l x_max:l y_min:l y_max:l z_min:l z_max:l" + wx.CallAfter(self.AddProgressText, "Error: There is a problem in your endstops!") + wx.CallAfter(self.AddProgressText, "Error: One of them seems to be pressed while it shouldn't") + return + + wx.CallAfter(self.AddProgressText, "Done!") + wx.CallAfter(self.GetParent().FindWindowById(wx.ID_FORWARD).Enable) + self.comm.close() + + def DoCommCommandWithTimeout(self, cmd = None, replyStart = 'ok'): + if cmd != None: + self.comm.sendCommand(cmd) t = threading.Timer(5, self.OnSerialTimeout) t.start() - line = comm.readline() - hasStart = False - while line != '': + while True: + line = self.comm.readline() if line.startswith('start'): - hasStart = True break - line = comm.readline() + if line == '': + self.comm.close() + return False t.cancel() - if not hasStart: - wx.CallAfter(self.AddProgressText, "Error: Missing start message.") - comm.close() - return - wx.CallAfter(self.AddProgressText, "Done!") - wx.CallAfter(self.GetParent().FindWindowById(wx.ID_FORWARD).Enable) - comm.close() - + return line.rstrip() + def OnSerialTimeout(self): self.comm.close() diff --git a/SkeinPyPy_NewUI/newui/machineCom.py b/SkeinPyPy_NewUI/newui/machineCom.py index a1b37ba6..b9866f5b 100644 --- a/SkeinPyPy_NewUI/newui/machineCom.py +++ b/SkeinPyPy_NewUI/newui/machineCom.py @@ -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') + diff --git a/SkeinPyPy_NewUI/newui/skeinRun.py b/SkeinPyPy_NewUI/newui/skeinRun.py index 306d56ce..bd1c3c93 100644 --- a/SkeinPyPy_NewUI/newui/skeinRun.py +++ b/SkeinPyPy_NewUI/newui/skeinRun.py @@ -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: diff --git a/build.sh b/build.sh index 382abf56..285b367c 100755 --- 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 index 02d7b57d..00000000 --- a/checkSSE2/Makefile +++ /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 index 9c66aa9d..00000000 --- a/checkSSE2/main.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -//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