From 320ec01c1457d6126d16b37f196c087b4364d4ec Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 25 Nov 2018 18:27:20 +0100 Subject: [PATCH] BME280 fixes --- platformio.ini | 4 ++-- src/hal/generic.h | 1 + src/hal/octopus32.h | 1 + src/hal/ttgobeam.h | 5 ++++- src/led.cpp | 10 ++++++---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index 58915b68..69d42cb9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -6,7 +6,7 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] -env_default = generic +;env_default = generic ;env_default = ebox ;env_default = eboxtube ;env_default = heltec @@ -15,7 +15,7 @@ env_default = generic ;env_default = ttgov2 ;env_default = ttgov21old ;env_default = ttgov21new -;env_default = ttgobeam +env_default = ttgobeam ;env_default = lopy ;env_default = lopy4 ;env_default = fipy diff --git a/src/hal/generic.h b/src/hal/generic.h index ba328c3e..ad88536f 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -17,6 +17,7 @@ // enable only if device has these sensors, otherwise comment these lines // 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 // user defined sensors diff --git a/src/hal/octopus32.h b/src/hal/octopus32.h index 8e67d643..6d8ffdc0 100644 --- a/src/hal/octopus32.h +++ b/src/hal/octopus32.h @@ -14,6 +14,7 @@ // enable only if device has these sensors, otherwise comment these lines // 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 // user defined sensors diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index 93c024ce..8691c79f 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -9,7 +9,10 @@ // enable only if device has these sensors, otherwise comment these lines // 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_LED NOT_A_PIN // on board green LED // 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 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) diff --git a/src/led.cpp b/src/led.cpp index f8fb596a..8a90f9ec 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -107,15 +107,17 @@ void switch_LED(uint8_t state) { #endif } -#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) - 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 LEDBlinkDuration = set_blinkduration; // duration LEDBlinkStarted = millis(); // Time Start here LEDState = LED_ON; // Let main set LED on +#endif } +#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) + void ledLoop(void *parameter) { while (1) { // Custom blink running always have priority other LoRaWAN led @@ -189,8 +191,8 @@ void ledLoop(void *parameter) { } // give yield to CPU vTaskDelay(2 / portTICK_PERIOD_MS); - } // while(1) + } // while(1) vTaskDelete(ledLoopTask); // shoud never be reached -}; // ledloop() +}; // ledloop() #endif // #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)