summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
455a059)
The 'Pad Altitude' field in the pad tab of AltosUI was originally one
of three fields designed to report the GPS position of the pad. When
TeleMini was added, the code was updated to separate the lat/lon from
altitude display, but the pad_alt field in AltosState used for that
was still only computed from GPS data.
This fix gets rid of the confusing 'pad_alt' field in AltosState and
has the 'Pad Altitude' data select either GPS ground altitude or baro
ground altitude, depending on whether GPS data is available.
signed-off-by: Keith Packard <keithp@keithp.com>
class AltosGpsGroundAltitude extends AltosValue {
void set(double a, double t) {
super.set(a, t);
class AltosGpsGroundAltitude extends AltosValue {
void set(double a, double t) {
super.set(a, t);
gps_altitude.set_gps_height();
}
void set_filtered(double a, double t) {
super.set_filtered(a, t);
gps_altitude.set_gps_height();
}
void set_filtered(double a, double t) {
super.set_filtered(a, t);
gps_altitude.set_gps_height();
}
gps_altitude.set_gps_height();
}
public double gps_height;
public double gps_height;
- public double pad_lat, pad_lon, pad_alt;
+ public double pad_lat, pad_lon;
public int speak_tick;
public double speak_altitude;
public int speak_tick;
public double speak_altitude;
pad_lat = AltosLib.MISSING;
pad_lon = AltosLib.MISSING;
pad_lat = AltosLib.MISSING;
pad_lon = AltosLib.MISSING;
- pad_alt = AltosLib.MISSING;
gps_altitude = new AltosGpsAltitude();
gps_ground_altitude = new AltosGpsGroundAltitude();
gps_altitude = new AltosGpsAltitude();
gps_ground_altitude = new AltosGpsGroundAltitude();
class PadAlt extends AltosUIUnitsIndicator {
public double value(AltosState state, int i) {
class PadAlt extends AltosUIUnitsIndicator {
public double value(AltosState state, int i) {
- if (report_pad(state))
- return state.pad_alt;
- else if (state.gps != null)
+ if (report_pad(state)) {
+ double alt = state.gps_ground_altitude();
+ if (alt == AltosLib.MISSING)
+ alt = state.ground_altitude();
+ return alt;
+ }
+ else if (state.gps != null && state.gps.alt != AltosLib.MISSING)
return state.gps.alt;
else
return state.altitude();
return state.gps.alt;
else
return state.altitude();
}
info_add_deg(1, "Pad latitude", state.pad_lat, 'N', 'S');
info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
}
info_add_deg(1, "Pad latitude", state.pad_lat, 'N', 'S');
info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
- info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
+ info_add_row(1, "Pad GPS alt", "%6.0f m", state.gps_ground_altitude());
}
if (state.gps.year != AltosLib.MISSING)
info_add_row(2, "GPS date", "%04d-%02d-%02d",
}
if (state.gps.year != AltosLib.MISSING)
info_add_row(2, "GPS date", "%04d-%02d-%02d",