BME280 fixes

This commit is contained in:
Klaus K Wilting 2018-11-25 18:27:20 +01:00
parent 75fb08e72c
commit 320ec01c14
5 changed files with 14 additions and 7 deletions

View File

@ -6,7 +6,7 @@
; ---> SELECT TARGET PLATFORM HERE! <--- ; ---> SELECT TARGET PLATFORM HERE! <---
[platformio] [platformio]
env_default = generic ;env_default = generic
;env_default = ebox ;env_default = ebox
;env_default = eboxtube ;env_default = eboxtube
;env_default = heltec ;env_default = heltec
@ -15,7 +15,7 @@ env_default = generic
;env_default = ttgov2 ;env_default = ttgov2
;env_default = ttgov21old ;env_default = ttgov21old
;env_default = ttgov21new ;env_default = ttgov21new
;env_default = ttgobeam env_default = ttgobeam
;env_default = lopy ;env_default = lopy
;env_default = lopy4 ;env_default = lopy4
;env_default = fipy ;env_default = fipy

View File

@ -17,6 +17,7 @@
// enable only if device has these sensors, otherwise comment these lines // enable only if device has these sensors, otherwise comment these lines
// BME680 sensor on I2C bus // BME680 sensor on I2C bus
// don't forget to connect SDIO of BME680 to GND for selecting i2c addr 0x76
#define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL #define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL
// user defined sensors // user defined sensors

View File

@ -14,6 +14,7 @@
// enable only if device has these sensors, otherwise comment these lines // enable only if device has these sensors, otherwise comment these lines
// BME680 sensor on I2C bus // BME680 sensor on I2C bus
// don't forget to connect SDIO of BME680 to GND for selecting i2c addr 0x76
#define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL #define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL
// user defined sensors // user defined sensors

View File

@ -9,7 +9,10 @@
// enable only if device has these sensors, otherwise comment these lines // enable only if device has these sensors, otherwise comment these lines
// BME680 sensor on I2C bus // BME680 sensor on I2C bus
// attention: Pin21 is also LED! set HAS_LED to NOT_A_PIN if using BME280
// don't forget to connect SDIO of BME680 to GND for selecting i2c addr 0x76
#define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL #define HAS_BME GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL
#define HAS_LED NOT_A_PIN // on board green LED
// user defined sensors // user defined sensors
//#define HAS_SENSORS 1 // comment out if device has user defined sensors //#define HAS_SENSORS 1 // comment out if device has user defined sensors
@ -18,7 +21,7 @@
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC #define CFG_sx1276_radio 1 // HPD13A LoRa SoC
#define BOARD_HAS_PSRAM // use extra 4MB external RAM #define BOARD_HAS_PSRAM // use extra 4MB external RAM
#define HAS_LED GPIO_NUM_21 // on board green LED //#define HAS_LED GPIO_NUM_21 // on board green LED
#define HAS_BUTTON GPIO_NUM_39 // on board button "BOOT" (next to reset button) #define HAS_BUTTON GPIO_NUM_39 // on board button "BOOT" (next to reset button)

View File

@ -107,15 +107,17 @@ void switch_LED(uint8_t state) {
#endif #endif
} }
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
void blink_LED(uint16_t set_color, uint16_t set_blinkduration) { void blink_LED(uint16_t set_color, uint16_t set_blinkduration) {
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
LEDColor = set_color; // set color for RGB LED LEDColor = set_color; // set color for RGB LED
LEDBlinkDuration = set_blinkduration; // duration LEDBlinkDuration = set_blinkduration; // duration
LEDBlinkStarted = millis(); // Time Start here LEDBlinkStarted = millis(); // Time Start here
LEDState = LED_ON; // Let main set LED on LEDState = LED_ON; // Let main set LED on
#endif
} }
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
void ledLoop(void *parameter) { void ledLoop(void *parameter) {
while (1) { while (1) {
// Custom blink running always have priority other LoRaWAN led // Custom blink running always have priority other LoRaWAN led
@ -189,8 +191,8 @@ void ledLoop(void *parameter) {
} }
// give yield to CPU // give yield to CPU
vTaskDelay(2 / portTICK_PERIOD_MS); vTaskDelay(2 / portTICK_PERIOD_MS);
} // while(1) } // while(1)
vTaskDelete(ledLoopTask); // shoud never be reached vTaskDelete(ledLoopTask); // shoud never be reached
}; // ledloop() }; // ledloop()
#endif // #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) #endif // #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)