diff options
| author | Keith Packard <keithp@keithp.com> | 2013-12-20 19:40:31 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-12-20 19:40:31 -0800 | 
| commit | 8e5f3b922100f9de54b9650df14749e81b1a6562 (patch) | |
| tree | 4511d5710ab444de6b7c207d08fa033b5a8240ba /altosui/AltosGraphDataPoint.java | |
| parent | f65880cf5bfcba5005c32db2b300448e585f3e45 (diff) | |
altosui: Add imu and mag sensor values to plots
Makes for a lot of potential graph elements.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosGraphDataPoint.java')
| -rw-r--r-- | altosui/AltosGraphDataPoint.java | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/altosui/AltosGraphDataPoint.java b/altosui/AltosGraphDataPoint.java index d8191f5d..b2782459 100644 --- a/altosui/AltosGraphDataPoint.java +++ b/altosui/AltosGraphDataPoint.java @@ -40,6 +40,16 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {  	public static final int data_range = 13;  	public static final int data_distance = 14;  	public static final int data_pressure = 15; +	public static final int data_accel_x = 16; +	public static final int data_accel_y = 17; +	public static final int data_accel_z = 18; +	public static final int data_gyro_x = 19; +	public static final int data_gyro_y = 20; +	public static final int data_gyro_z = 21; +	public static final int data_mag_x = 22; +	public static final int data_mag_y = 23; +	public static final int data_mag_z = 24; +	public static final int data_orient = 25;  	public double x() throws AltosUIDataMissing {  		double	time = state.time_since_boost(); @@ -99,6 +109,58 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {  		case data_pressure:  			y = state.pressure();  			break; +			 +		case data_accel_x: +		case data_accel_y: +		case data_accel_z: +		case data_gyro_x: +		case data_gyro_y: +		case data_gyro_z: +			AltosIMU	imu = state.imu; +			if (imu == null) +				break; +			switch (index) { +			case data_accel_x: +				y = imu.accel_x; +				break; +			case data_accel_y: +				y = imu.accel_y; +				break; +			case data_accel_z: +				y = imu.accel_z; +				break; +			case data_gyro_x: +				y = imu.gyro_x; +				break; +			case data_gyro_y: +				y = imu.gyro_y; +				break; +			case data_gyro_z: +				y = imu.gyro_z; +				break; +			} +			break; +		case data_mag_x: +		case data_mag_y: +		case data_mag_z: +			AltosMag	mag = state.mag; +			if (mag == null) +				break; +			switch (index) { +			case data_mag_x: +				y = mag.x; +				break; +			case data_mag_y: +				y = mag.y; +				break; +			case data_mag_z: +				y = mag.z; +				break; +			} +			break; +		case data_orient: +			y = state.orient(); +			break;  		}  		if (y == AltosLib.MISSING)  			throw new AltosUIDataMissing(index); | 
