From: <adr...@us...> - 2010-09-09 21:59:23
|
Revision: 3786 http://reprap.svn.sourceforge.net/reprap/?rev=3786&view=rev Author: adrian-bowyer Date: 2010-09-09 21:59:16 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Host code modified to report any endstop errors when the axes are all zeroed in the GUI. Debug has to be enabled to get the message. Modified Paths: -------------- trunk/software/host/src/org/reprap/Printer.java trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java trunk/software/host/src/org/reprap/machines/Simulator.java Modified: trunk/software/host/src/org/reprap/Printer.java =================================================================== --- trunk/software/host/src/org/reprap/Printer.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/Printer.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -257,6 +257,13 @@ public double[] getCoordinates() throws Exception; /** + * Get the zero errors + * @return + * @throws Exception + */ + public double[] getZeroError() throws Exception; + + /** * Tell the printer class it's Z position. Only to be used if * you know what you're doing... * @param z Modified: trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -8,6 +8,7 @@ import java.io.IOException; import org.reprap.Printer; +import org.reprap.utilities.Debug; /** * * @author ensab @@ -17,6 +18,7 @@ private double XYfastSpeed; private double ZfastSpeed; + private boolean firstZero = true; private Printer printer; private static double nudgeSize = 0; private BotConsoleFrame parentBotConsoleFrame = null; @@ -71,6 +73,7 @@ /** Creates new form XYZTabPanel */ public XYZTabPanel() { + firstZero = true; printer = org.reprap.Main.gui.getPrinter(); initComponents(); try @@ -468,18 +471,24 @@ public void homeAll() { + double ze[] = new double[4]; parentBotConsoleFrame.suspendPolling(); try { printer.home(); + if(!firstZero) + ze = printer.getZeroError(); } catch (Exception e) { parentBotConsoleFrame.handleException(e); } + if(!firstZero) + Debug.d("Zero errors (steps). X:" + ze[0] + " Y:" + ze[1] + " Z:" + ze[2]); xStepperPositionJPanel.zeroBox(); yStepperPositionJPanel.zeroBox(); zStepperPositionJPanel.zeroBox(); // xStepperPositionJPanel.homeAxis(); // yStepperPositionJPanel.homeAxis(); // zStepperPositionJPanel.homeAxis(); + firstZero = false; parentBotConsoleFrame.resumePolling(); } Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -42,7 +42,7 @@ super(); gcode = new GCodeReaderAndWriter(); - + gcode.queue("M110 ; Reset the line numbers"); loadExtruders(); forceSelection = true; @@ -454,9 +454,9 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd:HH-mm-ss"); String myDateString = sdf.format(myDate); gcode.queue("; Created: " + myDateString); + gcode.queue(";#!RECTANGLE: " + lc.getBox()); - gcode.queue(";#!RECTANGLE: " + lc.getBox()); - + gcode.queue("M110 ; Reset the line numbers"); //take us to fun, safe metric land. gcode.queue("G21 ;metric is good!"); @@ -585,6 +585,22 @@ result[3] = gcode.getE(); return result; } + + /** + * Get X, Y, Z and E (if supported) coordinates in an array + * @return + * @throws Exception + */ + public double[] getZeroError() throws Exception + { + gcode.queue("M117; get error coordinates"); + double [] result = new double[4]; + result[0] = gcode.getX(); + result[1] = gcode.getY(); + result[2] = gcode.getZ(); + result[3] = gcode.getE(); + return result; + } /* (non-Javadoc) * @see org.reprap.Printer#homeToZeroX() Modified: trunk/software/host/src/org/reprap/machines/Simulator.java =================================================================== --- trunk/software/host/src/org/reprap/machines/Simulator.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/machines/Simulator.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -95,6 +95,17 @@ return result; } + public double[] getZeroError() throws Exception + { + double [] result = new double[4]; + result[0] = 0; + result[1] = 0; + result[2] = 0; + result[3] = 0; + + return result; + } + public void delay(long millis) {} //TODO: make this work normally. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |