9 files changed
+54
-8
No files matched your search
+30
-2
@@ -32,10 +32,16 @@ Bsec iaqSensor;
|
||||
|
||||
#elif defined HAS_BME280
|
||||
|
||||
Adafruit_BME280 bme; // I2C
|
||||
// Adafruit_BME280 bme(BME_CS); // hardware SPI
|
||||
Adafruit_BME280 bme; // using I2C interface
|
||||
|
||||
// use these alternative constructors for other hw interface types
|
||||
// Adafruit_BME280 bme(BME_CS); // hardware SPI
|
||||
// Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
|
||||
|
||||
#elif defined HAS_BMP180
|
||||
|
||||
Adafruit_BMP085 bmp; // I2C
|
||||
|
||||
#endif
|
||||
|
||||
void bmecycle() { xTaskNotify(irqHandlerTask, BME_IRQ, eSetBits); }
|
||||
@@ -105,6 +111,23 @@ int bme_init(void) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
#elif defined HAS_BMP180
|
||||
bool status;
|
||||
// block i2c bus access
|
||||
if (I2C_MUTEX_LOCK()) {
|
||||
// Wire.begin(21, 22);
|
||||
status = bmp.begin();
|
||||
if (!status) {
|
||||
ESP_LOGE(TAG, "BMP180 sensor not found");
|
||||
rc = 0;
|
||||
goto finish;
|
||||
}
|
||||
ESP_LOGI(TAG, "BMP180 sensor found and initialized");
|
||||
} else {
|
||||
ESP_LOGE(TAG, "I2c bus busy - BMP180 initialization error");
|
||||
rc = 0;
|
||||
goto finish;
|
||||
}
|
||||
#endif
|
||||
|
||||
finish:
|
||||
@@ -168,6 +191,11 @@ void bme_storedata(bmeStatus_t *bme_store) {
|
||||
// bme.readAltitude(SEALEVELPRESSURE_HPA);
|
||||
bme_store->humidity = bme.readHumidity();
|
||||
bme_store->iaq = 0; // IAQ feature not present with BME280
|
||||
#elif defined HAS_BMP180
|
||||
bme_store->temperature = bmp.readTemperature();
|
||||
bme_store->pressure = (bmp.readPressure() / 100.0); // conversion Pa -> hPa
|
||||
// bme.readAltitude(SEALEVELPRESSURE_HPA);
|
||||
bme_store->iaq = 0; // IAQ feature not present with BME280
|
||||
#endif
|
||||
|
||||
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
||||
|
||||
@@ -81,6 +81,9 @@ void doHousekeeping() {
|
||||
#elif defined HAS_BME280
|
||||
ESP_LOGI(TAG, "BME280 Temp: %.2f°C | Humidity: %.2f | Pressure: %.0f",
|
||||
bme_status.temperature, bme_status.humidity, bme_status.pressure);
|
||||
#elif defined HAS_BMP180
|
||||
ESP_LOGI(TAG, "BMP180 Temp: %.2f°C | Pressure: %.0f",
|
||||
bme_status.temperature, bme_status.pressure);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+4
-1
@@ -56,7 +56,7 @@ static const char TAG[] = __FILE__;
|
||||
const char *printmonth[] = {"xxx", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
uint8_t DisplayIsOn = 0;
|
||||
uint8_t displaybuf[DISPLAY_WIDTH * DISPLAY_HEIGHT / 8] = {0};
|
||||
static uint8_t displaybuf[DISPLAY_WIDTH * DISPLAY_HEIGHT / 8] = {0};
|
||||
|
||||
QRCode qrcode;
|
||||
|
||||
@@ -82,6 +82,9 @@ void init_display(bool verbose) {
|
||||
oledInit(OLED_128x64, true, false, -1, -1, 400000L);
|
||||
#endif
|
||||
|
||||
// set display buffer
|
||||
//oledSetBackBuffer(displaybuf);
|
||||
|
||||
// clear display
|
||||
oledSetContrast(DISPLAYCONTRAST);
|
||||
oledFill(0, 1);
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
//#define HAS_BME280 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL
|
||||
//#define BME280_ADDR 0x76 // change to 0x77 depending on your wiring
|
||||
|
||||
// BMP180 sensor on I2C bus
|
||||
//#define HAS_BMP180
|
||||
//#define BMP180_ADDR 0x77
|
||||
|
||||
// user defined sensors
|
||||
//#define HAS_SENSORS 1 // comment out if device has user defined sensors
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
//#define HAS_BME 1 // Enable BME sensors in general
|
||||
//#define HAS_BME680 GPIO_NUM_4, GPIO_NUM_15 // SDA, SCL
|
||||
//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND
|
||||
//#define HAS_BMP180
|
||||
//#define BMP180_ADDR 0x77
|
||||
|
||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||
#define CFG_sx1276_radio 1
|
||||
|
||||
@@ -390,6 +390,8 @@ void setup() {
|
||||
strcat_P(features, " BME680");
|
||||
#elif defined HAS_BME280
|
||||
strcat_P(features, " BME280");
|
||||
#elif defined HAS_BMP180
|
||||
strcat_P(features, " BMP180");
|
||||
#endif
|
||||
if (bme_init())
|
||||
ESP_LOGI(TAG, "Starting BME sensor...");
|
||||
|
||||
Reference in new issue
Block a user