diff --git a/.vscode/settings.json b/.vscode/settings.json
index c2bc7b28..21bf462e 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -51,7 +51,8 @@
"iterator": "cpp",
"shared_mutex": "cpp",
"iostream": "cpp",
- "esp_nimble_hci.h": "c"
+ "esp_nimble_hci.h": "c",
+ "map": "cpp"
},
"cSpell.words": [
"Blox",
diff --git a/src/configuration.h b/src/configuration.h
index aae49d98..35d226e2 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -25,6 +25,7 @@ along with this program. If not, see .
#pragma once
#include
+
#ifdef RV3028_RTC
#include "Melopero_RV3028.h"
#endif
@@ -170,6 +171,13 @@ along with this program. If not, see .
// The older M5 Faces I2C Keyboard
#define FACESKB_ADDR 0x88
+// -----------------------------------------------------------------------------
+// SENSOR
+// -----------------------------------------------------------------------------
+#define BME_ADDR 0x76
+#define BME_ADDR_ALTERNATE 0x77
+#define MCP9808_ADDR 0x18
+
// -----------------------------------------------------------------------------
// GPS
// -----------------------------------------------------------------------------
diff --git a/src/debug/i2cScan.h b/src/debug/i2cScan.h
index ba5636ea..206cdbfe 100644
--- a/src/debug/i2cScan.h
+++ b/src/debug/i2cScan.h
@@ -1,6 +1,7 @@
#include "../configuration.h"
#include "../main.h"
#include
+#include "mesh/generated/telemetry.pb.h"
#ifndef NO_WIRE
uint8_t oled_probe(byte addr)
@@ -104,6 +105,27 @@ void scanI2Cdevice(void)
DEBUG_MSG("axp192 PMU found\n");
}
#endif
+ if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) {
+ Wire.beginTransmission(addr);
+ Wire.write(0xD0); // GET_ID
+ Wire.endTransmission();
+ delay(20);
+ Wire.requestFrom((int)addr, 1);
+ if (Wire.available()) {
+ r = Wire.read();
+ }
+ if (r == 0x61) {
+ DEBUG_MSG("BME-680 sensor found at address 0x%x\n", (uint8_t)addr);
+ nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr;
+ } else if (r == 0x60) {
+ DEBUG_MSG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
+ nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
+ }
+ }
+ if (addr == MCP9808_ADDR) {
+ nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
+ DEBUG_MSG("MCP9808 sensor found at address 0x%x\n", (uint8_t)addr);
+ }
} else if (err == 4) {
DEBUG_MSG("Unknow error at address 0x%x\n", addr);
}
diff --git a/src/main.cpp b/src/main.cpp
index 8068a9fc..4dd16c89 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -89,6 +89,8 @@ bool eink_found = true;
uint32_t serialSinceMsec;
bool axp192_found;
+// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
+uint8_t nodeTelemetrySensorsMap[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
diff --git a/src/main.h b/src/main.h
index bb262a58..0f7a7779 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,9 +1,11 @@
#pragma once
+#include