From: Keith Packard Date: Tue, 1 May 2012 18:08:49 +0000 (-0700) Subject: altos: Report latest telemetry data, rather than using the oldest X-Git-Tag: 1.0.9.5~25^2~12 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=8b08095b3d41e21684a10bddfb54431019da5af6 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 --- 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;