Skip to content

Commit

Permalink
Add preprocessor switch to select between two VOC sensor types
Browse files Browse the repository at this point in the history
  • Loading branch information
chamodw committed Mar 1, 2021
1 parent 91c9416 commit ef4be7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#error "Hardware version not defined"
#endif


#define K_VOC_TYPE 0 /* 0 = Sensirion, 1 = AGS02MA */



//Set LED Status
void dev_led(uint8_t led, uint8_t status);

Expand Down
8 changes: 5 additions & 3 deletions src/sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ uint8_t sensor_init()
#elif KIW_SENSOR_TYPE == SENSOR_TYPE_HUMIDITY
e = humidity_init();
#elif KIW_SENSOR_TYPE == SENSOR_TYPE_VOC
#if K_HW_VERSION == 2
#if K_VOC_TYPE == 0
e = tvoc_init();
#else
//e = ags02ma_init();
#endif

#elif KIW_SENSOR_TYPE == SENSOR_TYPE_COLOUR
Expand Down Expand Up @@ -121,9 +123,9 @@ uint16_t sensor_read(int16_t* dest)

uint16_t tvoc_ppb, co2_eq_ppm = 0;
int8_t e;
#if K_HW_VERSION == 2
#if K_VOC_TYPE == 0
e = tvoc_measure(&tvoc_ppb, &co2_eq_ppm);
#elif K_HW_VERSION == 3
#elif K_VOC_TYPE == 1
e = ags02ma_measure (&tvoc_ppb);
#endif
if(e == K_SENSOR_OK)
Expand Down

0 comments on commit ef4be7d

Please sign in to comment.