altosui: Hacks to plug into the new graph stuff
[fw/altos] / altoslib / AltosEepromRecordFull.java
index d240da283e131ffbe2db8c21715f0b88c507aec8..0fdfa5e73c2473c7a6184762e85934d3296273f3 100644 (file)
@@ -19,12 +19,15 @@ public class AltosEepromRecordFull extends AltosEepromRecord {
 
        public static final int max_sat = 12;
 
-       public void update_state(AltosState state) {
+       public static final int two_g_default = 16294 - 15758;
+
+       public void update_state(AltosFlightListener state) {
+
                super.update_state(state);
                AltosGPS        gps;
 
                /* Flush any pending GPS changes */
-               if (state.gps_pending) {
+               if (state.gps_pending()) {
                        switch (cmd()) {
                        case AltosLib.AO_LOG_GPS_LAT:
                        case AltosLib.AO_LOG_GPS_LON:
@@ -43,6 +46,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));
@@ -108,9 +113,10 @@ public class AltosEepromRecordFull extends AltosEepromRecord {
        }
 
        public AltosEepromRecord next() {
-               if (start + length + length < eeprom.data.size())
-                       return new AltosEepromRecordFull(eeprom, start + length);
-               return null;
+               int     s = next_start();
+               if (s < 0)
+                       return null;
+               return new AltosEepromRecordFull(eeprom, s);
        }
 
        public AltosEepromRecordFull(AltosEepromNew eeprom, int start) {