MockBoat: Removed redundant isAutoVMG() function.
TackGybeCommand now disables autoVMG. Removed print statements from VMGCommand.
This commit is contained in:
@@ -297,9 +297,6 @@ public class MockBoat extends Boat {
|
|||||||
this.roundingStatus = 0;
|
this.roundingStatus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoVMG() {
|
|
||||||
return autoVMG;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoVMG(boolean autoVMG) {
|
public void setAutoVMG(boolean autoVMG) {
|
||||||
this.autoVMG = autoVMG;
|
this.autoVMG = autoVMG;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public class MockRace extends Race {
|
|||||||
boat.moveForwards(distanceTravelledMeters);
|
boat.moveForwards(distanceTravelledMeters);
|
||||||
boat.setTimeSinceTackChange(boat.getTimeSinceTackChange() + updatePeriodMilliseconds);
|
boat.setTimeSinceTackChange(boat.getTimeSinceTackChange() + updatePeriodMilliseconds);
|
||||||
|
|
||||||
if (boat.isAutoVMG()) {
|
if (boat.getAutoVMG()) {
|
||||||
newOptimalVMG(boat);
|
newOptimalVMG(boat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public class TackGybeCommand implements Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
|
boat.setAutoVMG(false);
|
||||||
|
|
||||||
double boatAngle = boat.getBearing().degrees();
|
double boatAngle = boat.getBearing().degrees();
|
||||||
double windAngle =race.getWindDirection().degrees();
|
double windAngle =race.getWindDirection().degrees();
|
||||||
double differenceAngle = calcDistance(boatAngle, windAngle);
|
double differenceAngle = calcDistance(boatAngle, windAngle);
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ public class VMGCommand implements Command {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
if (boat.getAutoVMG()){
|
if (boat.getAutoVMG()){
|
||||||
boat.setAutoVMG(false);
|
boat.setAutoVMG(false);
|
||||||
System.out.println("Auto VMG off!");
|
|
||||||
} else {
|
} else {
|
||||||
boat.setAutoVMG(true);
|
boat.setAutoVMG(true);
|
||||||
System.out.println("Auto VMG on!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user