altoslib: Set default accel cal for old TeleMetrum v1 files
authorKeith Packard <keithp@keithp.com>
Mon, 15 May 2017 19:13:35 +0000 (12:13 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 15 May 2017 19:15:36 +0000 (12:15 -0700)
Before we stashed the config data in the log file, altoslib had to
"known" what the accelerometer calibration values should be set
to.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosEepromRecordFull.java

index 4b1a460f91230c56d6f21e06ac94cedbd068240a..fbb8fbd9e7ff14cd528f27f564f5a6c0d8964797 100644 (file)
@@ -19,6 +19,8 @@ public class AltosEepromRecordFull extends AltosEepromRecord {
 
        public static final int max_sat = 12;
 
+       public static final int two_g_default = 16294 - 15758;
+
        public void update_state(AltosState state) {
                super.update_state(state);
                AltosGPS        gps;
@@ -43,6 +45,8 @@ public class AltosEepromRecordFull extends AltosEepromRecord {
                        state.set_state(AltosLib.ao_flight_pad);
                        state.set_ground_accel(data16(0));
                        state.set_flight(data16(2));
+                       if (state.accel_plus_g == AltosLib.MISSING)
+                               state.set_accel_g(data16(0), data16(0) + two_g_default);
                        break;
                case AltosLib.AO_LOG_SENSOR:
                        state.set_accel(data16(0));