From 9eeba439ce8c9dc1def8528f96b6a67c6578d656 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 27 May 2012 16:46:00 -0600 Subject: altos: Don't start ADC ring until the other sensors have a valid value Yes, this is still an ugly kludge, but it's easy. Signed-off-by: Keith Packard --- src/stm/ao_adc_stm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/stm') diff --git a/src/stm/ao_adc_stm.c b/src/stm/ao_adc_stm.c index 576dbf5d..02187205 100644 --- a/src/stm/ao_adc_stm.c +++ b/src/stm/ao_adc_stm.c @@ -50,15 +50,22 @@ static uint8_t ao_adc_ready; */ static void ao_adc_done(int index) { + uint8_t step = 1; ao_data_ring[ao_data_head].tick = ao_time(); #if HAS_MPU6000 + if (!ao_mpu6000_valid) + step = 0; ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current; #endif #if HAS_MS5607 + if (!ao_ms5607_valid) + step = 0; ao_data_ring[ao_data_head].ms5607 = ao_ms5607_current; #endif - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup((void *) &ao_data_head); + if (step) { + ao_data_head = ao_data_ring_next(ao_data_head); + ao_wakeup((void *) &ao_data_head); + } ao_dma_done_transfer(STM_DMA_INDEX(STM_DMA_CHANNEL_ADC1)); ao_adc_ready = 1; } -- cgit v1.2.3