]> git.gag.com Git - fw/altos/commitdiff
altosdroid: Set ground altitude to device altitude for TeleGPS altosdroid-height-above-me
authorKeith Packard <keithp@keithp.com>
Wed, 9 Oct 2024 17:51:55 +0000 (10:51 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 9 Oct 2024 17:51:55 +0000 (10:51 -0700)
Use the current device altitude as the 'ground' altitude for height
computations. This should make the height data far more useful as it
won't be using some early GPS data from the device.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java

index fd16197072ec30d2a46a45ff6f742ca8824b73f7..33901e34e610fdbbcad6e1def78651a1777470d3 100644 (file)
@@ -505,8 +505,10 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
 
                        if (location != null && state.gps != null && state.gps.locked) {
                                double altitude = 0;
-                               if (location.hasAltitude())
+                               if (location.hasAltitude()) {
                                        altitude = location.getAltitude();
+                                       state.set_gps_ground_altitude(altitude);
+                               }
                                from_receiver = new AltosGreatCircle(location.getLatitude(),
                                                                     location.getLongitude(),
                                                                     altitude,