+ 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;
+ }
+ }
+
+ public static int mag_along_axis(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 AltosIMU.imu_axis_y;
+ case AltosIMU.imu_type_easymega_v2:
+ case AltosIMU.imu_type_telemega_v4:
+ return AltosIMU.imu_axis_x;
+ 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;
+ }
+ }