altos: Broke TeleMetrum GPS reporting by holding the GPS mutex too much
authorKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 04:23:00 +0000 (20:23 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 04:23:00 +0000 (20:23 -0800)
We can't hold the GPS mutex while waiting for the GPS receiver to load
data as it protects the GPS data with the GPS mutex.

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

index 8d15c083c905c2d149d22c1294e61b6bebeac387..07201ac235b69cd1656979fae18aaa94327c2d73 100644 (file)
@@ -27,9 +27,9 @@ ao_gps_report(void)
        uint8_t new;
 
        for (;;) {
-               ao_mutex_get(&ao_gps_mutex);
                while ((new = ao_gps_new) == 0)
                        ao_sleep(&ao_gps_new);
+               ao_mutex_get(&ao_gps_mutex);
                if (new & AO_GPS_NEW_DATA)
                        ao_xmemcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
                if (new & AO_GPS_NEW_TRACKING)