Skip to content

Commit

Permalink
A fix for openpnp#584
Browse files Browse the repository at this point in the history
"Loading nozzle speed and unloading nozzle speed behaves
different "

Changing from 4 speed settings to 3 speed settings between 4 locations.
  • Loading branch information
lilltroll77 committed Jun 30, 2017
1 parent fc08fc6 commit f09c5c2
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 89 deletions.
16 changes: 8 additions & 8 deletions src/main/java/org/openpnp/machine/reference/ReferenceNozzle.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,19 @@ public void loadNozzleTip(NozzleTip nozzleTip) throws Exception {

Logger.debug("{}.loadNozzleTip({}): moveTo Start Location",
new Object[] {getName(), nozzleTip.getName()});
MovableUtils.moveToLocationAtSafeZ(this, nt.getChangerStartLocation(), nt.getChangerStartSpeed() * speed);
MovableUtils.moveToLocationAtSafeZ(this, nt.getChangerStartLocation(), speed);

Logger.debug("{}.loadNozzleTip({}): moveTo Mid Location",
new Object[] {getName(), nozzleTip.getName()});
moveTo(nt.getChangerMidLocation(), nt.getChangerMidSpeed() * speed * 0.25);
moveTo(nt.getChangerMidLocation(), nt.getChangerStartToMidSpeed() * speed);

Logger.debug("{}.loadNozzleTip({}): moveTo Mid Location 2",
new Object[] {getName(), nozzleTip.getName()});
moveTo(nt.getChangerMidLocation2(), nt.getChangerMidSpeed2() * speed);
moveTo(nt.getChangerMidLocation2(), nt.getChangerMidToMid2Speed() * speed);

Logger.debug("{}.loadNozzleTip({}): moveTo End Location",
new Object[] {getName(), nozzleTip.getName()});
moveTo(nt.getChangerEndLocation(), nt.getChangerEndSpeed() * speed);
moveTo(nt.getChangerEndLocation(), nt.getChangerMid2ToEndSpeed() * speed);
moveToSafeZ(getHead().getMachine().getSpeed());

Logger.debug("{}.loadNozzleTip({}): Finished",
Expand All @@ -316,16 +316,16 @@ public void unloadNozzleTip() throws Exception {
ReferenceNozzleTip nt = (ReferenceNozzleTip) nozzleTip;

Logger.debug("{}.unloadNozzleTip(): moveTo End Location", getName());
MovableUtils.moveToLocationAtSafeZ(this, nt.getChangerEndLocation(), nt.getChangerEndSpeed() * speed);
MovableUtils.moveToLocationAtSafeZ(this, nt.getChangerEndLocation(), speed);

Logger.debug("{}.unloadNozzleTip(): moveTo Mid Location 2", getName());
moveTo(nt.getChangerMidLocation2(), nt.getChangerMidSpeed2() * speed);
moveTo(nt.getChangerMidLocation2(), nt.getChangerMid2ToEndSpeed() * speed);

Logger.debug("{}.unloadNozzleTip(): moveTo Mid Location", getName());
moveTo(nt.getChangerMidLocation(), nt.getChangerMidSpeed() * speed);
moveTo(nt.getChangerMidLocation(), nt.getChangerMidToMid2Speed() * speed);

Logger.debug("{}.unloadNozzleTip(): moveTo Start Location", getName());
moveTo(nt.getChangerStartLocation(), nt.getChangerStartSpeed() * speed * 0.25);
moveTo(nt.getChangerStartLocation(), nt.getChangerStartToMidSpeed() * speed);
moveToSafeZ(getHead().getMachine().getSpeed());

Logger.debug("{}.unloadNozzleTip(): Finished", getName());
Expand Down
70 changes: 44 additions & 26 deletions src/main/java/org/openpnp/machine/reference/ReferenceNozzleTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@

public class ReferenceNozzleTip extends AbstractNozzleTip {




/// TODO REMOVE in future release
@Element(required = false)
private Double changerStartSpeed = null;
@Element(required = false)
private Double changerMidSpeed = null;
@Element(required = false)
private Double changerMidSpeed2 = null;
@Element(required = false)
private Double changerEndSpeed = null;
/// END TODO

@ElementList(required = false, entry = "id")
private Set<String> compatiblePackageIds = new HashSet<>();

Expand All @@ -57,25 +69,23 @@ public class ReferenceNozzleTip extends AbstractNozzleTip {
private Location changerStartLocation = new Location(LengthUnit.Millimeters);

@Element(required = false)
private double changerStartSpeed = 1.0D;
private double changerStartToMidSpeed = 1D;

@Element(required = false)
private Location changerMidLocation = new Location(LengthUnit.Millimeters);

@Element(required = false)
private double changerMidSpeed = 1.0D;
private double changerMidToMid2Speed = 1D;

@Element(required = false)
private Location changerMidLocation2;

@Element(required = false)
private double changerMidSpeed2 = 1.0D;
private double changerMid2ToEndSpeed = 1D;

@Element(required = false)
private Location changerEndLocation = new Location(LengthUnit.Millimeters);

@Element(required = false)
private double changerEndSpeed = 1.0D;

@Element(required = false)
private Calibration calibration = new Calibration();
Expand Down Expand Up @@ -110,6 +120,22 @@ public void configurationLoaded(Configuration configuration) throws Exception {
if (changerMidLocation2 == null) {
changerMidLocation2 = changerMidLocation.derive(null, null, null, null);
}
/*
* Backwards compatibility for speed settings.
* Map the old variables to new one if present in machine.xlm and null the old ones
* */
if (changerStartSpeed != null) {
changerStartToMidSpeed = changerStartSpeed;
}
if (changerMidSpeed != null) {
changerMidToMid2Speed = changerMidSpeed;
}
if (changerMidSpeed2 !=null) {
changerMid2ToEndSpeed = changerMidSpeed2;
}
if (changerEndSpeed != null) {
changerEndSpeed = null;
}
}
});
}
Expand Down Expand Up @@ -206,36 +232,28 @@ public void setChangerEndLocation(Location changerEndLocation) {
this.changerEndLocation = changerEndLocation;
}

public double getChangerStartSpeed() {
return changerStartSpeed;
}

public void setChangerStartSpeed(double changerStartSpeed) {
this.changerStartSpeed = changerStartSpeed;
}

public double getChangerMidSpeed() {
return changerMidSpeed;
public double getChangerStartToMidSpeed() {
return changerStartToMidSpeed;
}

public void setChangerMidSpeed(double changerMidSpeed) {
this.changerMidSpeed = changerMidSpeed;
public void setChangerStartToMidSpeed(double changerStartToMidSpeed) {
this.changerStartToMidSpeed = changerStartToMidSpeed;
}

public double getChangerMidSpeed2() {
return changerMidSpeed2;
public double getChangerMidToMid2Speed() {
return changerMidToMid2Speed;
}

public void setChangerMidSpeed2(double changerMidSpeed2) {
this.changerMidSpeed2 = changerMidSpeed2;
public void setChangerMidToMid2Speed(double changerMidToMid2Speed) {
this.changerMidToMid2Speed = changerMidToMid2Speed;
}

public double getChangerEndSpeed() {
return changerEndSpeed;
public double getChangerMid2ToEndSpeed() {
return changerMid2ToEndSpeed;
}

public void setChangerEndSpeed(double changerEndSpeed) {
this.changerEndSpeed = changerEndSpeed;
public void setChangerMid2ToEndSpeed(double changerMid2ToEndSpeed) {
this.changerMid2ToEndSpeed = changerMid2ToEndSpeed;
}

private Nozzle getParentNozzle() {
Expand Down
Loading

0 comments on commit f09c5c2

Please sign in to comment.