altos: Tmega Don't try to log info about more than 12 GPS sats
authorKeith Packard <keithp@keithp.com>
Fri, 24 Jan 2014 17:21:46 +0000 (09:21 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 24 Jan 2014 17:21:46 +0000 (09:21 -0800)
The mega log format has a single packet for GPS info which holds a
maximum of 12 satellites. Bdale managed to get 14 sats in view, which
ended up crashing the ground station software, and also overflowed the
gps_tracking_data structure.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao_gps_report_mega.c

index 07a2bc5b0ce7790f0c43ed4bcb88e2897ed761ab..5e3c71bfa309e1ecb6f3fecb954dde596ff12283 100644 (file)
@@ -70,6 +70,8 @@ ao_gps_report_mega(void)
                                {
                                        gps_log.u.gps_sat.sats[i].c_n = gps_tracking_data.sats[c].c_n_1;
                                        i++;
+                                       if (i >= 12)
+                                               break;
                                }
                        gps_log.u.gps_sat.channels = i;
                        ao_log_mega(&gps_log);