diff options
author | Keith Packard <keithp@keithp.com> | 2012-05-01 11:08:49 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-05-01 11:08:49 -0700 |
commit | 8b08095b3d41e21684a10bddfb54431019da5af6 (patch) | |
tree | 56083711136e4a59f1c2a591844a4c744dd849bc | |
parent | 7b0b6bcc40891d8dd106d091d3af8107b2941c66 (diff) |
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 <keithp@keithp.com>
-rw-r--r-- | src/core/ao_telemetry.c | 3 |
1 files changed, 1 insertions, 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; |