Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1564 → Rev 1565

/dongfang_FC_rewrite_tool/src/dongfang/mkt/comm/MKInputStream.java
247,33 → 247,33
f.setVersion(base64InputStream.readByte());
GPSPosition pos = new GPSPosition();
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setStatus(base64InputStream.readByte());
f.setCurrentPosition(pos);
pos = new GPSPosition();
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setStatus(base64InputStream.readByte());
f.setTargetPosition(pos);
GPSBearingAndRange rnb = new GPSBearingAndRange();
rnb.setDistance(base64InputStream.readWord());
rnb.setDistance(((double)base64InputStream.readWord())/10.0);
rnb.setBearing(base64InputStream.readSignedWord());
f.setCurrentToTarget(rnb);
 
pos = new GPSPosition();
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setStatus(base64InputStream.readByte());
f.setHomePosition(pos);
rnb = new GPSBearingAndRange();
rnb.setDistance(base64InputStream.readWord());
rnb.setDistance(((double)base64InputStream.readWord())/10.0);
rnb.setBearing(base64InputStream.readSignedWord());
f.setCurrentToHome(rnb);
281,7 → 281,11
f.setWaypointCount(base64InputStream.readByte());
f.setNumberOfSatellites(base64InputStream.readByte());
f.setHeightByPressure(base64InputStream.readSignedWord());
// This stunt is a metric unit conversion: The height was supposed (H&I) to be in integral 5cm steps.
// However there is error factor in the measurement of 24% too much.
// h[m] = h[int] * 0.05 / 1.24 = h[int]
f._setHeightByPressure(((double)base64InputStream.readSignedWord()) * 0.05 / 1.24);
f.setVerticalVelocityByPressure(base64InputStream.readSignedWord());
f.setFlightTime(base64InputStream.readWord());
f.setBatteryVoltage(base64InputStream.readByte());
302,7 → 306,7
f.setVerticalVelocityByGPS(base64InputStream.readSignedWord());
f.setTargetLoiterTime(base64InputStream.readByte());
f.setFcFlags2(base64InputStream.readByte());
f.setSetpointForAltitude(base64InputStream.readSignedWord());
f.setSetpointForAltitude(((double)base64InputStream.readSignedWord()) * 0.05 / 1.24);
f.setThrottle(base64InputStream.readByte());
f.setCurrent(base64InputStream.readWord());
f.setCapacityUsed(base64InputStream.readWord());
/dongfang_FC_rewrite_tool/src/dongfang/mkt/datatype/GPSBearingAndRange.java
1,30 → 1,35
package dongfang.mkt.datatype;
 
public class GPSBearingAndRange {
int distance; // in m/10. 16 bit unsigned.
int bearing; // in degrees. 16 bit signed.
public int getDistance() {
double distance; // in m.
double bearing; // in degrees.
public double getDistance() {
return distance;
}
public int getBearing() {
public double getBearing() {
return bearing;
}
public void setDistance(int distance) {
public void setDistance(double distance) {
this.distance = distance;
}
public void setBearing(int bearing) {
public void setBearing(double bearing) {
this.bearing = bearing;
}
public String toXML() {
String result = "distance=\"" + ((double)this.distance)/10;
String result = "distance=\"" + this.distance;
result += "\" bearing=\"";
result += this.bearing;
result += "\"";
return result;
}
public String toString() {
String result = "" + ((double)this.distance)/10;
result += "m @";
String result = this.distance + "m @";
result += this.bearing;
result += "deg";
return result;
/dongfang_FC_rewrite_tool/src/dongfang/mkt/datatype/GPSPosition.java
1,20 → 1,26
package dongfang.mkt.datatype;
 
public class GPSPosition {
int longitude; // in 1E-7 degrees. 32 bit signed.
int latitude; // in 1E-7 degrees. 32 bit signed.
long altitude; // in mm. 32 bit signed.
public static final int INVALID = 0x00;
public static final int NEWDATA = 0x01;
public static final int PROCESSED = 0x02;
double longitude;
double latitude;
double altitude;
int status;
 
public int getLongitude() {
public double getLongitude() {
return longitude;
}
 
public int getLatitude() {
public double getLatitude() {
return latitude;
}
 
public long getAltitude() {
public double getAltitude() {
return altitude;
}
 
22,15 → 28,15
return status;
}
 
public void setLongitude(int longitude) {
public void setLongitude(double longitude) {
this.longitude = longitude;
}
 
public void setLatitude(int latitude) {
public void setLatitude(double latitude) {
this.latitude = latitude;
}
 
public void setAltitude(long altitude) {
public void setAltitude(double altitude) {
this.altitude = altitude;
}
 
40,7 → 46,7
 
public String toXML() {
double latitude = Math.abs(this.latitude);
String result = "latitude=\"" + latitude / 1E7;
String result = "latitude=\"" + latitude;
if (this.latitude < 0)
result += "S";
else
47,7 → 53,7
result += "N";
result += "\"";
double longitude = Math.abs(this.longitude);
result += " longitude=\"" + longitude / 1E7;
result += " longitude=\"" + longitude;
if (this.longitude < 0)
result += "W";
else
58,7 → 64,7
 
public String toString() {
double latitude = Math.abs(this.latitude);
String result = "" + latitude / 1E7;
String result = "" + latitude;
if (this.latitude < 0)
result += "S";
else
65,7 → 71,7
result += "N";
result += " ";
double longitude = Math.abs(this.longitude);
result += "" + longitude / 1E7;
result += "" + longitude;
if (this.longitude < 0)
result += "W";
else
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/OSDDataResponseFrame.java
16,7 → 16,7
private int waypointCount;
private int numberOfSatellites;
private int heightByPressure; // 16 bit signed.
private double heightByPressure; // in m.
private int verticalVelocityByPressure; // 16 bit signed.
private int flightTime; // in secs. 16 bit unsigned.
39,7 → 39,7
private int targetLoiterTime;
private int fcFlags2;
private int setpointForAltitude; // 16 bit signed.
private double setpointForAltitude; // in m.
private int throttle;
private int current; // 16 bit unsigned.
76,7 → 76,7
public int getNumberOfSatellites() {
return numberOfSatellites;
}
public int getHeightByPressure() {
public double getHeightByPressure() {
return heightByPressure;
}
public int getVerticalVelocityByPressure() {
127,7 → 127,7
public int getFcFlags2() {
return fcFlags2;
}
public int getSetpointForAltitude() {
public double getSetpointForAltitude() {
return setpointForAltitude;
}
public int getThrottle() {
166,7 → 166,7
public void setNumberOfSatellites(int numberOfSatellites) {
this.numberOfSatellites = numberOfSatellites;
}
public void setHeightByPressure(int heightByPressure) {
public void _setHeightByPressure(double heightByPressure) {
this.heightByPressure = heightByPressure;
}
public void setVerticalVelocityByPressure(int verticalVelocityByPressure) {
217,7 → 217,7
public void setFcFlags2(int fcFlags2) {
this.fcFlags2 = fcFlags2;
}
public void setSetpointForAltitude(int setpointForAltitude) {
public void setSetpointForAltitude(double setpointForAltitude) {
this.setpointForAltitude = setpointForAltitude;
}
public void setThrottle(int throttle) {
/dongfang_FC_rewrite_tool/src/dongfang/mkt/ui/offscreendisplay/MapImageView.java
66,16 → 66,16
GPSPosition lowerRight = new GPSPosition();
GPSPosition highlight = new GPSPosition();
upperLeft.setLatitude((int)(47.327450 * 1E7));
upperLeft.setLongitude((int)(8.521657 * 1E7));
upperLeft.setLatitude(47.327450);
upperLeft.setLongitude(8.521657);
 
// * l/r: geotagged geo:lat=47.321749 geo:lon=8.534403
lowerRight.setLatitude((int)(47.321749 * 1E7));
lowerRight.setLongitude((int)(8.534403 * 1E7));
lowerRight.setLatitude(47.321749);
lowerRight.setLongitude(8.534403);
// geotagged geo:lat=47.324614 geo:lon=8.528202
highlight.setLatitude((int)(47.324714 * 1E7));
highlight.setLongitude((int)(8.528102 * 1E7));
highlight.setLatitude(47.324714);
highlight.setLongitude(8.528102);
MapImageView v = new MapImageView(upperLeft, lowerRight, "flugplatz_small.png");
v.hightlightPosition = highlight;