X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosEepromMega.java;h=082d6054f2fe8b25244c0f76fa8ce0d73d09c334;hp=aaff2410ff527588686c723e1efdac26007e7566;hb=51bdee662fdfad1937c576daadd2e5eacac17905;hpb=656d8fe17532ca6c7d1d43996f187df2f14f5395 diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java index aaff2410..082d6054 100644 --- a/altoslib/AltosEepromMega.java +++ b/altoslib/AltosEepromMega.java @@ -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_5; +package org.altusmetrum.altoslib_11; import java.io.*; import java.util.*; @@ -149,6 +150,12 @@ public class AltosEepromMega extends AltosEeprom { state.set_flight(flight()); state.set_ground_accel(ground_accel()); state.set_ground_pressure(ground_pres()); + state.set_accel_ground(ground_accel_along(), + ground_accel_across(), + ground_accel_through()); + state.set_gyro_zero(ground_roll() / 512.0, + ground_pitch() / 512.0, + ground_yaw() / 512.0); break; case AltosLib.AO_LOG_STATE: state.set_tick(tick); @@ -158,22 +165,21 @@ public class AltosEepromMega extends AltosEeprom { state.set_tick(tick); state.set_ms5607(pres(), temp()); - AltosIMU imu = new AltosIMU(); - imu.accel_x = AltosIMU.convert_accel(accel_x()); - imu.accel_y = AltosIMU.convert_accel(accel_y()); - imu.accel_z = AltosIMU.convert_accel(accel_z()); + AltosIMU imu = new AltosIMU(accel_y(), /* along */ + accel_x(), /* across */ + accel_z(), /* through */ + gyro_y(), /* roll */ + gyro_x(), /* pitch */ + gyro_z()); /* yaw */ - imu.gyro_x = AltosIMU.convert_gyro(gyro_x()); - imu.gyro_y = AltosIMU.convert_gyro(gyro_y()); - imu.gyro_z = AltosIMU.convert_gyro(gyro_z()); - state.imu = imu; + if (log_format == AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD) + state.check_imu_wrap(imu); - AltosMag mag = new AltosMag(); - mag.x = AltosMag.convert_gauss(mag_x()); - mag.y = AltosMag.convert_gauss(mag_y()); - mag.z = AltosMag.convert_gauss(mag_z()); + state.set_imu(imu); - state.mag = mag; + state.set_mag(new AltosMag(mag_x(), + mag_y(), + mag_z())); state.set_accel(accel());