+ int imu_type;
+
+ private int accel_across(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return accel_x();
+ case AltosIMU.imu_type_easymega_v2:
+ return -accel_y();
+ case AltosIMU.imu_type_telemega_v4:
+ return -accel_y();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int accel_along(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return accel_y();
+ case AltosIMU.imu_type_easymega_v2:
+ case AltosIMU.imu_type_telemega_v4:
+ return accel_x();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int accel_through(int imu_type) {
+ return accel_z();
+ }
+
+ private int gyro_roll(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return gyro_y();
+ case AltosIMU.imu_type_easymega_v2:
+ case AltosIMU.imu_type_telemega_v4:
+ return gyro_x();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int gyro_pitch(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return gyro_x();
+ case AltosIMU.imu_type_easymega_v2:
+ return -gyro_y();
+ case AltosIMU.imu_type_telemega_v4:
+ return gyro_y();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int gyro_yaw(int imu_type) {
+ return gyro_z();
+ }
+
+ private int mag_across(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return mag_x();
+ case AltosIMU.imu_type_telemega_v4:
+ case AltosIMU.imu_type_easymega_v2:
+ return -mag_y();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int mag_along(int imu_type) {
+ switch (imu_type) {
+ case AltosIMU.imu_type_telemega_v1_v2:
+ case AltosIMU.imu_type_telemega_v3:
+ case AltosIMU.imu_type_easymega_v1:
+ return mag_y();
+ case AltosIMU.imu_type_easymega_v2:
+ case AltosIMU.imu_type_telemega_v4:
+ return mag_x();
+ default:
+ return AltosLib.MISSING;
+ }
+ }
+
+ private int mag_through(int imu_type) {
+ return mag_z();
+ }
+
+ public AltosTelemetryMegaSensor(int[] bytes, int imu_type) throws AltosCRCException {