From: <adr...@us...> - 2011-01-24 22:14:17
|
Revision: 4012 http://reprap.svn.sourceforge.net/reprap/?rev=4012&view=rev Author: adrian-bowyer Date: 2011-01-24 22:14:11 +0000 (Mon, 24 Jan 2011) Log Message: ----------- Fixed (I hope) bug whereby extruder valve values affected things even if a valve is not in use (i.e. ValvePulseTime < 0). Modified Paths: -------------- trunk/software/host/src/org/reprap/Printer.java trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/machines/GenericRepRap.java Modified: trunk/software/host/src/org/reprap/Printer.java =================================================================== --- trunk/software/host/src/org/reprap/Printer.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/Printer.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -451,25 +451,25 @@ // */ // public int convertFeedrateToSpeedZ(double feedrate); +// /** +// * The X discretisation +// * @return +// */ +// public double getXStepsPerMM(); +// +// /** +// * The Y discretisation +// * @return +// */ +// public double getYStepsPerMM(); +// +// /** +// * The Z discretisation +// * @return +// */ +// public double getZStepsPerMM(); +// /** - * The X discretisation - * @return - */ - public double getXStepsPerMM(); - - /** - * The Y discretisation - * @return - */ - public double getYStepsPerMM(); - - /** - * The Z discretisation - * @return - */ - public double getZStepsPerMM(); - - /** * If we are using an output buffer, it's a good idea to wait till * it's empty between layers before computing the next one. */ Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -12,6 +12,7 @@ import java.io.FileReader; import java.io.OutputStream; import java.io.PrintStream; +import java.util.Date; import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; @@ -706,9 +707,32 @@ String lns; resetReceived(); boolean goAgain; + Date timer = new Date(); + long startWait = timer.getTime(); + long timeNow; + long increment = 2000; + long longWait = 10*60*1000; // 10 mins... for(;;) { + timeNow = timer.getTime() - startWait; + if(timeNow > increment) + { + Debug.d("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds."); + increment = 2*increment; + } + + if(timeNow > longWait) + { + Debug.e("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds."); + try { + queue("M0 ;shut RepRap down"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + try { i = serialInStream.read(); Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -1011,6 +1011,8 @@ */ public double getValveDelayForLayer() { + if(valvePulseTime < 0) + return 0; return valveDelayForLayer; } @@ -1021,6 +1023,8 @@ */ public double getValveDelayForPolygon() { + if(valvePulseTime < 0) + return 0; return valveDelayForPolygon; } @@ -1038,6 +1042,8 @@ */ public double getValveOverRun() { + if(valvePulseTime < 0) + return 0; return valveOverRun; } Modified: trunk/software/host/src/org/reprap/machines/GenericRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -411,54 +411,54 @@ Debug.e("selectExtruder() - extruder not found for: " + att.getMaterial()); } - /** - * FIXME: Why don't these use round()? - AB. - * @param n - * @return - */ - protected int convertToStepX(double n) { - return (int)((n + getExtruder().getOffsetX()) * scaleX); - } - - /** - * @param n - * @return - */ - protected int convertToStepY(double n) { - return (int)((n + getExtruder().getOffsetY()) * scaleY); - } - - /** - * @param n - * @return - */ - protected int convertToStepZ(double n) { - return (int)((n + getExtruder().getOffsetZ()) * scaleZ); - } - - /** - * @param n - * @return - */ - protected double convertToPositionX(int n) { - return n / scaleX - getExtruder().getOffsetX(); - } - - /** - * @param n - * @return - */ - protected double convertToPositionY(int n) { - return n / scaleY - getExtruder().getOffsetY(); - } - - /** - * @param n - * @return - */ - protected double convertToPositionZ(int n) { - return n / scaleZ - getExtruder().getOffsetZ(); - } +// /** +// * FIXME: Why don't these use round()? - AB. +// * @param n +// * @return +// */ +// protected int convertToStepX(double n) { +// return (int)((n + getExtruder().getOffsetX()) * scaleX); +// } +// +// /** +// * @param n +// * @return +// */ +// protected int convertToStepY(double n) { +// return (int)((n + getExtruder().getOffsetY()) * scaleY); +// } +// +// /** +// * @param n +// * @return +// */ +// protected int convertToStepZ(double n) { +// return (int)((n + getExtruder().getOffsetZ()) * scaleZ); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionX(int n) { +// return n / scaleX - getExtruder().getOffsetX(); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionY(int n) { +// return n / scaleY - getExtruder().getOffsetY(); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionZ(int n) { +// return n / scaleZ - getExtruder().getOffsetZ(); +// } /* (non-Javadoc) * @see org.reprap.Printer#getX() @@ -1118,67 +1118,67 @@ return foundationLayers; } - //TODO: MAKE THIS WORK! - // Works for me! - AB - public int convertFeedrateToSpeedXY(double feedrate) - { - //Debug.d("feedrate: " + feedrate); - - //pretty straightforward - double stepsPerMinute = feedrate * scaleX; - //Debug.d("steps/min: " + stepsPerMinute); - - //ticks per minute divided by the steps we need to take. - double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); - //Debug.d("ticks between steps: " + ticksBetweenSteps); - - int picTimer = 256 - (int)Math.round(ticksBetweenSteps); - //Debug.d("pic timer: " + picTimer); - - //bounds checking. - picTimer = Math.min(255, picTimer); - picTimer = Math.max(0, picTimer); - - return picTimer; - } - +// //TODO: MAKE THIS WORK! +// // Works for me! - AB +// public int convertFeedrateToSpeedXY(double feedrate) +// { +// //Debug.d("feedrate: " + feedrate); +// +// //pretty straightforward +// double stepsPerMinute = feedrate * scaleX; +// //Debug.d("steps/min: " + stepsPerMinute); +// +// //ticks per minute divided by the steps we need to take. +// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); +// //Debug.d("ticks between steps: " + ticksBetweenSteps); +// +// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); +// //Debug.d("pic timer: " + picTimer); +// +// //bounds checking. +// picTimer = Math.min(255, picTimer); +// picTimer = Math.max(0, picTimer); +// +// return picTimer; +// } +// +// +// //TODO: MAKE THIS WORK! +// public int convertFeedrateToSpeedZ(double feedrate) +// { +// //pretty straightforward +// double stepsPerMinute = feedrate * scaleZ; +// +// //ticks per minute divided by the steps we need to take. +//// long ticksBetweenSteps = Math.round(60000000 / 256 / stepsPerMinute); +//// int picTimer = (256 - (int)ticksBetweenSteps); +// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); +// //Debug.d("ticks between steps: " + ticksBetweenSteps); +// +// //System.out.println("Z ticksBetweenSteps = " + ticksBetweenSteps); +// +// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); +// +// //bounds checking. +// picTimer = Math.min(255, picTimer); +// picTimer = Math.max(0, picTimer); +// +// return picTimer; +// } +// +// public double getXStepsPerMM() +// { +// return scaleX; +// } +// public double getYStepsPerMM() +// { +// return scaleY; +// } +// public double getZStepsPerMM() +// { +// return scaleZ; +// } - //TODO: MAKE THIS WORK! - public int convertFeedrateToSpeedZ(double feedrate) - { - //pretty straightforward - double stepsPerMinute = feedrate * scaleZ; - - //ticks per minute divided by the steps we need to take. -// long ticksBetweenSteps = Math.round(60000000 / 256 / stepsPerMinute); -// int picTimer = (256 - (int)ticksBetweenSteps); - double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); - //Debug.d("ticks between steps: " + ticksBetweenSteps); - - //System.out.println("Z ticksBetweenSteps = " + ticksBetweenSteps); - - int picTimer = 256 - (int)Math.round(ticksBetweenSteps); - - //bounds checking. - picTimer = Math.min(255, picTimer); - picTimer = Math.max(0, picTimer); - - return picTimer; - } - - public double getXStepsPerMM() - { - return scaleX; - } - public double getYStepsPerMM() - { - return scaleY; - } - public double getZStepsPerMM() - { - return scaleZ; - } - /** * Load an STL file to be made. * @return the name of the file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |