From 508ae3e716d8d24001f5fcf4605844bba952411c Mon Sep 17 00:00:00 2001
From: Darrell
Date: Sat, 13 Aug 2022 14:52:20 -0400
Subject: [PATCH] Additional I2C improvements (#547)
* Add support for BMP280/BMP085/180
* Fixes I2C pin defaults for M5Stick and M5Atom
---
platformio.ini | 2 +
src/BH1750.cpp | 8 +-
src/{BME280Sensor.cpp => BME280.cpp} | 10 +-
src/{BME280Sensor.h => BME280.h} | 0
src/BMP180.cpp | 81 +++++++++
src/BMP180.h | 14 ++
src/BMP280.cpp | 91 +++++++++++
src/BMP280.h | 14 ++
src/DHT.cpp | 3 +-
src/I2C.cpp | 217 ++++++++++++-------------
src/{TSL2561Sensor.cpp => TSL2561.cpp} | 9 +-
src/{TSL2561Sensor.h => TSL2561.h} | 0
src/defaults.h | 18 ++
src/globals.h | 8 +-
src/main.cpp | 10 ++
src/main.h | 6 +-
16 files changed, 354 insertions(+), 137 deletions(-)
rename src/{BME280Sensor.cpp => BME280.cpp} (90%)
rename src/{BME280Sensor.h => BME280.h} (100%)
create mode 100644 src/BMP180.cpp
create mode 100644 src/BMP180.h
create mode 100644 src/BMP280.cpp
create mode 100644 src/BMP280.h
rename src/{TSL2561Sensor.cpp => TSL2561.cpp} (91%)
rename src/{TSL2561Sensor.h => TSL2561.h} (100%)
diff --git a/platformio.ini b/platformio.ini
index edb2dc8..df0f581 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -74,6 +74,8 @@ lib_deps =
beegee-tokyo/DHT sensor library for ESPx @ ^1.18
starmbi/hp_BH1750 @ ^1.0.0
adafruit/Adafruit BME280 Library@^2.2.2
+ adafruit/Adafruit BMP085 Library@^1.2.1
+ adafruit/Adafruit BMP280 Library@^2.6.3
adafruit/Adafruit TSL2561@^1.1.0
[env:esp32]
diff --git a/src/BH1750.cpp b/src/BH1750.cpp
index ad33d21..4b4aaa9 100644
--- a/src/BH1750.cpp
+++ b/src/BH1750.cpp
@@ -22,7 +22,7 @@ namespace BH1750
void Setup()
{
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
if (BH1750_I2c != "0x23" && BH1750_I2c != "0x5C") return;
int rc;
@@ -83,13 +83,15 @@ namespace BH1750
void SerialReport()
{
- Serial.print("BH1750_I2c Sensor: ");
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (BH1750_I2c.isEmpty()) return;
+ Serial.print("BH1750: ");
Serial.println(BH1750_I2c + " on bus " + BH1750_I2c_Bus);
}
void Loop()
{
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
if (!initialized) return;
if (BH1750_I2c == "0x23" || BH1750_I2c == "0x5C")
diff --git a/src/BME280Sensor.cpp b/src/BME280.cpp
similarity index 90%
rename from src/BME280Sensor.cpp
rename to src/BME280.cpp
index 7f4e434..2c32e95 100644
--- a/src/BME280Sensor.cpp
+++ b/src/BME280.cpp
@@ -1,5 +1,5 @@
#ifdef SENSORS
-#include "BME280Sensor.h"
+#include "BME280.h"
#include "globals.h"
#include "mqtt.h"
@@ -21,7 +21,7 @@ namespace BME280
void Setup()
{
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
if (BME280_I2c == "0x76" && BME280_I2c_Bus == 1) {
BME280_status = BME280.begin(0x76, &Wire);
@@ -59,13 +59,15 @@ namespace BME280
void SerialReport()
{
- Serial.print("BME280_I2c Sensor: ");
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (BME280_I2c.isEmpty()) return;
+ Serial.print("BME280: ");
Serial.println(BME280_I2c + " on bus " + BME280_I2c_Bus);
}
void Loop()
{
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
if (!initialized) return;
if (millis() - bme280PreviousMillis >= sensorInterval) {
diff --git a/src/BME280Sensor.h b/src/BME280.h
similarity index 100%
rename from src/BME280Sensor.h
rename to src/BME280.h
diff --git a/src/BMP180.cpp b/src/BMP180.cpp
new file mode 100644
index 0000000..60ca9d6
--- /dev/null
+++ b/src/BMP180.cpp
@@ -0,0 +1,81 @@
+#ifdef SENSORS
+#include "BMP180.h"
+
+#include "globals.h"
+#include "mqtt.h"
+#include "defaults.h"
+#include
+#include "string_utils.h"
+
+#include
+
+namespace BMP180
+{
+ Adafruit_BMP085* bmp;
+ long BMP180_status;
+ String BMP180_I2c;
+ int BMP180_I2c_Bus;
+ unsigned long BMP180PreviousMillis = 0;
+ int sensorInterval = 60000;
+ bool initialized = false;
+
+ void Setup()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+
+ bmp = new Adafruit_BMP085();
+ if (BMP180_I2c == "0x77") {
+ BMP180_status = bmp->begin(BMP085_STANDARD, BMP180_I2c_Bus == 1 ? &Wire : &Wire1);
+ } else {
+ return;
+ }
+
+ if (!BMP180_status) {
+ Serial.println("[BMP180] Couldn't find a sensor, check your wiring and I2C address!");
+ } else {
+ initialized = true;
+ }
+ }
+
+ void ConnectToWifi()
+ {
+ AsyncWiFiSettings.html("h4", "BMP085/BMP180 Barometric Pressure + Temp sensor");
+ BMP180_I2c_Bus = AsyncWiFiSettings.integer("BMP180_I2c_Bus", 1, 2, DEFAULT_I2C_BUS, "I2C Bus");
+ BMP180_I2c = AsyncWiFiSettings.string("BMP180_I2c", "", "I2C address (0x77)");
+ }
+
+ void SerialReport()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (BMP180_I2c.isEmpty()) return;
+ Serial.print("BMP180_I2c Sensor: ");
+ Serial.println(BMP180_I2c + " on bus " + BMP180_I2c_Bus);
+ }
+
+ void Loop()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (!initialized) return;
+
+ if (BMP180PreviousMillis == 0 || millis() - BMP180PreviousMillis >= sensorInterval) {
+
+ float temperature = bmp->readTemperature();
+ float pressure = bmp->readPressure() / 100.0F;
+
+ mqttClient.publish((roomsTopic + "/bmp180_temperature").c_str(), 0, 1, String(temperature).c_str());
+ mqttClient.publish((roomsTopic + "/bmp180_pressure").c_str(), 0, 1, String(pressure).c_str());
+
+ BMP180PreviousMillis = millis();
+ }
+ }
+
+ bool SendDiscovery()
+ {
+ if (BMP180_I2c.isEmpty()) return true;
+
+ return sendSensorDiscovery("BMP180 Temperature", EC_NONE, "temperature", "°C")
+ && sendSensorDiscovery("BMP180 Pressure", EC_NONE, "pressure", "hPa");
+ }
+}
+
+#endif
diff --git a/src/BMP180.h b/src/BMP180.h
new file mode 100644
index 0000000..f470cb5
--- /dev/null
+++ b/src/BMP180.h
@@ -0,0 +1,14 @@
+#pragma once
+#ifdef SENSORS
+#include
+
+namespace BMP180
+{
+ void ConnectToWifi();
+ void SerialReport();
+ bool SendDiscovery();
+ void Setup();
+ void Loop();
+}
+
+#endif
diff --git a/src/BMP280.cpp b/src/BMP280.cpp
new file mode 100644
index 0000000..e23d2fc
--- /dev/null
+++ b/src/BMP280.cpp
@@ -0,0 +1,91 @@
+#ifdef SENSORS
+#include "BMP280.h"
+
+#include "globals.h"
+#include "mqtt.h"
+#include "defaults.h"
+#include
+#include "string_utils.h"
+
+#include
+
+namespace BMP280
+{
+ Adafruit_BMP280* bmp;
+ long BMP280_status;
+ String BMP280_I2c;
+ int BMP280_I2c_Bus;
+ unsigned long BMP280PreviousMillis = 0;
+ int sensorInterval = 60000;
+ bool initialized = false;
+
+ void Setup()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+
+ bmp = new Adafruit_BMP280(BMP280_I2c_Bus == 1 ? &Wire : &Wire1);
+ if (BMP280_I2c == "0x76") {
+ BMP280_status = bmp->begin(0x76);
+ } else if (BMP280_I2c == "0x77") {
+ BMP280_status = bmp->begin(0x77);
+ } else {
+ return;
+ }
+
+ if (!BMP280_status) {
+ Serial.println("[BMP280] Couldn't find a sensor, check your wiring and I2C address!");
+ } else {
+ initialized = true;
+ }
+
+ bmp->setSampling(
+ Adafruit_BMP280::MODE_FORCED,
+ Adafruit_BMP280::SAMPLING_X1, // Temperature
+ Adafruit_BMP280::SAMPLING_X1, // Pressure
+ Adafruit_BMP280::FILTER_OFF
+ );
+ }
+
+ void ConnectToWifi()
+ {
+ AsyncWiFiSettings.html("h4", "BMP280 - Weather Sensor:");
+ BMP280_I2c_Bus = AsyncWiFiSettings.integer("BMP280_I2c_Bus", 1, 2, DEFAULT_I2C_BUS, "I2C Bus");
+ BMP280_I2c = AsyncWiFiSettings.string("BMP280_I2c", "", "I2C address (0x76 or 0x77)");
+ }
+
+ void SerialReport()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (BMP280_I2c.isEmpty()) return;
+ Serial.print("BMP280_I2c Sensor: ");
+ Serial.println(BMP280_I2c + " on bus " + BMP280_I2c_Bus);
+ }
+
+ void Loop()
+ {
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (!initialized) return;
+
+ if (BMP280PreviousMillis == 0 || millis() - BMP280PreviousMillis >= sensorInterval) {
+
+ bmp->takeForcedMeasurement();
+ float temperature = bmp->readTemperature();
+ float pressure = bmp->readPressure() / 100.0F;
+
+ mqttClient.publish((roomsTopic + "/bmp280_temperature").c_str(), 0, 1, String(temperature).c_str());
+ mqttClient.publish((roomsTopic + "/bmp280_pressure").c_str(), 0, 1, String(pressure).c_str());
+
+ BMP280PreviousMillis = millis();
+ }
+ }
+
+ bool SendDiscovery()
+ {
+ if (BMP280_I2c.isEmpty()) return true;
+
+ return sendSensorDiscovery("BMP280 Temperature", EC_NONE, "temperature", "°C")
+ && sendSensorDiscovery("BMP280 Pressure", EC_NONE, "pressure", "hPa");
+ }
+}
+
+#endif
diff --git a/src/BMP280.h b/src/BMP280.h
new file mode 100644
index 0000000..962a6f9
--- /dev/null
+++ b/src/BMP280.h
@@ -0,0 +1,14 @@
+#pragma once
+#ifdef SENSORS
+#include
+
+namespace BMP280
+{
+ void ConnectToWifi();
+ void SerialReport();
+ bool SendDiscovery();
+ void Setup();
+ void Loop();
+}
+
+#endif
diff --git a/src/DHT.cpp b/src/DHT.cpp
index 17689b1..20eeed2 100644
--- a/src/DHT.cpp
+++ b/src/DHT.cpp
@@ -114,11 +114,12 @@ namespace DHT
void SerialReport()
{
+ if (!dht11Pin && !dht22Pin) return;
Serial.print("DHT11 Sensor: ");
Serial.println(dht11Pin ? "enabled" : "disabled");
Serial.print("DHT22 Sensor: ");
Serial.println(dht22Pin ? "enabled" : "disabled");
- Serial.print("DHT Temp Offset: ");
+ Serial.print("DHT Offset: ");
Serial.println(dhtTempOffset ? "enabled" : "disabled");
}
diff --git a/src/I2C.cpp b/src/I2C.cpp
index 0812ca1..2f95763 100644
--- a/src/I2C.cpp
+++ b/src/I2C.cpp
@@ -2,137 +2,120 @@
#include "I2C.h"
+#include
+#include
+
+#include "defaults.h"
#include "globals.h"
#include "mqtt.h"
-#include "defaults.h"
-#include
#include "string_utils.h"
-#include
+namespace I2C {
+bool I2CDebug = false;
+int I2C_Bus_1_SDA;
+int I2C_Bus_1_SCL;
+int I2C_Bus_2_SDA;
+int I2C_Bus_2_SCL;
-namespace I2C
-{
- bool I2CDebug = false;
+void ConnectToWifi() {
+ AsyncWiFiSettings.heading("I2C Settings ℹ️", false);
- void ConnectToWifi()
- {
- AsyncWiFiSettings.heading("I2C Settings ℹ️", false);
+ AsyncWiFiSettings.html("h4", "Bus 1:");
- AsyncWiFiSettings.html("h4", "Bus 1:");
+ I2C_Bus_1_SDA = AsyncWiFiSettings.integer("I2C_Bus_1_SDA", -1, 39, DEFAULT_I2C_BUS_1_SDA, "SDA pin (-1 to disable)");
+ I2C_Bus_1_SCL = AsyncWiFiSettings.integer("I2C_Bus_1_SCL", -1, 39, DEFAULT_I2C_BUS_1_SCL, "SCL pin (-1 to disable)");
- I2C_Bus_1_SDA = AsyncWiFiSettings.integer("I2C_Bus_1_SDA", 0, 39, DEFAULT_I2C_BUS_1_SDA, "SDA pin (-1 to disable)");
- I2C_Bus_1_SCL = AsyncWiFiSettings.integer("I2C_Bus_1_SCL", 0, 39, DEFAULT_I2C_BUS_1_SCL, "SCL pin (-1 to disable)");
+ AsyncWiFiSettings.html("h4", "Bus 2:");
- AsyncWiFiSettings.html("h4", "Bus 2:");
+ I2C_Bus_2_SDA = AsyncWiFiSettings.integer("I2C_Bus_2_SDA", -1, 39, DEFAULT_I2C_BUS_2_SDA, "SDA pin (-1 to disable)");
+ I2C_Bus_2_SCL = AsyncWiFiSettings.integer("I2C_Bus_2_SCL", -1, 39, DEFAULT_I2C_BUS_2_SCL, "SCL pin (-1 to disable)");
- I2C_Bus_2_SDA = AsyncWiFiSettings.integer("I2C_Bus_2_SDA", -1, "SDA pin (-1 to disable)");
- I2C_Bus_2_SCL = AsyncWiFiSettings.integer("I2C_Bus_2_SCL", -1, "SCL pin (-1 to disable)");
+ I2CDebug = AsyncWiFiSettings.checkbox("I2CDebug", false, "Debug I2C addreses. Look at the serial log to get the correct address");
- I2CDebug = AsyncWiFiSettings.checkbox("I2CDebug", false, "Debug I2C addreses. Look at the serial log to get the correct address");
+ if (I2C_Bus_1_SDA != -1 && I2C_Bus_1_SDA != -1) {
+ I2C_Bus_1_Started = Wire.begin(I2C_Bus_1_SDA, I2C_Bus_1_SCL);
}
- void SerialReport()
- {
- }
-
- void Setup()
- {
- if (I2C_Bus_1_SDA != -1 && I2C_Bus_1_SDA != -1) {
- Wire.begin(I2C_Bus_1_SDA, I2C_Bus_1_SCL);
- I2C_Bus_1_Enabled = true;
- Serial.println("Initialized I2C Bus 1 (SDA: " + String(I2C_Bus_1_SDA) + ", SCL: " + String(I2C_Bus_1_SCL) + ")");
- }
-
- if (I2C_Bus_2_SDA != -1 && I2C_Bus_2_SDA != -1) {
- Wire1.begin(I2C_Bus_2_SDA, I2C_Bus_2_SCL);
- I2C_Bus_2_Enabled = true;
- Serial.println("Initialized I2C Bus 2 (SDA: " + String(I2C_Bus_2_SDA) + ", SCL: " + String(I2C_Bus_2_SCL) + ")");
- }
- }
-
- void Loop()
- {
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
- if (!I2CDebug) return;
- I2CDebug = false;
-
- byte error, address;
- int nDevices;
- nDevices = 0;
-
- if (I2C_Bus_1_Enabled)
- {
- Serial.println("Scanning I2C for devices on Bus 1...");
- for (address = 1; address < 127; address++)
- {
- Wire.beginTransmission(address);
- error = Wire.endTransmission();
- if (error == 0)
- {
- Serial.print("I2C device found on bus 1 at address 0x");
-
- if (address < 16)
- {
- Serial.print("0");
- }
-
- Serial.println(address, HEX);
- nDevices++;
- }
- else if (error == 4)
- {
- Serial.print("Unknown error on bus 1 at address 0x");
- if (address < 16)
- {
- Serial.print("0");
- }
- Serial.println(address, HEX);
- }
- }
- }
-
- if (I2C_Bus_2_Enabled)
- {
- Serial.println("Scanning I2C for devices on Bus 2...");
-
- for (address = 1; address < 127; address++)
- {
- Wire1.beginTransmission(address);
- error = Wire1.endTransmission();
- if (error == 0)
- {
- Serial.print("I2C device found on bus 2 at address 0x");
-
- if (address < 16)
- {
- Serial.print("0");
- }
-
- Serial.println(address, HEX);
- nDevices++;
- }
- else if (error == 4)
- {
- Serial.print("Unknown error on bus 2 at address 0x");
- if (address < 16)
- {
- Serial.print("0");
- }
- Serial.println(address, HEX);
- }
- }
- }
-
- if (nDevices == 0)
- {
- Serial.println("No I2C devices found\n");
- }
- }
-
- bool SendDiscovery()
- {
- return true;
+ if (I2C_Bus_2_SDA != -1 && I2C_Bus_2_SDA != -1) {
+ I2C_Bus_2_Started = Wire1.begin(I2C_Bus_2_SDA, I2C_Bus_2_SCL);
}
}
+void Loop() {
+}
+
+void Setup() {
+}
+
+void SerialReport() {
+ if (I2C_Bus_1_Started)
+ Serial.println(String("I2C Bus 1: sda=") + I2C_Bus_1_SDA + " scl=" + I2C_Bus_1_SCL);
+ if (I2C_Bus_2_Started)
+ Serial.println(String("I2C Bus 2: sda=") + I2C_Bus_2_SDA + " scl=" + I2C_Bus_2_SCL);
+
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (!I2CDebug) return;
+ byte error, address;
+ int nDevices;
+ nDevices = 0;
+
+ if (I2C_Bus_1_Started) {
+ Serial.println("Scanning I2C for devices on Bus 1...");
+ for (address = 1; address < 127; address++) {
+ Wire.beginTransmission(address);
+ error = Wire.endTransmission();
+ if (error == 0) {
+ Serial.print("I2C device found on bus 1 at address 0x");
+
+ if (address < 16) {
+ Serial.print("0");
+ }
+
+ Serial.println(address, HEX);
+ nDevices++;
+ } else if (error == 4) {
+ Serial.print("Unknown error on bus 1 at address 0x");
+ if (address < 16) {
+ Serial.print("0");
+ }
+ Serial.println(address, HEX);
+ }
+ }
+ }
+
+ if (I2C_Bus_2_Started) {
+ Serial.println("Scanning I2C for devices on Bus 2...");
+
+ for (address = 1; address < 127; address++) {
+ Wire1.beginTransmission(address);
+ error = Wire1.endTransmission();
+ if (error == 0) {
+ Serial.print("I2C device found on bus 2 at address 0x");
+
+ if (address < 16) {
+ Serial.print("0");
+ }
+
+ Serial.println(address, HEX);
+ nDevices++;
+ } else if (error == 4) {
+ Serial.print("Unknown error on bus 2 at address 0x");
+ if (address < 16) {
+ Serial.print("0");
+ }
+ Serial.println(address, HEX);
+ }
+ }
+ }
+
+ if (nDevices == 0) {
+ Serial.println("No I2C devices found\n");
+ }
+}
+
+bool SendDiscovery() {
+ return true;
+}
+} // namespace I2C
+
#endif
diff --git a/src/TSL2561Sensor.cpp b/src/TSL2561.cpp
similarity index 91%
rename from src/TSL2561Sensor.cpp
rename to src/TSL2561.cpp
index abbd12a..27cacf0 100644
--- a/src/TSL2561Sensor.cpp
+++ b/src/TSL2561.cpp
@@ -3,7 +3,7 @@
#include "globals.h"
#include "defaults.h"
#include "mqtt.h"
-#include "TSL2561Sensor.h"
+#include "TSL2561.h"
#include
#include
#include
@@ -31,15 +31,16 @@ namespace TSL2561
void SerialReport()
{
- Serial.print("TSL2561_I2c Sensor: ");
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
+ if (TSL2561_I2c.isEmpty()) return;
+ Serial.print("TSL2561: ");
Serial.println(TSL2561_I2c + " on bus " + TSL2561_I2c_Bus);
}
void Loop()
{
- if (!I2C_Bus_1_Enabled && !I2C_Bus_2_Enabled) return;
+ if (!I2C_Bus_1_Started && !I2C_Bus_2_Started) return;
- // TODO: This should move to setup
int tsl2561_address;
if (TSL2561_I2c == "0x39") {
diff --git a/src/TSL2561Sensor.h b/src/TSL2561.h
similarity index 100%
rename from src/TSL2561Sensor.h
rename to src/TSL2561.h
diff --git a/src/defaults.h b/src/defaults.h
index 9e99593..9216753 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -49,9 +49,27 @@
#endif
// I2C Defaults
+#ifdef M5STICK
+#define DEFAULT_I2C_BUS_1_SDA 32
+#define DEFAULT_I2C_BUS_1_SCL 33
+#define DEFAULT_I2C_BUS_2_SDA 21
+#define DEFAULT_I2C_BUS_2_SCL 22
+#define DEFAULT_I2C_BUS 1
+#else
+#ifdef M5ATOM
+#define DEFAULT_I2C_BUS_1_SDA 26
+#define DEFAULT_I2C_BUS_1_SCL 32
+#define DEFAULT_I2C_BUS_2_SDA 25
+#define DEFAULT_I2C_BUS_2_SCL 21
+#define DEFAULT_I2C_BUS 1
+#else
#define DEFAULT_I2C_BUS_1_SDA 21
#define DEFAULT_I2C_BUS_1_SCL 22
+#define DEFAULT_I2C_BUS_2_SDA -1
+#define DEFAULT_I2C_BUS_2_SCL -1
#define DEFAULT_I2C_BUS 1
+#endif
+#endif
// TSL2561 Defaults
#define DEFAULT_TSL2561_I2C_GAIN "auto"
diff --git a/src/globals.h b/src/globals.h
index c8d1ad8..08afaf2 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -38,9 +38,5 @@ _DECL bool enrolling;
_DECL unsigned long enrollingEndMillis;
// I2C
-_DECL int I2C_Bus_1_SDA;
-_DECL int I2C_Bus_1_SCL;
-_DECL int I2C_Bus_2_SDA;
-_DECL int I2C_Bus_2_SCL;
-_DECL bool I2C_Bus_1_Enabled;
-_DECL bool I2C_Bus_2_Enabled;
+_DECL bool I2C_Bus_1_Started;
+_DECL bool I2C_Bus_2_Started;
diff --git a/src/main.cpp b/src/main.cpp
index 7ba9644..5b10936 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -54,6 +54,8 @@ bool sendTelemetry(int totalSeen, int totalFpSeen, int totalFpQueried, int total
&& DHT::SendDiscovery()
&& BH1750::SendDiscovery()
&& BME280::SendDiscovery()
+ && BMP180::SendDiscovery()
+ && BMP280::SendDiscovery()
&& TSL2561::SendDiscovery()
&& HX711::SendDiscovery()
#endif
@@ -223,6 +225,8 @@ void setupNetwork()
BH1750::ConnectToWifi();
BME280::ConnectToWifi();
+ BMP180::ConnectToWifi();
+ BMP280::ConnectToWifi();
TSL2561::ConnectToWifi();
HX711::ConnectToWifi();
#endif
@@ -259,6 +263,8 @@ void setupNetwork()
DHT::SerialReport();
BH1750::SerialReport();
BME280::SerialReport();
+ BMP180::SerialReport();
+ BMP280::SerialReport();
TSL2561::SerialReport();
HX711::SerialReport();
#endif
@@ -576,6 +582,8 @@ void setup()
I2C::Setup();
BH1750::Setup();
BME280::Setup();
+ BMP180::Setup();
+ BMP280::Setup();
TSL2561::Setup();
HX711::Setup();
#endif
@@ -597,6 +605,8 @@ void loop()
DHT::Loop();
BH1750::Loop();
BME280::Loop();
+ BMP180::Loop();
+ BMP280::Loop();
TSL2561::Loop();
HX711::Loop();
I2C::Loop();
diff --git a/src/main.h b/src/main.h
index 9bfecd8..5831e0f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -31,8 +31,10 @@
#ifdef SENSORS
#include
-#include "BME280Sensor.h"
-#include "TSL2561Sensor.h"
+#include "BME280.h"
+#include "BMP180.h"
+#include "BMP280.h"
+#include "TSL2561.h"
#include "HX711.h"
#include "DHT.h"
#include "BH1750.h"