trunk fmt

This commit is contained in:
Thomas Göttgens 2024-09-02 10:23:31 +02:00
parent d93425fde1
commit e543b61dd8
3 changed files with 22 additions and 26 deletions

View File

@ -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;

View File

@ -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