Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
*.bak
html/*

# WS reference submodules
repos/

# VSCode artifacts
.vscode/*
Expand All @@ -43,6 +45,7 @@ src/.vscode/settings.json
examples/Wippersnapper_demo/build/
src/Wippersnapper_demo.ino.cpp
build_output_*.txt
COM*.txt

# Virtual environment directories
.venv/
Expand Down
24 changes: 12 additions & 12 deletions src/components/i2c/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ using FnCreateI2CSensorDriver =
// Factory for creating a new I2C SENSOR drivers
// NOTE: When you add a new SENSOR driver, make sure to add it to the factory!
static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
{"bme280",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvBme280(i2c, addr, mux_channel, driver_name);
}},
{"adt7410",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -73,20 +68,20 @@ static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
const char *driver_name) -> drvBase * {
return new drvBh1750(i2c, addr, mux_channel, driver_name);
}},
{"bme680",
{"bme280",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvBme680(i2c, addr, mux_channel, driver_name);
return new drvBme280(i2c, addr, mux_channel, driver_name);
}},
{"bme688",
{"bme680",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvBme680(i2c, addr, mux_channel, driver_name);
}},
{"BMP280",
{"bme688",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvBmp3xx(i2c, addr, mux_channel, driver_name);
return new drvBme680(i2c, addr, mux_channel, driver_name);
}},
{"bmp388",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
Expand Down Expand Up @@ -123,6 +118,11 @@ static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
const char *driver_name) -> drvBase * {
return new drvEns160(i2c, addr, mux_channel, driver_name);
}},
{"ens161",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvEns160(i2c, addr, mux_channel, driver_name);
}},
{"hdc302x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -445,8 +445,8 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x4E, {"pct2075"}},
{0x4F, {"pct2075"}},
{0x51, {"vcnl4200"}},
{0x52, {"ens160"}},
{0x53, {"ens160", "ltr390"}},
{0x52, {"ens161", "ens160"}},
{0x53, {"ens161", "ens160", "ltr390"}},
{0x58, {"sgp30"}},
{0x59, {"sgp40"}},
{0x5C,
Expand Down
7 changes: 4 additions & 3 deletions src/components/i2c/drivers/drvEns160.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ class drvEns160 : public drvBase {
bool begin() override {
_ens160 = new ScioSense_ENS160((TwoWire *)_i2c, (uint8_t)_address);

// attempt to initialize ENS160
// attempt to initialize ENS160/161
if (!_ens160->begin())
return false;

// Set the mode to standard
// Set the mode to standard - In future 161 has ULP mode
if (!_ens160->setMode(ENS160_OPMODE_STD))
return false;
return true;
Expand Down Expand Up @@ -118,9 +118,10 @@ class drvEns160 : public drvBase {
}

void ConfigureDefaultSensorTypes() override {
_default_sensor_types_count = 2;
_default_sensor_types_count = 3;
_default_sensor_types[0] = wippersnapper_sensor_SensorType_SENSOR_TYPE_RAW;
_default_sensor_types[1] = wippersnapper_sensor_SensorType_SENSOR_TYPE_TVOC;
_default_sensor_types[2] = wippersnapper_sensor_SensorType_SENSOR_TYPE_ECO2;
}

protected:
Expand Down
Loading