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>
static void
ao_send_sensor(void)
{
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;
telemetry.generic.tick = ao_adc_ring[sample].tick;
telemetry.generic.type = AO_TELEMETRY_SENSOR;