From b57f1cabfe5052306cb4c28793bea477f4aeb2d2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Nov 2013 15:18:58 +0900 Subject: [PATCH] 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 --- src/core/ao_gps_report_metrum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.30.2