mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 09:43:03 +00:00
added AHTx0 sensor (#3977)
* added AHTx0 sensor * AHT10 definition in protobuf * AHT10 definition in protobuf * protobufs * Management of AHT20+BMP280 module * missing newline in log * missing newline in log * reverted * reverted .gitignore --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
// Sensors
|
||||
#include "Sensor/AHT10.h"
|
||||
#include "Sensor/BME280Sensor.h"
|
||||
#include "Sensor/BME680Sensor.h"
|
||||
#include "Sensor/BMP085Sensor.h"
|
||||
@@ -41,6 +42,7 @@ SHT31Sensor sht31Sensor;
|
||||
VEML7700Sensor veml7700Sensor;
|
||||
SHT4XSensor sht4xSensor;
|
||||
RCWL9620Sensor rcwl9620Sensor;
|
||||
AHT10Sensor aht10Sensor;
|
||||
|
||||
#define FAILED_STATE_SENSOR_READ_MULTIPLIER 10
|
||||
#define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true
|
||||
@@ -105,6 +107,8 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
||||
result = veml7700Sensor.runOnce();
|
||||
if (rcwl9620Sensor.hasSensor())
|
||||
result = rcwl9620Sensor.runOnce();
|
||||
if (aht10Sensor.hasSensor())
|
||||
result = aht10Sensor.runOnce();
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
@@ -291,6 +295,19 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
valid = valid && rcwl9620Sensor.getMetrics(&m);
|
||||
hasSensor = true;
|
||||
}
|
||||
if (aht10Sensor.hasSensor()) {
|
||||
if (!bmp280Sensor.hasSensor()) {
|
||||
valid = valid && aht10Sensor.getMetrics(&m);
|
||||
hasSensor = true;
|
||||
} else {
|
||||
// prefer bmp280 temp if both sensors are present, fetch only humidity
|
||||
meshtastic_Telemetry m_ahtx;
|
||||
LOG_INFO("AHTX0+BMP280 module detected: using temp from BMP280 and humy from AHTX0\n");
|
||||
aht10Sensor.getMetrics(&m_ahtx);
|
||||
m.variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity;
|
||||
}
|
||||
}
|
||||
|
||||
valid = valid && hasSensor;
|
||||
|
||||
if (valid) {
|
||||
|
||||
Reference in New Issue
Block a user