summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-11-12 15:18:58 +0900
committerKeith Packard <keithp@keithp.com>2013-11-12 16:27:31 +0900
commitb57f1cabfe5052306cb4c28793bea477f4aeb2d2 (patch)
tree35396e2dc806bcaca50519e96747be690d662d00
parent0951b1ef83d8d741d65811fa23bde43ee843a939 (diff)
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 <keithp@keithp.com>
-rw-r--r--src/core/ao_gps_report_metrum.c3
1 files changed, 2 insertions, 1 deletions
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)