altoslib: Compute accelerometer speed from megametrum eeprom data
authorKeith Packard <keithp@keithp.com>
Sun, 21 Oct 2012 21:11:07 +0000 (14:11 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 21 Oct 2012 21:11:07 +0000 (14:11 -0700)
Duplicates code from the TM eeprom state tracking code.

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

index 5f952f7a96a1b8aa02543076de90638f3e8cb860..63b37f82c2c953965e7610dff47d20f5e451dec2 100644 (file)
@@ -111,7 +111,11 @@ public class AltosRecordMM extends AltosRecord {
        }
 
        public double accel_speed() {
-               return speed;
+               if (speed != MISSING)
+                       return speed;
+               if (flight_vel == MISSING)
+                       return MISSING;
+               return flight_vel / (accel_counts_per_mss() * 100.0);
        }
 
        public void copy (AltosRecordMM old) {