Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
chemo_detect.c
Go to the documentation of this file.
1 #include "chemo_detect.h"
2 #include "enose.h"
3 
4 #define DETECT_PERIOD 8 /* *4Hz */
5 #define THRESHOLD 150
6 
8 
9 void chemo_init( void ) {
10  chemo_sensor = 0;
11 }
12 
13 void chemo_periodic( void ) {
14 #ifdef ENOSE
16  static int idx;
17 
18  /* Detection on the first sensor */
19  int dval = enose_val[0] - vals[0][idx];
20  if (dval < -THRESHOLD) {
21  chemo_sensor = -dval;
22  } else
23  chemo_sensor = 0;
24 
25  int i;
26  for(i = 0; i < ENOSE_NB_SENSOR; i++)
27  vals[i][idx] = enose_val[i];
28 
29  idx++;
30  if (idx > DETECT_PERIOD)
31  idx = 0;
32 #endif /* ENOSE */
33 }
#define THRESHOLD
Definition: chemo_detect.c:5
unsigned short uint16_t
Definition: types.h:16
#define DETECT_PERIOD
Definition: chemo_detect.c:4
uint16_t enose_val[ENOSE_NB_SENSOR]
Definition: sim_enose.c:5
void chemo_periodic(void)
Definition: chemo_detect.c:13
uint16_t chemo_sensor
Definition: chemo_detect.c:7
void chemo_init(void)
Definition: chemo_detect.c:9
#define ENOSE_NB_SENSOR
Definition: enose.h:13