Merge branch 'master' of git://git.gag.com/fw/altos
authorAnthony Towns <aj@erisian.com.au>
Mon, 20 Sep 2010 12:05:26 +0000 (22:05 +1000)
committerAnthony Towns <aj@erisian.com.au>
Mon, 20 Sep 2010 12:05:26 +0000 (22:05 +1000)
ao-tools/altosui/AltosCSV.java
ao-tools/altosui/AltosEepromReader.java
ao-tools/altosui/AltosRecord.java
ao-tools/altosui/AltosState.java

index 07fa371f50e7c22bc6631a40acabb004fa5b1643..f7b3c03c0c60be6af31c8ed13ac208b110c0a91e 100644 (file)
@@ -111,9 +111,9 @@ public class AltosCSV {
        void write_basic(AltosRecord record) {
                out.printf("%8.2f,%10.2f,%8.2f,%8.2f,%8.2f,%8.2f,%5.1f,%5.2f,%5.2f,%5.2f",
                           record.acceleration(),
-                          record.pressure(),
-                          record.altitude(),
-                          record.height(),
+                          record.raw_pressure(),
+                          record.raw_altitude(),
+                          record.raw_height(),
                           record.accel_speed(),
                           state.baro_speed,
                           record.temperature(),
index 4cc8536a64a22bf889b35e26e6bc1e6d6ca9dcb1..03e738124f37e2bafd06f6327b42860f3cc4c1ee 100644 (file)
@@ -95,7 +95,6 @@ public class AltosEepromReader extends AltosReader {
        boolean                 last_reported;
 
        double                  ground_pres;
-       double                  ground_accel;
 
        int                     n_pad_samples;
 
@@ -140,9 +139,6 @@ public class AltosEepromReader extends AltosReader {
                                        ground_pres += state.pres;
                                        state.ground_pres = (int) (ground_pres / n_pad_samples);
                                        state.flight_pres = state.ground_pres;
-                                       ground_accel += state.accel;
-                                       state.ground_accel = (int) (ground_accel / n_pad_samples);
-                                       state.flight_accel = state.ground_accel;
                                } else {
                                        state.flight_pres = (state.flight_pres * 15 + state.pres) / 16;
                                        state.flight_accel = (state.flight_accel * 15 + state.accel) / 16;
@@ -345,6 +341,7 @@ public class AltosEepromReader extends AltosReader {
                                tick = record.tick;
                                if (record.cmd == Altos.AO_LOG_FLIGHT) {
                                        state.ground_accel = record.a;
+                                       state.flight_accel = record.a;
                                        state.flight = record.b;
                                        boost_tick = tick;
                                        seen |= seen_flight;
index b670ee371abed05de27cfd835642b16591a00adc..18c6079d01d84ea245c78a55b8f2e2bf28553ced 100644 (file)
@@ -73,7 +73,11 @@ public class AltosRecord {
                return ((count / 16.0) / 2047.0 + 0.095) / 0.009 * 1000.0;
        }
 
-       public double pressure() {
+       public double raw_pressure() {
+               return barometer_to_pressure(pres);
+       }
+
+       public double filtered_pressure() {
                return barometer_to_pressure(flight_pres);
        }
 
@@ -81,16 +85,24 @@ public class AltosRecord {
                return barometer_to_pressure(ground_pres);
        }
 
-       public double altitude() {
-               return AltosConvert.pressure_to_altitude(pressure());
+       public double filtered_altitude() {
+               return AltosConvert.pressure_to_altitude(filtered_pressure());
+       }
+
+       public double raw_altitude() {
+               return AltosConvert.pressure_to_altitude(raw_pressure());
        }
 
        public double ground_altitude() {
                return AltosConvert.pressure_to_altitude(ground_pressure());
        }
 
-       public double height() {
-               return altitude() - ground_altitude();
+       public double filtered_height() {
+               return filtered_altitude() - ground_altitude();
+       }
+
+       public double raw_height() {
+               return raw_altitude() - ground_altitude();
        }
 
        public double battery_voltage() {
index 3ef00f35d7d87375cf4967553f5e28c3bdd6edd6..90e73f5eff42a3aadd83b4322047ee1e2cb029cf 100644 (file)
@@ -80,7 +80,7 @@ public class AltosState {
                data = cur;
 
                ground_altitude = data.ground_altitude();
-               height = data.altitude() - ground_altitude;
+               height = data.filtered_altitude() - ground_altitude;
 
                report_time = System.currentTimeMillis();