Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated driver code, etc. #267

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
32b246d
Added a (failing) test to demonstrate dithering.
cbiffle Mar 9, 2012
cab13a4
Removed the excess-tracking code from the drivers.
cbiffle Mar 9, 2012
3cfb577
Fixed compilation errors in MachineLoaderTest.
cbiffle Mar 9, 2012
c01bd8d
Removed unused deprecated code in Sanguino3GDriver.
cbiffle Mar 9, 2012
45dc178
Fixed incorrect override that disabled stepper fan.
cbiffle Mar 9, 2012
f9db2bb
Removed overrides of deprecated API in MightyBoard.
cbiffle Mar 9, 2012
75c54f1
Improved code reuse in Makerbot4G*Driver.
cbiffle Mar 9, 2012
5ea1e1c
@Deprecated/@Override cleanup in Driver classes.
cbiffle Mar 9, 2012
ecc5d15
Cleaned up DriverBaseImplementation, mostly.
cbiffle Mar 9, 2012
3b6b3f6
Marked SerialDriver as abstract.
cbiffle Mar 9, 2012
17b477d
Cleaned up Sanguino3GDriver, mostly.
cbiffle Mar 9, 2012
1b37a7c
Cleaned up Makerbot4GDriver.
cbiffle Mar 9, 2012
8172560
Removed an unused variable from MB4GAD.
cbiffle Mar 9, 2012
ff84f72
Miscellaneous cleanups in driver package:
cbiffle Mar 10, 2012
77bf80a
Fixed infinite recursion in setMotorDirection.
cbiffle Mar 10, 2012
49bf43b
Added @Overrides in two virtual drivers.
cbiffle Mar 10, 2012
0b374df
Modernizing Driver's API.
cbiffle Mar 10, 2012
06a13f0
Modernized DriverQueryInterface.
cbiffle Mar 10, 2012
3202278
Removed old-style tool status methods from Driver.
cbiffle Mar 10, 2012
9901d17
Removed old-style methods for motor speed/dir from Driver.
cbiffle Mar 10, 2012
b1060b9
Removed old-style motor enable/disable methods from Driver.
cbiffle Mar 10, 2012
7d0291f
Removed old-style temperature control methods from Driver.
cbiffle Mar 10, 2012
102a0f7
Removed old-style fan control methods from Driver.
cbiffle Mar 10, 2012
4ecb79c
Removed old-style ABP method from Driver.
cbiffle Mar 10, 2012
9af8624
Removed old-style valve control methods from Driver.
cbiffle Mar 10, 2012
c54fd32
Removed old-style spindle methods from Driver.
cbiffle Mar 10, 2012
7af51aa
Valve G-Code commands are now multi-tool aware.
cbiffle Mar 10, 2012
5bd64ac
Spindle and temperature G-Codes are now multitool-aware.
cbiffle Mar 10, 2012
f3db5c8
Most (all?) commands now take explicit tool indices.
cbiffle Mar 10, 2012
0e207ef
Added driver name and stop info to DriverQueryInterface.
cbiffle Mar 10, 2012
7b9c9cb
Added code to defend against the negative tool hack.
cbiffle Mar 10, 2012
d6c7147
Fixed a typo introduced in 06a13f07.
cbiffle Mar 10, 2012
f2343b0
Cleaned up MCode parser to use 'tool' field.
cbiffle Mar 10, 2012
bf8c128
Fixed HBP control hack in ExtruderPanel.
cbiffle Mar 10, 2012
98c625e
Removed bogus NaN check in ExtruderPanel.
cbiffle Mar 10, 2012
e21879f
Merge branch 'master' of https://github.com/makerbot/ReplicatorG into…
cbiffle Mar 12, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleaned up Sanguino3GDriver, mostly.
Tightened access modifiers as much as possible.

Removed do-nothing overrides that just call the super impl.

Removed a dead null check (line 349).

Removed commented-out code.

Propagated @deprecated forward from Driver.

Did not remove all dead code.  This driver contains the same
attempted overrides as DriverBaseImplementation; I've left
them private, so that they light up on a dead code analysis
pass but aren't lost to the mists of time (or git log).  I
expect to expose these shortly.
cbiffle committed Mar 9, 2012
commit 17b477d63be4339fef54fa58c5a9d0e95523abab
92 changes: 23 additions & 69 deletions src/replicatorg/drivers/gen3/Sanguino3GDriver.java
Original file line number Diff line number Diff line change
@@ -35,8 +35,6 @@
import java.util.Vector;
import java.util.logging.Level;

import org.w3c.dom.Node;

import replicatorg.app.Base;
import replicatorg.drivers.DriverError;
import replicatorg.drivers.MultiTool;
@@ -52,8 +50,6 @@
import replicatorg.uploader.FirmwareUploader;
import replicatorg.util.Point5d;

import replicatorg.drivers.gen3.EEPROMClass;

class Sanguino3GEEPRPOM implements EEPROMClass {

public static final int EEPROM_CHECK_LOW = 0x5A;
@@ -105,12 +101,11 @@ public class Sanguino3GDriver extends SerialDriver implements
OnboardParameters, SDCardCapture, PenPlotter, MultiTool {
protected final static int DEFAULT_RETRIES = 5;

Version toolVersion = new Version(0, 0);
private Version toolVersion = new Version(0, 0);

private boolean eepromChecked = false;

public Sanguino3GDriver() {
super();
hasEmergencyStop = true;
hasSoftStop = true;

@@ -121,11 +116,6 @@ public Sanguino3GDriver() {
setInitialized(false);
}

@Override public void loadXML(Node xml) {
super.loadXML(xml);

}

@Override public void initialize() {
Base.logger.fine("Attempting to initialize device");

@@ -159,16 +149,14 @@ public Sanguino3GDriver() {
sendInit();
super.initialize();
invalidatePosition();

return;
} else {
Base.logger.info("Unable to connect to firmware.");
// Dispose of driver to free up any resources
dispose();
}
}

public boolean initializeBot()
protected boolean initializeBot()
{
// Scan for each slave
for (ToolModel t : getMachine().getTools()) {
@@ -220,7 +208,7 @@ private boolean attemptConnection() {
* handshake.
* @return true if we received a handshake; false if we timed out.
*/
protected void connectToDevice(int timeoutMillis) {
private void connectToDevice(int timeoutMillis) {
assert (serial != null);
synchronized (serial) {
serial.clear();
@@ -299,7 +287,7 @@ protected PacketResponse runQuery(byte[] packet) {
}


void printDebugData(String title, byte[] data) {
private void printDebugData(String title, byte[] data) {
StringBuffer buf = new StringBuffer(title + ": ");
for (int i = 0; i < data.length; i++) {
buf.append(Integer.toHexString((int) data[i] & 0xff));
@@ -325,7 +313,7 @@ void printDebugData(String title, byte[] data) {
* @return
* @throws RetryException
*/
protected PacketResponse runCommand(byte[] packet, int retries)
private PacketResponse runCommand(byte[] packet, int retries)
throws RetryException {

if (retries == 0) {
@@ -383,11 +371,6 @@ protected PacketResponse runCommand(byte[] packet, int retries)

pp = new PacketProcessor();

if(packet == null) {
Base.logger.severe("null packet in runCommand");
return PacketResponse.timeoutResponse();
}

// This can actually happen during shutdown.
if (serial == null){
Base.logger.severe("null serial in runCommand");
@@ -447,7 +430,7 @@ protected PacketResponse runCommand(byte[] packet, int retries)
return pr;
}

static boolean isNotifiedFinishedFeature = false;
private static boolean isNotifiedFinishedFeature = false;

@Override public boolean isFinished() {
if (fileCaptureOstream != null) {
@@ -497,10 +480,6 @@ protected PacketResponse runCommand(byte[] packet, int retries)
return finished;
}

@Override public void dispose() {
super.dispose();
}

/***************************************************************************
* commands used internally to driver
**************************************************************************/
@@ -509,7 +488,7 @@ protected PacketResponse runCommand(byte[] packet, int retries)
* Make an inital connection to read the version code.
* @return
*/
public Version getVersionInternal() {
private Version getVersionInternal() {

PacketBuilder pb = new PacketBuilder(MotherboardCommandCode.VERSION.getCode());
pb.add16(Base.VERSION);
@@ -639,13 +618,9 @@ private void initSlave(int toolhead) {
}
}
}
// //TRICKY: this is just called to get the value cached into the ToolModel
// double ignore = getMotorRPM(toolIndex);


}

public void sendInit() {
private void sendInit() {
PacketBuilder pb = new PacketBuilder(
MotherboardCommandCode.INIT.getCode());
runQuery(pb.getPacket());
@@ -686,10 +661,6 @@ public void sendInit() {
}
}

// public Point3d getPosition() {
// return new Point3d();
// }

/*
* //figure out the axis with the most steps. Point3d steps =
* getAbsDeltaSteps(getCurrentPosition(), p); Point3d delta_steps =
@@ -735,11 +706,6 @@ protected void queueAbsolutePoint(Point5d steps, long micros)
}

@Override public void setCurrentPosition(Point5d p) throws RetryException {
// System.err.println(" SCP: "+p.toString()+
// " (current "+getCurrentPosition().toString()+")");
// if (super.getCurrentPosition().equals(p)) return;
// System.err.println("COMMIT: "+p.toString()+
// " (current "+getCurrentPosition().toString()+")");
PacketBuilder pb = new PacketBuilder(
MotherboardCommandCode.SET_POSITION.getCode());

@@ -964,16 +930,11 @@ private int axesToBitfield(EnumSet<AxisId> axes) {
pb.add32(microseconds);
runCommand(pb.getPacket());

//TRICKY: WAS 'super.setMotorRPM(rpm);', but this seems not to work right.
// Seems to set default motor value(motorSpeedRPM , not 'running' motor
// value. Caused gui to show bad values
// machine.getTool(toolhead).setMotorSpeedReadingRPM(rpm);
// Changed back - Ted
super.setMotorRPM(rpm, toolhead);
}


@Override public void setMotorSpeedPWM(int pwm) throws RetryException {
@Deprecated @Override public void setMotorSpeedPWM(int pwm) throws RetryException {
this.setMotorSpeedPWM(pwm, machine.currentTool().getIndex());
}

@@ -1054,7 +1015,7 @@ public void disableMotor(int toolhead) throws RetryException {
super.disableMotor(toolhead);
}

public int getMotorSpeedPWM(int toolhead) {
private int getMotorSpeedPWM(int toolhead) {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1082,7 +1043,7 @@ public int getMotorSpeedPWM(int toolhead) {
return getMotorRPM(machine.currentTool().getIndex());
}

public double getMotorRPM(int toolhead) {
private double getMotorRPM(int toolhead) {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1107,8 +1068,7 @@ public double getMotorRPM(int toolhead) {
return rpm;
}


public void readToolStatus(int toolhead) {
private void readToolStatus(int toolhead) {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1149,7 +1109,7 @@ private int fixSigned(int value) {
}

// TODO: Implement a way for this to reach the outside
public void readToolPIDState(int toolhead) {
private void readToolPIDState(int toolhead) {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1188,18 +1148,12 @@ public void readToolPIDState(int toolhead) {
*
* @throws RetryException
**************************************************************************/
// public void moveServo(int degree) {}

// public void enableServo() {}

// public void disableServo() {}

@Override @Deprecated
public void setServoPos(int index, double degree) throws RetryException {
this.setServoPos(index, degree, machine.currentTool().getIndex());
}

public void setServoPos(int index, double degree, int toolhead) throws RetryException {
private void setServoPos(int index, double degree, int toolhead) throws RetryException {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1342,7 +1296,7 @@ public void setServoPos(int index, double degree, int toolhead) throws RetryExce
super.disableSpindle(toolhead);
}

public double getSpindleSpeedRPM(int toolhead) throws RetryException {
private double getSpindleSpeedRPM(int toolhead) throws RetryException {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1365,7 +1319,7 @@ public double getSpindleSpeedRPM(int toolhead) throws RetryException {
return rpm;
}

public int getSpindleSpeedPWM(int toolhead) {
private int getSpindleSpeedPWM(int toolhead) {

/// toolhead -1 indicate auto-detect.Fast hack to get software out..
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();
@@ -1480,7 +1434,7 @@ else if (pr.isEmpty())

}

public void setAllPlatformTemperatures(double temperature) throws RetryException {
private void setAllPlatformTemperatures(double temperature) throws RetryException {
// constrain our temperature.
//Set the platform temperature for any & every tool with an HBP
for(ToolModel t : machine.getTools())
@@ -1710,7 +1664,7 @@ protected Point5d getAbsDeltaSteps(Point5d current, Point5d target) {
* Feedrate in mm per minute
* @return
*/
protected long convertFeedrateToMicros(Point5d current, Point5d target,
private long convertFeedrateToMicros(Point5d current, Point5d target,
double feedrate) {
Point5d deltaDistance = getAbsDeltaDistance(current, target);
Point5d deltaSteps = machine.mmToSteps(deltaDistance);
@@ -1732,7 +1686,7 @@ protected long convertFeedrateToMicros(Point5d current, Point5d target,
return (long) Math.round(step_delay);
}

protected double getLongestLength(Point5d p) {
private double getLongestLength(Point5d p) {
// find the dominant axis.
double longest = 0d;
for (int i = 0; i < 5; i++) {
@@ -2278,7 +2232,7 @@ protected byte[] intToLE(int s) {
return intToLE(s, 4);
}

ResponseCode convertSDCode(int code) {
private ResponseCode convertSDCode(int code) {
switch (code) {
case 0:
return ResponseCode.SUCCESS;
@@ -2301,7 +2255,7 @@ ResponseCode convertSDCode(int code) {
return ResponseCode.FAIL_GENERIC;
}

FileOutputStream fileCaptureOstream = null;
protected FileOutputStream fileCaptureOstream = null;

@Override public void beginFileCapture(String path) throws FileNotFoundException {
fileCaptureOstream = new FileOutputStream(new File(path));
@@ -2615,7 +2569,7 @@ public void resetToolToFactory(int toolhead) {
writeToEEPROM(Sanguino3GEEPRPOM.EEPROM_ESTOP_CONFIGURATION_OFFSET, b);
}

public double getPlatformTemperatureSetting(int toolhead) {
protected double getPlatformTemperatureSetting(int toolhead) {
/// toolhead -1 indicates auto-detect. Fast hack to get software out...
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();

@@ -2634,7 +2588,7 @@ public double getPlatformTemperatureSetting(int toolhead) {
return machine.getTool(toolhead).getPlatformTargetTemperature();
}

public double getTemperatureSetting(int toolhead) {
protected double getTemperatureSetting(int toolhead) {
/// toolhead -1 indicates auto-detect. Fast hack to get software out...
if(toolhead == -1 ) toolhead = machine.currentTool().getIndex();