Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1565 → Rev 1564

/dongfang_FC_rewrite_tool/src/dongfang/mkt/comm/MKInputStream.java
247,33 → 247,33
f.setVersion(base64InputStream.readByte());
GPSPosition pos = new GPSPosition();
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setStatus(base64InputStream.readByte());
f.setCurrentPosition(pos);
pos = new GPSPosition();
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setStatus(base64InputStream.readByte());
f.setTargetPosition(pos);
GPSBearingAndRange rnb = new GPSBearingAndRange();
rnb.setDistance(((double)base64InputStream.readWord())/10.0);
rnb.setDistance(base64InputStream.readWord());
rnb.setBearing(base64InputStream.readSignedWord());
f.setCurrentToTarget(rnb);
 
pos = new GPSPosition();
pos.setLongitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setLatitude(((double)base64InputStream.readSignedDWord())/1E7);
pos.setAltitude(((double)base64InputStream.readSignedDWord())/1E3);
pos.setLongitude(base64InputStream.readSignedDWord());
pos.setLatitude(base64InputStream.readSignedDWord());
pos.setAltitude(base64InputStream.readSignedDWord());
pos.setStatus(base64InputStream.readByte());
f.setHomePosition(pos);
rnb = new GPSBearingAndRange();
rnb.setDistance(((double)base64InputStream.readWord())/10.0);
rnb.setDistance(base64InputStream.readWord());
rnb.setBearing(base64InputStream.readSignedWord());
f.setCurrentToHome(rnb);
281,11 → 281,7
f.setWaypointCount(base64InputStream.readByte());
f.setNumberOfSatellites(base64InputStream.readByte());
// 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.setHeightByPressure(base64InputStream.readSignedWord());
f.setVerticalVelocityByPressure(base64InputStream.readSignedWord());
f.setFlightTime(base64InputStream.readWord());
f.setBatteryVoltage(base64InputStream.readByte());
306,7 → 302,7
f.setVerticalVelocityByGPS(base64InputStream.readSignedWord());
f.setTargetLoiterTime(base64InputStream.readByte());
f.setFcFlags2(base64InputStream.readByte());
f.setSetpointForAltitude(((double)base64InputStream.readSignedWord()) * 0.05 / 1.24);
f.setSetpointForAltitude(base64InputStream.readSignedWord());
f.setThrottle(base64InputStream.readByte());
f.setCurrent(base64InputStream.readWord());
f.setCapacityUsed(base64InputStream.readWord());
/dongfang_FC_rewrite_tool/src/dongfang/mkt/datatype/GPSBearingAndRange.java
1,35 → 1,30
package dongfang.mkt.datatype;
 
public class GPSBearingAndRange {
double distance; // in m.
double bearing; // in degrees.
public double getDistance() {
int distance; // in m/10. 16 bit unsigned.
int bearing; // in degrees. 16 bit signed.
public int getDistance() {
return distance;
}
public double getBearing() {
public int getBearing() {
return bearing;
}
public void setDistance(double distance) {
public void setDistance(int distance) {
this.distance = distance;
}
public void setBearing(double bearing) {
public void setBearing(int bearing) {
this.bearing = bearing;
}
public String toXML() {
String result = "distance=\"" + this.distance;
String result = "distance=\"" + ((double)this.distance)/10;
result += "\" bearing=\"";
result += this.bearing;
result += "\"";
return result;
}
public String toString() {
String result = this.distance + "m @";
String result = "" + ((double)this.distance)/10;
result += "m @";
result += this.bearing;
result += "deg";
return result;
/dongfang_FC_rewrite_tool/src/dongfang/mkt/datatype/GPSPosition.java
1,26 → 1,20
package dongfang.mkt.datatype;
 
public class GPSPosition {
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 longitude; // in 1E-7 degrees. 32 bit signed.
int latitude; // in 1E-7 degrees. 32 bit signed.
long altitude; // in mm. 32 bit signed.
int status;
 
public double getLongitude() {
public int getLongitude() {
return longitude;
}
 
public double getLatitude() {
public int getLatitude() {
return latitude;
}
 
public double getAltitude() {
public long getAltitude() {
return altitude;
}
 
28,15 → 22,15
return status;
}
 
public void setLongitude(double longitude) {
public void setLongitude(int longitude) {
this.longitude = longitude;
}
 
public void setLatitude(double latitude) {
public void setLatitude(int latitude) {
this.latitude = latitude;
}
 
public void setAltitude(double altitude) {
public void setAltitude(long altitude) {
this.altitude = altitude;
}
 
46,7 → 40,7
 
public String toXML() {
double latitude = Math.abs(this.latitude);
String result = "latitude=\"" + latitude;
String result = "latitude=\"" + latitude / 1E7;
if (this.latitude < 0)
result += "S";
else
53,7 → 47,7
result += "N";
result += "\"";
double longitude = Math.abs(this.longitude);
result += " longitude=\"" + longitude;
result += " longitude=\"" + longitude / 1E7;
if (this.longitude < 0)
result += "W";
else
64,7 → 58,7
 
public String toString() {
double latitude = Math.abs(this.latitude);
String result = "" + latitude;
String result = "" + latitude / 1E7;
if (this.latitude < 0)
result += "S";
else
71,7 → 65,7
result += "N";
result += " ";
double longitude = Math.abs(this.longitude);
result += "" + longitude;
result += "" + longitude / 1E7;
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 double heightByPressure; // in m.
private int heightByPressure; // 16 bit signed.
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 double setpointForAltitude; // in m.
private int setpointForAltitude; // 16 bit signed.
private int throttle;
private int current; // 16 bit unsigned.
76,7 → 76,7
public int getNumberOfSatellites() {
return numberOfSatellites;
}
public double getHeightByPressure() {
public int getHeightByPressure() {
return heightByPressure;
}
public int getVerticalVelocityByPressure() {
127,7 → 127,7
public int getFcFlags2() {
return fcFlags2;
}
public double getSetpointForAltitude() {
public int getSetpointForAltitude() {
return setpointForAltitude;
}
public int getThrottle() {
166,7 → 166,7
public void setNumberOfSatellites(int numberOfSatellites) {
this.numberOfSatellites = numberOfSatellites;
}
public void _setHeightByPressure(double heightByPressure) {
public void setHeightByPressure(int heightByPressure) {
this.heightByPressure = heightByPressure;
}
public void setVerticalVelocityByPressure(int verticalVelocityByPressure) {
217,7 → 217,7
public void setFcFlags2(int fcFlags2) {
this.fcFlags2 = fcFlags2;
}
public void setSetpointForAltitude(double setpointForAltitude) {
public void setSetpointForAltitude(int 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(47.327450);
upperLeft.setLongitude(8.521657);
upperLeft.setLatitude((int)(47.327450 * 1E7));
upperLeft.setLongitude((int)(8.521657 * 1E7));
 
// * l/r: geotagged geo:lat=47.321749 geo:lon=8.534403
lowerRight.setLatitude(47.321749);
lowerRight.setLongitude(8.534403);
lowerRight.setLatitude((int)(47.321749 * 1E7));
lowerRight.setLongitude((int)(8.534403 * 1E7));
// geotagged geo:lat=47.324614 geo:lon=8.528202
highlight.setLatitude(47.324714);
highlight.setLongitude(8.528102);
highlight.setLatitude((int)(47.324714 * 1E7));
highlight.setLongitude((int)(8.528102 * 1E7));
MapImageView v = new MapImageView(upperLeft, lowerRight, "flugplatz_small.png");
v.hightlightPosition = highlight;