Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

The length of the extrusion that the RepRap5D ExtrusionUpdater should…

… send depends on the gear ratio of the extruder. E.g. for a Wade-style extruder with hobbed bolt, there are more steps needed for one revolution. The motor_steps parameter of the tool now configures this length, the default has remained the same, but now it's configurable. Example usage i

s in machines/ultimaker.xml.
  • Loading branch information...
commit f587d17060875520a035ea8ec5a295d0750af7bc 1 parent 2838824
@ErikDeBruijn ErikDeBruijn authored cibomahto committed
View
2  machines/ultimaker.xml
@@ -9,7 +9,7 @@
<axis id="z" length="210" maxfeedrate="150" stepspermm="160" endstops="min"/> <!-- quarter-step driver -->
</geometry>
<tools>
- <tool name="Stepper-based pinch extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" heatedplatform="true" motor_steps="200" default_rpm="1000" />
+ <tool name="Stepper-based pinch extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" heatedplatform="true" motor_steps="1800" default_rpm="1000" />
</tools>
<clamps></clamps>
<firmware url="http://firmware.ultimaker.com/latest" autoupgrade="false"></firmware>
View
4 src/replicatorg/drivers/DriverBaseImplementation.java
@@ -477,6 +477,10 @@ public int getMotorSpeedPWM() {
return machine.currentTool().getMotorSpeedReadingPWM();
}
+ public double getMotorSteps() {
+ return machine.currentTool().getMotorSteps();
+ }
+
// TODO: These are backwards?
public void readToolStatus() {
}
View
23 src/replicatorg/drivers/reprap/ExtrusionUpdater.java
@@ -6,6 +6,8 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
+import replicatorg.app.Base;
+
/**
* The extrusion thread provides 5D extrude commands at a regular frequency so that manual
* extruder control will work with the RepRap 5D firmware.
@@ -22,11 +24,14 @@
/** the time (ms) the last extrude command will complete or zero if unset */
private long extrudeQueueEnd = 0;
- /** the time length of each extrusion command */
+ /** the time length of each extrusion command
+ * will be overriden if motor_steps is configured, and is set to a
+ * different value than 200 steps.
+ * */
private long commandPeriod = 100; //ms
/** queue this many commands into the future. Larger = smoother extrusion,
* smaller = more responsive manual extrusion. */
- private int maxQueuedExtrudeTime = 500; //ms
+ private int maxQueuedExtrudeTime = 200; //ms
@@ -41,10 +46,24 @@ public ExtrusionUpdater(RepRap5DDriver driver)
this.driver = driver;
}
+ private void determineCommandPeriod() {
+ // override with motor_steps from tool model (uses machine's XML file)
+ // should be initialized elsewhere, but somehow the driver/tool_model isn't initialized yet.
+ double motorSteps = driver.getMotorSteps();
+ if(motorSteps == 0.0) {
+ motorSteps = 200;
+ }
+ Base.logger.info("motorSteps="+motorSteps);
+ this.commandPeriod = (long) (motorSteps/2); //ms
+ Base.logger.info("commandPeriod="+this.commandPeriod);
+
+ }
private void sendExtrudeCommand(double distance, double feedrate) {
+ determineCommandPeriod();
String feedrateString = driver.df.format(feedrate);
+// Base.logger.info("commandPeriod="+this.commandPeriod);
if (driver.feedrate.get() != feedrate)
{
driver.sendCommand(driver._getToolCode() + "G1 F"+feedrateString);
View
9 src/replicatorg/machine/model/ToolModel.java
@@ -58,7 +58,7 @@
protected boolean motorHasEncoder;
protected int motorEncoderPPR;
protected boolean motorIsStepper;
- protected int motorSteps; // motor steps per full rotation
+ protected double motorSteps; // motor steps per full rotation
protected String motorStepperAxis; // Stepper axis this motor is connected to
//spindle stuff
@@ -200,10 +200,10 @@ public void loadXML(Node node)
// Get number of steps per full rotation of the toolhead motor.
n = XML.getAttributeValue(xml, "motor_steps");
try{
- if (n != null && Integer.parseInt(n) > 0)
+ if (n != null && Double.parseDouble(n) > 0.0)
{
motorIsStepper = true;
- motorSteps = Integer.parseInt(n);
+ motorSteps = Double.parseDouble(n);
}
} catch (Exception e) {} // ignore parse errors.
@@ -378,7 +378,8 @@ public double getMotorSpeedRPM()
/**
* Get number of steps per revolution
*/
- public double getMotorSteps() {
+ public double getMotorSteps()
+ {
return motorSteps;
}
Please sign in to comment.
Something went wrong with that request. Please try again.