Skip to content
Closed
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
2 changes: 2 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define QMC5883L_ADDR 0x0D
#define HMC5883L_ADDR 0x1E
#define SHTC3_ADDR 0x70
#define QMP6988_ADDR 0x70
#define QMP6988_ADDR_ALT 0x56
#define LPS22HB_ADDR 0x5C
#define LPS22HB_ADDR_ALT 0x5D
#define SFA30_ADDR 0x5D
Expand Down
1 change: 1 addition & 0 deletions src/detect/ScanI2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ScanI2C
CW2015,
SCD30,
ADS1115,
QMP6988
} DeviceType;

// typedef uint8_t DeviceAddress;
Expand Down
33 changes: 31 additions & 2 deletions src/detect/ScanI2CTwoWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ String readSEN5xProductName(TwoWire *i2cBus, uint8_t address)
#endif

#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
constexpr uint8_t QMP6988_DETECT_CHIP_ID = 0x5C;
constexpr uint8_t QMP6988_DETECT_CHIP_ID_REG = 0xD1;

bool detectSHT21SerialNumber(TwoWire *i2cBus, uint8_t address)
{

Expand Down Expand Up @@ -215,6 +218,19 @@ bool detectSHT21SerialNumber(TwoWire *i2cBus, uint8_t address)
// Assume we detect the SHT21 if something came back from the request
return true;
}

bool detectQMP6988ChipId(TwoWire *i2cBus, uint8_t address)
{
i2cBus->beginTransmission(address);
i2cBus->write(QMP6988_DETECT_CHIP_ID_REG);
if (i2cBus->endTransmission() != 0)
return false;

if (i2cBus->requestFrom((int)address, 1) != 1)
return false;

return i2cBus->available() && i2cBus->read() == QMP6988_DETECT_CHIP_ID;
}
#endif

#define SCAN_SIMPLE_CASE(ADDR, T, ...) \
Expand Down Expand Up @@ -506,8 +522,21 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
}

break;

SCAN_SIMPLE_CASE(SHTC3_ADDR, SHTXX, "SHTXX", (uint8_t)addr.address)
case QMP6988_ADDR_ALT:
if (detectQMP6988ChipId(i2cBus, (uint8_t)addr.address)) {
type = QMP6988;
logFoundDevice("QMP6988", (uint8_t)addr.address);
}
break;
case SHTC3_ADDR:
if (detectQMP6988ChipId(i2cBus, (uint8_t)addr.address)) {
type = QMP6988;
logFoundDevice("QMP6988", (uint8_t)addr.address);
} else {
type = SHTXX;
logFoundDevice("SHTXX", (uint8_t)addr.address);
}
break;
case RCWL9620_ADDR:
// get MAX30102 PARTID
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 1);
Expand Down
8 changes: 5 additions & 3 deletions src/mesh/generated/meshtastic/telemetry.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ typedef enum _meshtastic_TelemetrySensorType {
/* SHT family of sensors for temperature and humidity */
meshtastic_TelemetrySensorType_SHTXX = 50,
/* DS248X Bridge for one-wire temperature sensors */
meshtastic_TelemetrySensorType_DS248X = 51
meshtastic_TelemetrySensorType_DS248X = 51,
/* QST QMP6988 temperature and pressure sensor */
meshtastic_TelemetrySensorType_QMP6988 = 52
} meshtastic_TelemetrySensorType;

/* Struct definitions */
Expand Down Expand Up @@ -496,8 +498,8 @@ extern "C" {

/* Helper constants for enums */
#define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET
#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_DS248X
#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_DS248X+1))
#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_QMP6988
#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_QMP6988+1))



Expand Down
3 changes: 3 additions & 0 deletions src/modules/Telemetry/EnvironmentTelemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ extern void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const c
#include "Sensor/DPS310Sensor.h"
#endif

#include "Sensor/QMP6988Sensor.h"

#if __has_include(<Adafruit_MCP9808.h>)
#include "Sensor/MCP9808Sensor.h"
#endif
Expand Down Expand Up @@ -200,6 +202,7 @@ void EnvironmentTelemetryModule::i2cScanFinished(ScanI2C *i2cScanner)
#if __has_include(<Adafruit_DPS310.h>)
addSensor<DPS310Sensor>(i2cScanner, ScanI2C::DeviceType::DPS310);
#endif
addSensor<QMP6988Sensor>(i2cScanner, ScanI2C::DeviceType::QMP6988);
#if __has_include(<Adafruit_MCP9808.h>)
addSensor<MCP9808Sensor>(i2cScanner, ScanI2C::DeviceType::MCP9808);
#endif
Expand Down
Loading
Loading