X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosGraphDataPoint.java;h=61a1a2276bdfdf493e3d0740385299cb15db9f7e;hp=8e6d6923327feb670f339a9bd0f8af3b19cfc4fd;hb=b89fb51a963635e2effe3a31f803bfc29c2c46b7;hpb=2120d362cefceba69e75996b6391d9558978c01d diff --git a/altosui/AltosGraphDataPoint.java b/altosui/AltosGraphDataPoint.java index 8e6d6923..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 { @@ -39,39 +39,51 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { public static final int data_temperature = 12; 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 { - if (state.data.time < -2) + double time = state.time_since_boost(); + if (time < -2) throw new AltosUIDataMissing(-1); - return state.data.time; + return time; } 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; break; case data_battery_voltage: - y = state.battery; + y = state.battery_voltage; break; case data_drogue_voltage: - y = state.drogue_sense; + y = state.apogee_voltage; break; case data_main_voltage: - y = state.main_sense; + y = state.main_voltage; break; case data_rssi: - y = state.data.rssi; + y = state.rssi; break; case data_gps_height: y = state.gps_height; @@ -94,15 +106,70 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { if (state.from_pad != null) y = state.from_pad.distance; break; + 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 == AltosRecord.MISSING) + if (y == AltosLib.MISSING) throw new AltosUIDataMissing(index); return y; } public int id(int index) { if (index == data_state) { - int s = state.data.state; + int s = state.state; if (s < Altos.ao_flight_boost || s > Altos.ao_flight_landed) return -1; return s; @@ -112,7 +179,7 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { public String id_name(int index) { if (index == data_state) - return state.data.state(); + return state.state_name(); return ""; }