From 8b08095b3d41e21684a10bddfb54431019da5af6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 May 2012 11:08:49 -0700 Subject: [PATCH] altos: Report latest telemetry data, rather than using the oldest ao_sample_adc points to the *next* ADC entry, rather than the most recent one. Step back one entry to get the latest valid data. Signed-off-by: Keith Packard --- src/core/ao_telemetry.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/ao_telemetry.c b/src/core/ao_telemetry.c index eb614b0f..46d72609 100644 --- a/src/core/ao_telemetry.c +++ b/src/core/ao_telemetry.c @@ -53,8 +53,7 @@ static __xdata union ao_telemetry_all telemetry; static void ao_send_sensor(void) { - uint8_t sample; - sample = ao_sample_adc; + uint8_t sample = ao_adc_ring_prev(ao_sample_adc); telemetry.generic.tick = ao_adc_ring[sample].tick; telemetry.generic.type = AO_TELEMETRY_SENSOR; -- 2.30.2