From 8452347bf3380d81367f5e43da1e570473e387c2 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Mon, 2 Nov 2020 18:44:06 +0100 Subject: [PATCH] HAS_SENSOR defines sanitization --- include/sensor.h | 4 +++- src/hal/generic.h | 6 ++++-- src/hal/m5core.h | 3 --- src/hal/m5fire.h | 3 --- src/hal/octopus32.h | 3 --- src/hal/ttgobeam.h | 3 --- src/hal/ttgobeam10.h | 3 --- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/include/sensor.h b/include/sensor.h index 6e6b837b..322c78a7 100644 --- a/include/sensor.h +++ b/include/sensor.h @@ -1,8 +1,10 @@ #ifndef _SENSOR_H #define _SENSOR_H +#define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) + uint8_t sensor_mask(uint8_t sensor_no); -uint8_t * sensor_read(uint8_t sensor); +uint8_t *sensor_read(uint8_t sensor); void sensor_init(void); #endif \ No newline at end of file diff --git a/src/hal/generic.h b/src/hal/generic.h index 0010f69d..10db27e9 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -55,8 +55,10 @@ #define SDS_TX 19 // connect to RX on the SDS011 #define SDS_RX 23 // connect to TX on the SDS011 -// user defined sensors -#define HAS_SENSORS 1 // comment out if device has user defined sensors +// up to three user defined sensors (if connected) +//#define HAS_SENSOR_1 1 // comment out if device has user defined sensor #1 +//#define HAS_SENSOR_2 1 // comment out if device has user defined sensor #2 +//#define HAS_SENSOR_3 1 // comment out if device has user defined sensor #3 #define CFG_sx1276_radio 1 // select LoRa chip //#define CFG_sx1272_radio 1 // select LoRa chip diff --git a/src/hal/m5core.h b/src/hal/m5core.h index 17dc7f22..7a65e40a 100644 --- a/src/hal/m5core.h +++ b/src/hal/m5core.h @@ -25,9 +25,6 @@ #define SDCARD_MISO MISO #define SDCARD_SCLK SCK -// user defined sensors -//#define HAS_SENSORS 1 // comment out if device has user defined sensors - #define CFG_sx1276_radio 1 // select LoRa chip #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature diff --git a/src/hal/m5fire.h b/src/hal/m5fire.h index a35bbb93..8cf4e097 100644 --- a/src/hal/m5fire.h +++ b/src/hal/m5fire.h @@ -28,9 +28,6 @@ #define SDCARD_MISO MISO #define SDCARD_SCLK SCK -// user defined sensors -//#define HAS_SENSORS 1 // comment out if device has user defined sensors - #define CFG_sx1276_radio 1 // select LoRa chip #define BOARD_HAS_PSRAM // use if board has external PSRAM #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature diff --git a/src/hal/octopus32.h b/src/hal/octopus32.h index b040b71f..b7de8b12 100644 --- a/src/hal/octopus32.h +++ b/src/hal/octopus32.h @@ -20,9 +20,6 @@ #define HAS_BME680 GPIO_NUM_23, GPIO_NUM_22 // SDA, SCL #define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND -// user defined sensors -//#define HAS_SENSORS 1 // comment out if device has user defined sensors - #define HAS_LED 13 // ESP32 GPIO12 (pin22) On Board LED //#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW //#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index 61547adc..76e6ae51 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -39,9 +39,6 @@ #define MY_DISPLAY_RST NOT_A_PIN //#define MY_DISPLAY_FLIP 1 // use if display is rotated -// user defined sensors (if connected) -//#define HAS_SENSORS 1 // comment out if device has user defined sensors - //#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #endif diff --git a/src/hal/ttgobeam10.h b/src/hal/ttgobeam10.h index 96238c71..f7cae001 100644 --- a/src/hal/ttgobeam10.h +++ b/src/hal/ttgobeam10.h @@ -52,9 +52,6 @@ Reset -> reset device //#define HAS_BME680 SDA, SCL //#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! -// user defined sensors (if connected) -//#define HAS_SENSORS 1 // comment out if device has user defined sensors - //#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #endif