Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1561 → Rev 1562

/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/OSDDataResponseFrame.java
31,6 → 31,29
public void setStatus(int status) {
this.status = status;
}
public String toXML() {
double latitude = Math.abs(this.latitude);
String result = "latitude=\"" + latitude/1E7;
if (this.latitude < 0) result+= "S"; else result+="N";
result += "\"";
double longitude= Math.abs(this.longitude);
result += " longitude=\"" + longitude/1E7;
if (this.longitude < 0) result+= "W"; else result+="E";
result += "\"";
return result;
}
 
public String toString() {
double latitude = Math.abs(this.latitude);
String result = "" + latitude/1E7;
if (this.latitude < 0) result+= "S"; else result+="N";
result += " ";
double longitude= Math.abs(this.longitude);
result += "" + longitude/1E7;
if (this.longitude < 0) result+= "W"; else result+="E";
return result;
}
}
public static class GPSDistanceAndBearing {
48,6 → 71,20
public void setBearing(int bearing) {
this.bearing = bearing;
}
public String toXML() {
String result = "distance=\"" + ((double)this.distance)/10;
result += "\" bearing=\"";
result += this.bearing;
result += "\"";
return result;
}
public String toString() {
String result = "" + ((double)this.distance)/10;
result += "m @";
result += this.bearing;
result += "deg";
return result;
}
}
 
private int version;
68,7 → 105,7
private int batteryVoltage; // in 0.1 volts.
 
private int groundSpeed; // in cm/s. 16 bit unsigned.
private int heading; // of movement. 16 bit signed.
private int directionOfFlight; // of movement. 16 bit signed.
private int compassHeading;// 16 bit signed.
private int pitchAngle;
136,8 → 173,8
public int getGroundSpeed() {
return groundSpeed;
}
public int getHeading() {
return heading;
public int getDirectionOfFlight() {
return directionOfFlight;
}
public int getCompassHeading() {
return compassHeading;
226,8 → 263,8
public void setGroundSpeed(int groundSpeed) {
this.groundSpeed = groundSpeed;
}
public void setHeading(int heading) {
this.heading = heading;
public void setDirectionOfFlight(int heading) {
this.directionOfFlight = heading;
}
public void setCompassHeading(int compassHeading) {
this.compassHeading = compassHeading;
274,5 → 311,28
public void setCapacityUsed(int capacityUsed) {
this.capacityUsed = capacityUsed;
}
 
@Override
public boolean isResponseTo(RequestFrame r) {
return r instanceof OSDDataRequestFrame;
}
public String toString() {
StringBuilder result = new StringBuilder();
result.append("OSDData version=" + this.version + "\n");
result.append("currentPosition: " + this.currentPosition + "\n");
result.append("targetPosition: " + this.targetPosition + " (" + this.currentToTarget + ")" + "\n");
result.append("homePosition: " + this.homePosition + " (" + this.currentToHome + ")" + "\n");
result.append("heightByPressure: " + this.heightByPressure + "\n");
result.append("verticalVelocityByPressure: " + this.verticalVelocityByPressure + "\n");
result.append("verticalVelocityByGPS: " + this.verticalVelocityByGPS + "\n");
result.append("direction of flight: " + this.directionOfFlight + "\n");
result.append("compassHeading: " + this.compassHeading + "\n");
result.append("pitchAngle: " + this.pitchAngle + "\n");
result.append("rollAngle: " + this.rollAngle + "\n");
result.append("battery voltage: " + ((double)this.batteryVoltage)/10 + "\n");
result.append("throttle: " + this.throttle + "\n");
return result.toString();
}
}