mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-19 03:22:07 +00:00
trunk fmt
This commit is contained in:
parent
d93425fde1
commit
e543b61dd8
@ -11,8 +11,7 @@ void BMP3XXSensor::setup() {}
|
||||
int32_t BMP3XXSensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
if (!hasSensor())
|
||||
{
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
||||
@ -29,8 +28,7 @@ int32_t BMP3XXSensor::runOnce()
|
||||
bmp3xx->setOutputDataRate(BMP3_ODR_25_HZ);
|
||||
|
||||
// take a couple of initial readings to settle the sensor filters
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
bmp3xx->performReading();
|
||||
}
|
||||
return initI2CSensor();
|
||||
@ -41,8 +39,7 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
if (bmp3xx == nullptr) {
|
||||
bmp3xx = BMP3XXSingleton::GetInstance();
|
||||
}
|
||||
if ((int)measurement->which_variant == meshtastic_Telemetry_environment_metrics_tag)
|
||||
{
|
||||
if ((int)measurement->which_variant == meshtastic_Telemetry_environment_metrics_tag) {
|
||||
bmp3xx->performReading();
|
||||
|
||||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
@ -53,10 +50,10 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.barometric_pressure = static_cast<float>(bmp3xx->pressure) / 100.0F;
|
||||
measurement->variant.environment_metrics.relative_humidity = 0.0f;
|
||||
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f\n", measurement->which_variant, measurement->variant.environment_metrics.temperature, measurement->variant.environment_metrics.barometric_pressure);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f\n", measurement->which_variant,
|
||||
measurement->variant.environment_metrics.temperature,
|
||||
measurement->variant.environment_metrics.barometric_pressure);
|
||||
} else {
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i\n", measurement->which_variant);
|
||||
}
|
||||
return true;
|
||||
@ -65,8 +62,7 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
// Get a singleton wrapper for an Adafruit_bmp3xx
|
||||
BMP3XXSingleton *BMP3XXSingleton::GetInstance()
|
||||
{
|
||||
if (pinstance == nullptr)
|
||||
{
|
||||
if (pinstance == nullptr) {
|
||||
pinstance = new BMP3XXSingleton();
|
||||
}
|
||||
return pinstance;
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#define SEAL_LEVEL_HPA 1013.2f
|
||||
|
||||
#include <typeinfo>
|
||||
#include <Adafruit_BMP3XX.h>
|
||||
#include "TelemetrySensor.h"
|
||||
#include <Adafruit_BMP3XX.h>
|
||||
#include <typeinfo>
|
||||
|
||||
// Singleton wrapper for the Adafruit_BMP3XX class
|
||||
class BMP3XXSingleton : public Adafruit_BMP3XX
|
||||
|
Loading…
Reference in New Issue
Block a user