[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [4947] added filtering of abnormal values
From: |
antoine drouin |
Subject: |
[paparazzi-commits] [4947] added filtering of abnormal values |
Date: |
Mon, 14 Jun 2010 16:50:56 +0000 |
Revision: 4947
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4947
Author: poine
Date: 2010-06-14 16:50:56 +0000 (Mon, 14 Jun 2010)
Log Message:
-----------
added filtering of abnormal values
Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.c
paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.h
Modified:
paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.c
2010-06-14 16:49:37 UTC (rev 4946)
+++ paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.c
2010-06-14 16:50:56 UTC (rev 4947)
@@ -30,6 +30,11 @@
#include <stm32/dma.h>
uint8_t ms2001_cur_axe;
+int16_t ms2001_last_reading; // can't write in place because that stupid beast
+ // stips stupid values once in a while that I need
+ // to filter - high time we get rid of this crap
hardware
+ // and no, I checked with the logic analyzer,
timing are
+ // within specs
void ms2001_arch_init( void ) {
Modified:
paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.h
2010-06-14 16:49:37 UTC (rev 4946)
+++ paparazzi3/trunk/sw/airborne/booz/arch/stm32/peripherals/booz_ms2001_arch.h
2010-06-14 16:50:56 UTC (rev 4947)
@@ -28,6 +28,7 @@
#include <stm32/spi.h>
extern uint8_t ms2001_cur_axe;
+extern int16_t ms2001_last_reading;
#define Ms2001Select() GPIOC->BRR = GPIO_Pin_12
#define Ms2001Unselect() GPIOC->BSRR = GPIO_Pin_12
@@ -87,7 +88,7 @@
DMA_InitTypeDef DMA_InitStructure;
\
DMA_DeInit(DMA1_Channel4); \
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(SPI2_BASE+0x0C); \
- DMA_InitStructure.DMA_MemoryBaseAddr =
(uint32_t)(&ms2001_values[ms2001_cur_axe]); \
+ DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)(&ms2001_last_reading); \
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; \
DMA_InitStructure.DMA_BufferSize = 1; \
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; \
@@ -121,20 +122,22 @@
\
}
-#define Ms2001OnDmaIrq() { \
- /* ASSERT((ms2001_status == MS2001_READING_RES), \
- * DEBUG_MS2001, MS2001_ERR_SPURIOUS_DMA_IRQ); \
- */ \
- Ms2001Unselect(); \
- ms2001_cur_axe++; \
- if (ms2001_cur_axe > 2) { \
- ms2001_cur_axe = 0; \
- ms2001_status = MS2001_DATA_AVAILABLE; \
- } \
- else \
- ms2001_status = MS2001_IDLE; \
- SPI_Cmd(SPI2, DISABLE); \
- DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE); \
+#define Ms2001OnDmaIrq() { \
+ /* ASSERT((ms2001_status == MS2001_READING_RES), \
+ * DEBUG_MS2001, MS2001_ERR_SPURIOUS_DMA_IRQ); \
+ */ \
+ if (abs(ms2001_last_reading) < 2000) \
+ ms2001_values[ms2001_cur_axe] = ms2001_last_reading; \
+ Ms2001Unselect(); \
+ ms2001_cur_axe++; \
+ if (ms2001_cur_axe > 2) { \
+ ms2001_cur_axe = 0; \
+ ms2001_status = MS2001_DATA_AVAILABLE; \
+ } \
+ else \
+ ms2001_status = MS2001_IDLE; \
+ SPI_Cmd(SPI2, DISABLE); \
+ DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE); \
}
#define Ms2001OnSpiIrq() { \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [4947] added filtering of abnormal values,
antoine drouin <=