Skip to content

Commit

Permalink
* Added comments to ToolModel to clarify use
Browse files Browse the repository at this point in the history
* Added info/comments to MachineModel to clarify use
* Updated Replicator.xml to clarify and update tools RPM and names
* Changed source of RPM speed in ExtruderPanel to avoid bad-data bug
* Documented more of MightyBoard.java
* Changed some initialization of MightyBoard to create first-connection smoothness
* Added new setMotorRPM to MightyBoard to avoid sending cmd to bot for MightyBoard
* Converted Sanguino3GDriver's 'getVersionInternal' to a proper sync and init function to fix inheritance problems with initialization of MightyBoard
* Added Documentation to Makerbot4GAlternateDriver
  • Loading branch information
FarMcKon committed Dec 16, 2011
1 parent cd44db8 commit 01999b7
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 141 deletions.
97 changes: 5 additions & 92 deletions machines/replicator.xml
@@ -1,105 +1,18 @@
<?xml version="1.1" encoding="utf-8"?>
<machines>
<machine experimental="1">
<name>The Replicator Dual Rev-A</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="80" maxfeedrate="10000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="y" length="80" maxfeedrate="10000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="400" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
<axis id="b" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
</geometry>
<tools>
<tool name="Left" index="0" type="extruder" motor="true" fan="false" heatedplatform="true" motor_steps="1600" default_rpm="3" heater="true" stepper_axis="a"/>
</tools>
<wipes>
<wipe index="0" X1="44.0" Y1="55.0" Z1="9" X2="44.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
<wipe index="1" X1="-36.0" Y1="55.0" Z1="9" X2="-45.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
</wipes>
<clamps></clamps>
<driver name="makerbot4ga">
<!-- optional: <portname>COM1</portname> -->
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
(Turn off steppers after a build.)
M18
</cooldown>
</machine>
<machine experimental="1">
<name>The Replicator Dual Rev-D</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="211" maxfeedrate="10000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="y" length="148" maxfeedrate="10000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="z" length="158" maxfeedrate="1000" homingfeedrate="1000" stepspermm="400" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
<axis id="b" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
</geometry>
<tools>
<tool name="Right (B)" index="1" type="extruder" motor="true" fan="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="b"/>
<tool name="Left (A)" index="0" type="extruder" motor="true" fan="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="a"/>
</tools>
<wipes>
<wipe index="0" X1="44.0" Y1="55.0" Z1="9" X2="44.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
<wipe index="1" X1="-36.0" Y1="55.0" Z1="9" X2="-45.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
</wipes>
<clamps></clamps>
<driver name="makerbot4ga">
<!-- optional: <portname>COM1</portname> -->
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
M18 (Turn off steppers after a build.)
</cooldown>
</machine>
<machine experimental="1">
<name>The Replicator Dual Rev-F</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="211" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="y" length="148" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="z" length="158" maxfeedrate="1400" homingfeedrate="1100" stepspermm="200" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
<axis id="b" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
</geometry>
<tools>
<tool name="Right (B/1)" index="1" type="extruder" motor="true" fan="false" heatedplatform="false" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="b"/>
<tool name="Left (A/0)" index="0" type="extruder" motor="true" fan="false" heatedplatform="false" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="a"/>
</tools>
<wipes>
<wipe index="0" X1="44.0" Y1="55.0" Z1="9" X2="44.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
<wipe index="1" X1="-36.0" Y1="55.0" Z1="9" X2="-45.0" Y2="55.0" Z2="9" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="25.0"/>
</wipes>
<clamps></clamps>
<driver name="makerbot4ga">
<!-- optional: <portname>COM1</portname> -->
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
M18 (Turn off steppers after a build.)
</cooldown>
</machine>
<machine experimental="0">
<name>The Replicator Dual (Shipping Config) </name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="227" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="y" length="148" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="z" length="150" maxfeedrate="1400" homingfeedrate="1100" stepspermm="200" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="z" length="150" maxfeedrate="1400" homingfeedrate="1100" stepspermm="400" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
<axis id="b" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
</geometry>
<tools>
<tool name="A/Left (T1)" index="1" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="b"/>
<tool name="B/Right (T0)" index="0" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="a"/>
<tool name="Mk7 Left" stepper_axis="b" index="1" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true"/>
<tool name="Mk7 Right" stepper_axis="a" index="0" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true"/>
</tools>
<wipes>
<wipe index="0" X1="-135.0" Y1="55.0" Z1="0" X2="-135.0" Y2="45.0" Z2="0" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="35.0"/>
Expand All @@ -122,11 +35,11 @@ M18 (Turn off steppers after a build.)
<!-- different pulleys on X and Y axii -->
<axis id="x" length="227" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="y" length="148" maxfeedrate="5000" homingfeedrate="2500" stepspermm="94.139704" endstops="max"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
<axis id="z" length="150" maxfeedrate="1400" homingfeedrate="1100" stepspermm="200" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="z" length="150" maxfeedrate="1400" homingfeedrate="1100" stepspermm="400" endstops="min"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
</geometry>
<tools>
<tool name="Mk7" index="0" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true" stepper_axis="a"/>
<tool name="Mk7" stepper_axis="a" index="0" type="extruder" motor="true" fan="true" automatedplatform="true" heatedplatform="true" motor_steps="3200" default_rpm="3" heater="true"/>
</tools>
<wipes>
<wipe index="0" X1="-135.0" Y1="55.0" Z1="0" X2="-135.0" Y2="45.0" Z2="0" wait="1000.0" purge_duration="1000" reverse_duration="15" purge_rpm="5.0" reverse_rpm="35.0"/>
Expand Down
13 changes: 10 additions & 3 deletions src/replicatorg/app/ui/controlpanel/ExtruderPanel.java
Expand Up @@ -188,16 +188,21 @@ public ExtruderPanel(MachineInterface machine, ToolModel tool) {

// create our initial panel
setLayout(new MigLayout());

// create our motor options
if (tool.hasMotor()) {

// Due to current implementation issues, we need to send the PWM
// before the RPM for a stepper motor. Thus we display both controls in these
// cases. This shouldn't be necessary for a Gen4 stepper extruder. (it's not!)
if ((tool.getMotorStepperAxis() == null) && !(tool.motorHasEncoder() || tool.motorIsStepper())) {
if ((tool.getMotorStepperAxis() == null) &&
!(tool.motorHasEncoder() || tool.motorIsStepper())) {
// our motor speed vars
JLabel label = makeLabel("Motor Speed (PWM)");

JFormattedTextField field = new CallbackTextField(this, "handleTextField", "motor-speed-pwm", 9, Base.getLocalFormat());
field.setValue(Integer.toString(machine.getDriverQueryInterface().getMotorSpeedPWM()));
field.setValue(Integer.toString(tool.getMotorSpeedReadingPWM()) );// <-- should be
//field.setValue(Integer.toString(machine.getDriver().getMotorSpeedPWM()));
add(label);
add(field,"wrap");
}
Expand All @@ -206,7 +211,8 @@ public ExtruderPanel(MachineInterface machine, ToolModel tool) {
// our motor speed vars
JLabel label = makeLabel("Motor Speed (RPM)");
JFormattedTextField field = new CallbackTextField(this, "handleTextField", "motor-speed", 9, Base.getLocalFormat());
field.setValue(machine.getDriverQueryInterface().getMotorRPM());
field.setValue(tool.getMotorSpeedReadingRPM() );// <-- should be
//field.setValue(machine.getDriver().getMotorRPM());
add(label);
add(field,"wrap");

Expand All @@ -222,6 +228,7 @@ public ExtruderPanel(MachineInterface machine, ToolModel tool) {
add(timeList,"wrap");
}
}

// create our motor options
JLabel motorEnabledLabel = makeLabel("Motor Control");

Expand Down
3 changes: 2 additions & 1 deletion src/replicatorg/drivers/gen3/Makerbot4GAlternateDriver.java
Expand Up @@ -377,7 +377,8 @@ public void setMachine(MachineModel m) {

@Override
/**
* Overridden to not ask the board for the RPM as it would report the RPM from the extruder controller, which doesn't know about it in this case.
* Overridden to not ask the board for the RPM as it would report the RPM from the extruder
* controller, which doesn't know about it in this case.
*/
public double getMotorRPM() {
double rpm = machine.currentTool().getMotorSpeedRPM();
Expand Down
71 changes: 67 additions & 4 deletions src/replicatorg/drivers/gen3/MightyBoard.java
Expand Up @@ -76,7 +76,6 @@
//
//
// public final int offset;
// public final int byteSz;
// public final String info;
//
// /// standard constructor.
Expand Down Expand Up @@ -233,16 +232,40 @@ public MightyBoard() {
stepperValues= new Hashtable();

}

/**
* Initalize the extruder or sub-controllers.
* For mightyboard, this involves setting some tool values,
* and checking some eeprom values
* @param toolIndex
* @return
*/
public boolean initSlave(int toolIndex)
{
// since our motor speed is controlled by host software,
// initalize 'running' motor speed to be the same as the
// default motor speed
ToolModel curTool = machine.getTool(toolIndex);
curTool.setMotorSpeedReadingRPM( curTool.getMotorSpeedRPM() );
return true;
}

/**
* This function is called just after a connection is made, to do initial
* sycn of any values stored in software that are not available by
* s3g command. For example, stepper vRef
* @see replicatorg.drivers.gen3.Sanguino3GDriver#initialSync()
* @see replicatorg.drivers.gen3.Sanguino3GDriver#pullInitialValuesFromBot()
*/
@Override
public void initialSync()
public boolean initializeBot()
{
// Scan for each slave
for (ToolModel t : getMachine().getTools()) {
if (t != null) {
initSlave(t.getIndex());
}
}

int stepperCountMightyBoard = 5;
Base.logger.severe("MightBoard initial Sync");
for(int i = 0; i < stepperCountMightyBoard; i++)
Expand All @@ -252,6 +275,13 @@ public void initialSync()
Base.logger.info("i = " + i + " vRef =" + vRef);
stepperValues.put(new Integer(i), new Integer(vRef) );
}

//load our motor RPM from firmware if we can.
getMotorRPM();

//
getSpindleSpeedPWM();
return true;
}


Expand Down Expand Up @@ -709,7 +739,7 @@ protected void writeToToolEEPROM(int offset, byte[] data) {


@Override
protected void writeToToolEEPROM(int offset, byte[] data, int toolIndex) {
protected void writeToToolEEPROM(int offset, byte[] data, int toolIndex) {
final int MAX_PAYLOAD = 11;
while (data.length > MAX_PAYLOAD) {
byte[] head = new byte[MAX_PAYLOAD];
Expand Down Expand Up @@ -1018,11 +1048,44 @@ public double getTemperatureSetting() {
}
return super.getTemperatureSetting();
}



public Version getToolVersion() {
return toolVersion;
}

@Override
public void setMotorRPM(double rpm) throws RetryException {

///TRICKY: fot The Replicator,the firmware no longer handles this command
// it's all done on host side via 5D command translation

// convert RPM into microseconds and then send.
// long microseconds = rpm == 0 ? 0 : Math.round(60.0 * 1000000.0 / rpm); // no
// // unsigned
// // ints?!?
// // microseconds = Math.min(microseconds, 2^32-1); // limit to uint32.
//
// Base.logger.fine("Setting motor 1 speed to " + rpm + " RPM ("
// + microseconds + " microseconds)");
//
// // send it!
// PacketBuilder pb = new PacketBuilder(
// MotherboardCommandCode.TOOL_COMMAND.getCode());
// pb.add8((byte) machine.currentTool().getIndex());
// pb.add8(ToolCommandCode.SET_MOTOR_1_RPM.getCode());
// pb.add8((byte) 4); // length of payload.
// pb.add32(microseconds);
// runCommand(pb.getPacket());
//

machine.currentTool().setMotorSpeedRPM(rpm);
// super.setMotorRPM(rpm); TODO: this should be setMotorRPM running?
// check read value vs running/tested value
}




}
Expand Down

0 comments on commit 01999b7

Please sign in to comment.