Sat data comes in multiple records, but the tick is always the same,
so use that to tell when the set of sats is new
Signed-off-by: Keith Packard <keithp@keithp.com>
public AltosGPS gps;
public AltosGPS temp_gps;
public AltosGPS gps;
public AltosGPS temp_gps;
- public boolean temp_gps_clear_sats_pending;
+ public int temp_gps_sat_tick;
public boolean gps_pending;
public int gps_sequence;
public boolean gps_pending;
public int gps_sequence;
gps = null;
temp_gps = null;
gps = null;
temp_gps = null;
- temp_gps_clear_sats_pending = false;
gps_sequence = 0;
gps_pending = false;
gps_sequence = 0;
gps_pending = false;
temp_gps = old.temp_gps.clone();
else
temp_gps = null;
temp_gps = old.temp_gps.clone();
else
temp_gps = null;
- temp_gps_clear_sats_pending = old.temp_gps_clear_sats_pending;
+ temp_gps_sat_tick = old.temp_gps_sat_tick;
gps_sequence = old.gps_sequence;
gps_pending = old.gps_pending;
gps_sequence = old.gps_sequence;
gps_pending = old.gps_pending;
temp_gps = new AltosGPS(gps);
}
gps_pending = true;
temp_gps = new AltosGPS(gps);
}
gps_pending = true;
- if (!sats)
- temp_gps_clear_sats_pending = true;
- else if (temp_gps_clear_sats_pending) {
- temp_gps.cc_gps_sat = null;
- temp_gps_clear_sats_pending = false;
+ if (sats) {
+ if (tick != temp_gps_sat_tick)
+ temp_gps.cc_gps_sat = null;
+ temp_gps_sat_tick = tick;