Switch from GPLv2 to GPLv2+
[fw/altos] / altoslib / AltosTelemetryMegaSensor.java
index 23b67af8b03e8a37ba82a172b28b0ae54625d874..2dfc455aa5ca0d09adf7859d1581e6344ddfc405 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_2;
+package org.altusmetrum.altoslib_11;
 
 public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
        int     accel;
@@ -34,9 +35,12 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
        int     mag_y;
        int     mag_z;
 
+       int     orient;
+
        public AltosTelemetryMegaSensor(int[] bytes) {
                super(bytes);
 
+               orient        = int8(5);
                accel         = int16(6);
                pres          = int32(8);
                temp          = int16(12);
@@ -61,24 +65,15 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
                state.set_pressure(pres);
                state.set_temperature(temp / 100.0);
 
-               AltosIMU imu = new AltosIMU();
-               
-               imu.accel_x = accel_x;
-               imu.accel_y = accel_y;
-               imu.accel_z = accel_z;
-
-               imu.gyro_x = gyro_x;
-               imu.gyro_y = gyro_y;
-               imu.gyro_z = gyro_z;
-
-               state.imu = imu;
-
-               AltosMag mag = new AltosMag();
+               state.set_orient(orient);
 
-               mag.x = mag_x;
-               mag.y = mag_y;
-               mag.z = mag_z;
+               state.set_imu(new AltosIMU(accel_y,     /* along */
+                                          accel_x,     /* across */
+                                          accel_z,     /* through */
+                                          gyro_y,      /* along */
+                                          gyro_x,      /* across */
+                                          gyro_z));    /* through */
 
-               state.mag = mag;
+               state.set_mag(new AltosMag(mag_x, mag_y, mag_z));
        }
 }