kopia lustrzana https://github.com/meshtastic/firmware
exclude sensors when MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR set
rodzic
09080d76ad
commit
be0e882be1
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "PowerFSM.h"
|
||||
#include "concurrency/OSThread.h"
|
||||
#include "configuration.h"
|
||||
|
@ -172,4 +174,6 @@ class AccelerometerThread : public concurrency::OSThread
|
|||
Adafruit_LSM6DS3TRC lsm;
|
||||
};
|
||||
|
||||
} // namespace concurrency
|
||||
} // namespace concurrency
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "AirQualityTelemetry.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "Default.h"
|
||||
|
@ -130,3 +132,5 @@ bool AirQualityTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#pragma once
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "Adafruit_PM25AQI.h"
|
||||
|
@ -35,3 +37,5 @@ class AirQualityTelemetryModule : private concurrency::OSThread, public Protobuf
|
|||
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
||||
uint32_t lastSentToMesh = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "EnvironmentTelemetry.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "Default.h"
|
||||
|
@ -278,4 +280,6 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#pragma once
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "NodeDB.h"
|
||||
|
@ -42,3 +44,5 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu
|
|||
uint32_t lastSentToPhone = 0;
|
||||
uint32_t sensor_read_error_count = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "BME280Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -35,4 +37,5 @@ bool BME280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.barometric_pressure = bme280.readPressure() / 100.0F;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_BME280.h>
|
||||
|
@ -14,4 +16,6 @@ class BME280Sensor : public TelemetrySensor
|
|||
BME280Sensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "BME680Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "FSCommon.h"
|
||||
|
@ -134,3 +136,5 @@ void BME680Sensor::checkStatus(String functionName)
|
|||
else if (bme680.sensor.status > BME68X_OK)
|
||||
LOG_WARN("%s BME68X code: %s\n", functionName.c_str(), String(bme680.sensor.status).c_str());
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <bsec2.h>
|
||||
|
@ -35,4 +37,6 @@ class BME680Sensor : public TelemetrySensor
|
|||
int32_t runTrigger();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "BMP085Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -29,3 +31,5 @@ bool BMP085Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_BMP085.h>
|
||||
|
@ -14,4 +16,6 @@ class BMP085Sensor : public TelemetrySensor
|
|||
BMP085Sensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "BMP280Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -35,3 +37,5 @@ bool BMP280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_BMP280.h>
|
||||
|
@ -14,4 +16,6 @@ class BMP280Sensor : public TelemetrySensor
|
|||
BMP280Sensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "INA219Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -37,4 +39,6 @@ bool INA219Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
uint16_t INA219Sensor::getBusVoltageMv()
|
||||
{
|
||||
return lround(ina219.getBusVoltage_V() * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include "VoltageSensor.h"
|
||||
|
@ -16,4 +18,6 @@ class INA219Sensor : public TelemetrySensor, VoltageSensor
|
|||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
virtual uint16_t getBusVoltageMv() override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "INA260Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -32,4 +34,6 @@ bool INA260Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
uint16_t INA260Sensor::getBusVoltageMv()
|
||||
{
|
||||
return lround(ina260.readBusVoltage());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include "VoltageSensor.h"
|
||||
|
@ -16,4 +18,6 @@ class INA260Sensor : public TelemetrySensor, VoltageSensor
|
|||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
virtual uint16_t getBusVoltageMv() override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "INA3221Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -41,4 +43,6 @@ bool INA3221Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
uint16_t INA3221Sensor::getBusVoltageMv()
|
||||
{
|
||||
return lround(ina3221.getVoltage(INA3221_CH1) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if HAS_TELEMETRY
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include "VoltageSensor.h"
|
||||
|
@ -16,4 +18,6 @@ class INA3221Sensor : public TelemetrySensor, VoltageSensor
|
|||
int32_t runOnce() override;
|
||||
bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
virtual uint16_t getBusVoltageMv() override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "LPS22HBSensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -32,4 +34,6 @@ bool LPS22HBSensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.barometric_pressure = pressure.pressure;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_LPS2X.h>
|
||||
|
@ -15,4 +17,6 @@ class LPS22HBSensor : public TelemetrySensor
|
|||
LPS22HBSensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "MCP9808Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -26,4 +28,6 @@ bool MCP9808Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
LOG_DEBUG("MCP9808Sensor::getMetrics\n");
|
||||
measurement->variant.environment_metrics.temperature = mcp9808.readTempC();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_MCP9808.h>
|
||||
|
@ -14,4 +16,6 @@ class MCP9808Sensor : public TelemetrySensor
|
|||
MCP9808Sensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "SHT31Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -29,3 +31,5 @@ bool SHT31Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_SHT31.h>
|
||||
|
@ -15,3 +17,5 @@ class SHT31Sensor : public TelemetrySensor
|
|||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "SHTC3Sensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
|
@ -30,4 +32,6 @@ bool SHTC3Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.relative_humidity = humidity.relative_humidity;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_SHTC3.h>
|
||||
|
@ -14,4 +16,6 @@ class SHTC3Sensor : public TelemetrySensor
|
|||
SHTC3Sensor();
|
||||
virtual int32_t runOnce() override;
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,4 +1,8 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "TelemetrySensor.h"
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "NodeDB.h"
|
||||
#include "main.h"
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#pragma once
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "NodeDB.h"
|
||||
|
@ -45,4 +47,6 @@ class TelemetrySensor
|
|||
virtual bool isRunning() { return status > 0; }
|
||||
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,7 +1,11 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#pragma once
|
||||
|
||||
class VoltageSensor
|
||||
{
|
||||
public:
|
||||
virtual uint16_t getBusVoltageMv() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include "bsec_iaq.h"
|
||||
|
||||
const uint8_t bsec_config_iaq[1974] = {
|
||||
|
@ -80,3 +82,5 @@ const uint8_t bsec_config_iaq[1974] = {
|
|||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 1, 0, 5, 10, 5,
|
||||
0, 2, 0, 10, 0, 30, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 64, 1, 100, 0, 100, 0,
|
||||
100, 0, 200, 0, 200, 0, 200, 0, 64, 1, 64, 1, 64, 1, 10, 0, 0, 0, 0, 0, 21, 122, 0, 0};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,7 @@
|
|||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t bsec_config_iaq[1974];
|
||||
|
||||
#endif
|
Ładowanie…
Reference in New Issue