From: Keith Packard Date: Tue, 12 Nov 2013 06:18:58 +0000 (+0900) Subject: altos: Don't hold GPS mutex while waiting in TM v2.0 report X-Git-Tag: 1.2.9.4~6 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=b57f1cabfe5052306cb4c28793bea477f4aeb2d2 altos: Don't hold GPS mutex while waiting in TM v2.0 report Holding the GPS mutex while waiting for the GPS code to dump data into the GPS variables is rather counter-productive. Signed-off-by: Keith Packard --- diff --git a/src/core/ao_gps_report_metrum.c b/src/core/ao_gps_report_metrum.c index b82936dd..fa038976 100644 --- a/src/core/ao_gps_report_metrum.c +++ b/src/core/ao_gps_report_metrum.c @@ -27,11 +27,12 @@ ao_gps_report_metrum(void) uint8_t c, n, i, p, valid, packets; uint8_t svid; uint8_t date_reported = 0; + uint8_t new; for (;;) { - ao_mutex_get(&ao_gps_mutex); while (!(new = ao_gps_new)) 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)