X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosGraphDataPoint.java;h=61a1a2276bdfdf493e3d0740385299cb15db9f7e;hp=537efc4408afd2ab8b06afbc2276b2ef0b4e107d;hb=677fcafd3816b6d8d86b2dc41b840d97b5ccbf07;hpb=7ec1b97d278c7aec3199fb7270f0dcf9484c879f diff --git a/altosui/AltosGraphDataPoint.java b/altosui/AltosGraphDataPoint.java index 537efc44..61a1a227 100644 --- a/altosui/AltosGraphDataPoint.java +++ b/altosui/AltosGraphDataPoint.java @@ -18,7 +18,7 @@ package altosui; import org.altusmetrum.altosuilib_1.*; -import org.altusmetrum.altoslib_1.*; +import org.altusmetrum.altoslib_3.*; public class AltosGraphDataPoint implements AltosUIDataPoint { @@ -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(); @@ -49,16 +59,16 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { } public double y(int index) throws AltosUIDataMissing { - double y = AltosRecord.MISSING; + double y = AltosLib.MISSING; switch (index) { case data_height: - y = state.height; + y = state.height(); break; case data_speed: y = state.speed(); break; case data_accel: - y = state.acceleration; + y = state.acceleration(); break; case data_temp: y = state.temperature; @@ -97,10 +107,62 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { y = state.from_pad.distance; break; case data_pressure: - y = state.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 == AltosRecord.MISSING) + if (y == AltosLib.MISSING) throw new AltosUIDataMissing(index); return y; }