diff options
| author | Keith Packard <keithp@keithp.com> | 2011-07-17 08:17:44 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-07-17 08:17:44 -0700 | 
| commit | f7cd8317bf78ece334e1ceb0263b875ca43bbbd2 (patch) | |
| tree | f8f8d2778d91a10700711d24b3c904532d7c9d32 /altosui/AltosTelemetryRecordLegacy.java | |
| parent | 51796e2f1ebce3ee8dc1ac90648381410c1379ee (diff) | |
| parent | a482d904a3f391c3a24df3660acb3f3696aa6766 (diff) | |
Merge branch 'preload-maps'
Diffstat (limited to 'altosui/AltosTelemetryRecordLegacy.java')
| -rw-r--r-- | altosui/AltosTelemetryRecordLegacy.java | 37 | 
1 files changed, 18 insertions, 19 deletions
| diff --git a/altosui/AltosTelemetryRecordLegacy.java b/altosui/AltosTelemetryRecordLegacy.java index e3751ee7..f59027ab 100644 --- a/altosui/AltosTelemetryRecordLegacy.java +++ b/altosui/AltosTelemetryRecordLegacy.java @@ -385,24 +385,25 @@ public class AltosTelemetryRecordLegacy extends AltosRecord implements AltosTele  	 */  	int[]	bytes; +	int	adjust;  	private int int8(int i) { -		return Altos.int8(bytes, i + 1); +		return Altos.int8(bytes, i + 1 + adjust);  	}  	private int uint8(int i) { -		return Altos.uint8(bytes, i + 1); +		return Altos.uint8(bytes, i + 1 + adjust);  	}  	private int int16(int i) { -		return Altos.int16(bytes, i + 1); +		return Altos.int16(bytes, i + 1 + adjust);  	}  	private int uint16(int i) { -		return Altos.uint16(bytes, i + 1); +		return Altos.uint16(bytes, i + 1 + adjust);  	}  	private int uint32(int i) { -		return Altos.uint32(bytes, i + 1); +		return Altos.uint32(bytes, i + 1 + adjust);  	}  	private String string(int i, int l) { -		return Altos.string(bytes, i + 1, l); +		return Altos.string(bytes, i + 1 + adjust, l);  	}  	static final int AO_GPS_NUM_SAT_MASK	= (0xf << 0); @@ -413,23 +414,20 @@ public class AltosTelemetryRecordLegacy extends AltosRecord implements AltosTele  	static final int AO_GPS_DATE_VALID	= (1 << 6);  	static final int AO_GPS_COURSE_VALID	= (1 << 7); -	static class theLock extends Object { -	} -	static public theLock lockObject = new theLock();  	public AltosTelemetryRecordLegacy(int[] in_bytes, int in_rssi, int in_status) {  		bytes = in_bytes; -		synchronized(lockObject) { -		for (int i = 0; i < in_bytes.length - 2; i++) { -			if ((i % 10) == 0) -				System.out.printf("%3d:", i); -			System.out.printf(" %02x", uint8(i)); -			if ((i % 10) == 9 || i == in_bytes.length - 3) -				System.out.printf("\n"); -		} -		}  		version = 4; +		adjust = 0; + +		if (bytes.length == Altos.ao_telemetry_0_8_len + 4) { +			serial = uint8(0); +			adjust = -1; +		} else +			serial = uint16(0); + +		seen = seen_flight | seen_sensor | seen_temp_volt | seen_deploy; +  		callsign = string(62, 8); -		serial = uint16(0);  		flight = uint16(2);  		rssi = in_rssi;  		status = in_status; @@ -470,6 +468,7 @@ public class AltosTelemetryRecordLegacy extends AltosRecord implements AltosTele  		if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) {  			gps = new AltosGPS(); +			seen |= seen_gps_time | seen_gps_lat | seen_gps_lon;  			gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK);  			gps.locked = (gps_flags & AO_GPS_VALID) != 0;  			gps.connected = true; | 
