trunk fmt

This commit is contained in:
Thomas Göttgens 2024-05-15 12:24:42 +02:00
parent 78a1b6a9a8
commit 64dc6cc215
3 changed files with 23 additions and 27 deletions

View File

@ -544,7 +544,6 @@ void setup()
SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::VEML7700, meshtastic_TelemetrySensorType_VEML7700) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::VEML7700, meshtastic_TelemetrySensorType_VEML7700)
SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::SHT4X, meshtastic_TelemetrySensorType_SHT4X) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::SHT4X, meshtastic_TelemetrySensorType_SHT4X)
i2cScanner.reset(); i2cScanner.reset();
#ifdef HAS_SDCARD #ifdef HAS_SDCARD

View File

@ -246,54 +246,53 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
if (sht31Sensor.hasSensor()) { if (sht31Sensor.hasSensor()) {
valid = valid && sht31Sensor.getMetrics(&m); valid = valid && sht31Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (lps22hbSensor.hasSensor()) { if (lps22hbSensor.hasSensor()) {
valid = valid && lps22hbSensor.getMetrics(&m); valid = valid && lps22hbSensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (shtc3Sensor.hasSensor()) { if (shtc3Sensor.hasSensor()) {
valid = valid && shtc3Sensor.getMetrics(&m); valid = valid && shtc3Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (bmp085Sensor.hasSensor()) { if (bmp085Sensor.hasSensor()) {
valid = valid && bmp085Sensor.getMetrics(&m); valid = valid && bmp085Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (bmp280Sensor.hasSensor()) { if (bmp280Sensor.hasSensor()) {
valid = valid && bmp280Sensor.getMetrics(&m); valid = valid && bmp280Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (bme280Sensor.hasSensor()) { if (bme280Sensor.hasSensor()) {
valid = valid && bme280Sensor.getMetrics(&m); valid = valid && bme280Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (bme680Sensor.hasSensor()) { if (bme680Sensor.hasSensor()) {
valid = valid && bme680Sensor.getMetrics(&m); valid = valid && bme680Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (mcp9808Sensor.hasSensor()) { if (mcp9808Sensor.hasSensor()) {
valid = valid && mcp9808Sensor.getMetrics(&m); valid = valid && mcp9808Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (ina219Sensor.hasSensor()) { if (ina219Sensor.hasSensor()) {
valid = valid && ina219Sensor.getMetrics(&m); valid = valid && ina219Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (ina260Sensor.hasSensor()) { if (ina260Sensor.hasSensor()) {
valid = valid && ina260Sensor.getMetrics(&m); valid = valid && ina260Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (veml7700Sensor.hasSensor()) { if (veml7700Sensor.hasSensor()) {
valid = valid && veml7700Sensor.getMetrics(&m); valid = valid && veml7700Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
if (rcwl9620Sensor.hasSensor()){ if (rcwl9620Sensor.hasSensor()) {
valid = valid && rcwl9620Sensor.getMetrics(&m); valid = valid && rcwl9620Sensor.getMetrics(&m);
hasSensor = true; hasSensor = true;
} }
valid = valid && hasSensor; valid = valid && hasSensor;
if (valid) { if (valid) {
LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, " LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, "
"lux=%f\n", "lux=%f\n",

View File

@ -30,21 +30,21 @@ void VEML7700Sensor::setup() {}
* @param corrected if true, apply non-linear correction * @param corrected if true, apply non-linear correction
* @return lux value * @return lux value
*/ */
float VEML7700Sensor::computeLux(uint16_t rawALS, bool corrected) { float VEML7700Sensor::computeLux(uint16_t rawALS, bool corrected)
float lux = getResolution() * rawALS; {
if (corrected) float lux = getResolution() * rawALS;
lux = (((6.0135e-13 * lux - 9.3924e-9) * lux + 8.1488e-5) * lux + 1.0023) * if (corrected)
lux; lux = (((6.0135e-13 * lux - 9.3924e-9) * lux + 8.1488e-5) * lux + 1.0023) * lux;
return lux; return lux;
} }
/*! /*!
* @brief Determines resolution for current gain and integration time * @brief Determines resolution for current gain and integration time
* settings. * settings.
*/ */
float VEML7700Sensor::getResolution(void) { float VEML7700Sensor::getResolution(void)
return MAX_RES * (IT_MAX / veml7700.getIntegrationTimeValue()) * {
(GAIN_MAX / veml7700.getGainValue()); return MAX_RES * (IT_MAX / veml7700.getIntegrationTimeValue()) * (GAIN_MAX / veml7700.getGainValue());
} }
bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement) bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement)
@ -53,10 +53,8 @@ bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement)
measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO); measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO);
white = veml7700.readWhite(true); white = veml7700.readWhite(true);
measurement->variant.environment_metrics.white_lux = computeLux(white, white > 100); measurement->variant.environment_metrics.white_lux = computeLux(white, white > 100);
LOG_INFO("white lux %f, als lux %f\n", LOG_INFO("white lux %f, als lux %f\n", measurement->variant.environment_metrics.white_lux,
measurement->variant.environment_metrics.white_lux, measurement->variant.environment_metrics.lux);
measurement->variant.environment_metrics.lux);
return true; return true;
} }