Track which telemetry packets are actually producing new GPS
information and only update the GPS average position and count of
stable GPS reports with new GPS info, instead of on every telemetry packet.
Signed-off-by: Keith Packard <keithp@keithp.com>
state.gps.locked = (flags & Altos.AO_GPS_VALID) != 0;
state.gps.nsat = (flags & Altos.AO_GPS_NUM_SAT_MASK) >>
Altos.AO_GPS_NUM_SAT_SHIFT;
state.gps.locked = (flags & Altos.AO_GPS_VALID) != 0;
state.gps.nsat = (flags & Altos.AO_GPS_NUM_SAT_MASK) >>
Altos.AO_GPS_NUM_SAT_SHIFT;
has_gps = true;
break;
case Altos.AO_LOG_GPS_LAT:
has_gps = true;
break;
case Altos.AO_LOG_GPS_LAT:
int flight_pres;
AltosGPS gps;
int flight_pres;
AltosGPS gps;
double time; /* seconds since boost */
double time; /* seconds since boost */
speed = old.speed;
height = old.height;
gps = new AltosGPS(old.gps);
speed = old.speed;
height = old.height;
gps = new AltosGPS(old.gps);
companion = old.companion;
}
companion = old.companion;
}
speed = MISSING;
height = MISSING;
gps = new AltosGPS();
speed = MISSING;
height = MISSING;
gps = new AltosGPS();
- if (state == Altos.ao_flight_pad || state == Altos.ao_flight_idle) {
+ if (cur.new_gps && (state == Altos.ao_flight_pad || state == Altos.ao_flight_idle)) {
/* Track consecutive 'good' gps reports, waiting for 10 of them */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4)
/* Track consecutive 'good' gps reports, waiting for 10 of them */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4)
flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, MISSING);
flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, MISSING);
flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, MISSING);
flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, MISSING);
- if (map.has(AO_TELEM_GPS_STATE))
+ if (map.has(AO_TELEM_GPS_STATE)) {
}
gps = new AltosGPS(words, i, version);
}
gps = new AltosGPS(words, i, version);
}
public AltosTelemetryRecordLegacy(String line) throws ParseException, AltosCRCException {
}
public AltosTelemetryRecordLegacy(String line) throws ParseException, AltosCRCException {
if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) {
gps = new AltosGPS();
if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) {
gps = new AltosGPS();
seen |= seen_gps_time | seen_gps_lat | seen_gps_lon;
gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK);
seen |= seen_gps_time | seen_gps_lat | seen_gps_lon;
gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK);
next.gps.hdop = hdop;
next.gps.vdop = vdop;
next.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon;
next.gps.hdop = hdop;
next.gps.vdop = vdop;
next.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon;