From f19aa49eb230fbac41192201210c79597861be4d Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Tue, 7 May 2024 16:11:41 -0400 Subject: [PATCH 01/21] add veml7700 --- platformio.ini | 5 +-- .../Telemetry/Sensor/VEML7700Sensor.cpp | 34 +++++++++++++++++++ src/modules/Telemetry/Sensor/VEML7700Sensor.h | 17 ++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/modules/Telemetry/Sensor/VEML7700Sensor.cpp create mode 100644 src/modules/Telemetry/Sensor/VEML7700Sensor.h diff --git a/platformio.ini b/platformio.ini index a1082a84a..d03f3243d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -80,7 +80,7 @@ lib_deps = https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 https://github.com/meshtastic/TinyGPSPlus.git#964f75a72cccd6b53cd74e4add1f7a42c6f7344d https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0 - nanopb/Nanopb@^0.4.7 + nanopb/Nanopb@^0.4.8 erriez/ErriezCRC32@^1.0.1 ; Used for the code analysis in PIO Home / Inspect @@ -132,4 +132,5 @@ lib_deps = adafruit/Adafruit MPU6050@^2.2.4 adafruit/Adafruit LIS3DH@^1.2.4 https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17 - adafruit/Adafruit LSM6DS@^4.7.2 \ No newline at end of file + adafruit/Adafruit LSM6DS@^4.7.2 + adafruit/Adafruit VEML7700 Library@^2.1.6 \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp new file mode 100644 index 000000000..cfce1c7f1 --- /dev/null +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp @@ -0,0 +1,34 @@ +#include "VEML7700Sensor.h" +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include "configuration.h" +#include +#include + +VEML7700Sensor::VEML7700Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_VEML7700, "VEML7700") {} + +int32_t VEML7700Sensor::runOnce() +{ + LOG_INFO("Init sensor: %s\n", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + status = veml7700.begin(nodeTelemetrySensorsMap[sensorType].second); + + veml7700.setLowThreshold(10000); + veml7700.setHighThreshold(20000); + veml7700.interruptEnable(true); + + return initI2CSensor(); +} + +void VEML7700Sensor::setup() {} + +bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement) +{ + LOG_DEBUG("VEML7700Sensor::getMetrics\n"); + + measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO); + + return true; +} \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.h b/src/modules/Telemetry/Sensor/VEML7700Sensor.h new file mode 100644 index 000000000..fac602672 --- /dev/null +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.h @@ -0,0 +1,17 @@ +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include + +class VEML7700Sensor : public TelemetrySensor +{ + private: + Adafruit_VEML7700 veml7700; + + protected: + virtual void setup() override; + + public: + VEML7700Sensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; \ No newline at end of file From 23466b5a5fb2cc646350d26443f9ec996ecb1d0c Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Tue, 7 May 2024 18:07:24 -0400 Subject: [PATCH 02/21] regenerated files --- src/mesh/generated/meshtastic/apponly.pb.h | 2 +- src/mesh/generated/meshtastic/channel.pb.h | 17 +++++++++------ src/mesh/generated/meshtastic/deviceonly.pb.h | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 8 +++++++ src/mesh/generated/meshtastic/telemetry.pb.h | 21 ++++++++++++------- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/mesh/generated/meshtastic/apponly.pb.h b/src/mesh/generated/meshtastic/apponly.pb.h index 54629f522..ba9f90873 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.h +++ b/src/mesh/generated/meshtastic/apponly.pb.h @@ -55,7 +55,7 @@ extern const pb_msgdesc_t meshtastic_ChannelSet_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_APPONLY_PB_H_MAX_SIZE meshtastic_ChannelSet_size -#define meshtastic_ChannelSet_size 658 +#define meshtastic_ChannelSet_size 674 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/channel.pb.h b/src/mesh/generated/meshtastic/channel.pb.h index 185a47a98..d9c7d4ffa 100644 --- a/src/mesh/generated/meshtastic/channel.pb.h +++ b/src/mesh/generated/meshtastic/channel.pb.h @@ -34,6 +34,9 @@ typedef enum _meshtastic_Channel_Role { typedef struct _meshtastic_ModuleSettings { /* Bits of precision for the location sent in position packets. */ uint32_t position_precision; + /* Controls whether or not the phone / clients should mute the current channel + Useful for noisy public channels you don't necessarily want to disable */ + bool is_client_muted; } meshtastic_ModuleSettings; typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t; @@ -126,14 +129,15 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_default} -#define meshtastic_ModuleSettings_init_default {0} +#define meshtastic_ModuleSettings_init_default {0, 0} #define meshtastic_Channel_init_default {0, false, meshtastic_ChannelSettings_init_default, _meshtastic_Channel_Role_MIN} #define meshtastic_ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_zero} -#define meshtastic_ModuleSettings_init_zero {0} +#define meshtastic_ModuleSettings_init_zero {0, 0} #define meshtastic_Channel_init_zero {0, false, meshtastic_ChannelSettings_init_zero, _meshtastic_Channel_Role_MIN} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_ModuleSettings_position_precision_tag 1 +#define meshtastic_ModuleSettings_is_client_muted_tag 2 #define meshtastic_ChannelSettings_channel_num_tag 1 #define meshtastic_ChannelSettings_psk_tag 2 #define meshtastic_ChannelSettings_name_tag 3 @@ -159,7 +163,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, module_settings, 7) #define meshtastic_ChannelSettings_module_settings_MSGTYPE meshtastic_ModuleSettings #define meshtastic_ModuleSettings_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, position_precision, 1) +X(a, STATIC, SINGULAR, UINT32, position_precision, 1) \ +X(a, STATIC, SINGULAR, BOOL, is_client_muted, 2) #define meshtastic_ModuleSettings_CALLBACK NULL #define meshtastic_ModuleSettings_DEFAULT NULL @@ -182,9 +187,9 @@ extern const pb_msgdesc_t meshtastic_Channel_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_MAX_SIZE meshtastic_Channel_size -#define meshtastic_ChannelSettings_size 70 -#define meshtastic_Channel_size 85 -#define meshtastic_ModuleSettings_size 6 +#define meshtastic_ChannelSettings_size 72 +#define meshtastic_Channel_size 87 +#define meshtastic_ModuleSettings_size 8 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 2506ec647..b8cc80633 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -306,7 +306,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_DeviceState_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size -#define meshtastic_ChannelFile_size 702 +#define meshtastic_ChannelFile_size 718 #define meshtastic_NodeInfoLite_size 166 #define meshtastic_OEMStore_size 3346 #define meshtastic_PositionLite_size 28 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 67b2edd15..ffc18c30b 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -63,6 +63,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_NANO_G2_ULTRA = 18, /* LoRAType device: https://loratype.org/ */ meshtastic_HardwareModel_LORA_TYPE = 19, + /* wiphone https://www.wiphone.io/ */ + meshtastic_HardwareModel_WIPHONE = 20, /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ meshtastic_HardwareModel_STATION_G1 = 25, /* RAK11310 (RP2040 + SX1262) */ @@ -148,6 +150,12 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_TD_LORAC = 60, /* CDEBYTE EoRa-S3 board using their own MM modules, clone of LILYGO T3S3 */ meshtastic_HardwareModel_CDEBYTE_EORA_S3 = 61, + /* TWC_MESH_V4 + Adafruit NRF52840 feather express with SX1262, SSD1306 OLED and NEO6M GPS */ + meshtastic_HardwareModel_TWC_MESH_V4 = 62, + /* NRF52_PROMICRO_DIY + Promicro NRF52840 with SX1262/LLCC68, SSD1306 OLED and NEO6M GPS */ + meshtastic_HardwareModel_NRF52_PROMICRO_DIY = 63, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index e670dd340..d4efad85d 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -45,7 +45,11 @@ typedef enum _meshtastic_TelemetrySensorType { /* BMP085/BMP180 High accuracy temperature and pressure (older Version of BMP280) */ meshtastic_TelemetrySensorType_BMP085 = 15, /* RCWL-9620 Doppler Radar Distance Sensor, used for water level detection */ - meshtastic_TelemetrySensorType_RCWL9620 = 16 + meshtastic_TelemetrySensorType_RCWL9620 = 16, + /* Sensirion High accuracy temperature and humidity */ + meshtastic_TelemetrySensorType_SHT4X = 17, + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ + meshtastic_TelemetrySensorType_VEML7700 = 18 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -82,6 +86,7 @@ typedef struct _meshtastic_EnvironmentMetrics { uint16_t iaq; /* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. */ float distance; + float lux; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -152,8 +157,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_RCWL9620 -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_RCWL9620+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_VEML7700 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_VEML7700+1)) @@ -163,12 +168,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -187,6 +192,7 @@ extern "C" { #define meshtastic_EnvironmentMetrics_current_tag 6 #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 +#define meshtastic_EnvironmentMetrics_lux_tag 9 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -229,7 +235,8 @@ X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ -X(a, STATIC, SINGULAR, FLOAT, distance, 8) +X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ +X(a, STATIC, SINGULAR, FLOAT, lux, 9) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -289,7 +296,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 39 +#define meshtastic_EnvironmentMetrics_size 44 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 From 39336847adf18cfe1557bc5bbf2f1b46c456917d Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Wed, 8 May 2024 22:14:55 -0400 Subject: [PATCH 03/21] add veml7700 readings to protobuf and to the mqtt json + fix the readigns validator code in env telemetry --- src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/main.cpp | 3 +- src/mesh/generated/meshtastic/telemetry.pb.h | 17 +++- .../Telemetry/EnvironmentTelemetry.cpp | 88 ++++++++++++------- .../Telemetry/Sensor/VEML7700Sensor.cpp | 5 +- src/mqtt/MQTT.cpp | 4 + 8 files changed, 82 insertions(+), 38 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 701e07a32..37fda2b9d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -128,6 +128,7 @@ along with this program. If not, see . #define LPS22HB_ADDR_ALT 0x5D #define SHT31_ADDR 0x44 #define PMSA0031_ADDR 0x12 +#define VEML7700_ADDR 0x10 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index c8fcfee10..5fad2f30a 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -41,6 +41,7 @@ class ScanI2C BQ24295, LSM6DS3, TCA9555, + VEML7700, #ifdef HAS_NCP5623 NCP5623, #endif diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index ba2820a77..0b76318ce 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -324,6 +324,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port) SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found\n"); SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address); SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found\n"); + SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found\n"); default: LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address); diff --git a/src/main.cpp b/src/main.cpp index f40fd0789..0a26312eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -538,6 +538,7 @@ void setup() SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::QMI8658, meshtastic_TelemetrySensorType_QMI8658) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::QMC5883L, meshtastic_TelemetrySensorType_QMC5883L) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::PMSA0031, meshtastic_TelemetrySensorType_PMSA003I) + SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::VEML7700, meshtastic_TelemetrySensorType_VEML7700) i2cScanner.reset(); @@ -1006,4 +1007,4 @@ void loop() mainDelay.delay(delayMsec); } // if (didWake) LOG_DEBUG("wake!\n"); -} +} \ No newline at end of file diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index d4efad85d..d85855437 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -86,7 +86,12 @@ typedef struct _meshtastic_EnvironmentMetrics { uint16_t iaq; /* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. */ float distance; + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ float lux; + /* VEML7700 raw white light data digital 16-bit resolution sensor. */ + uint32_t white; + /* VEML7700 raw ALS data digital 16-bit resolution sensor. */ + uint32_t ALS; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -168,12 +173,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -193,6 +198,8 @@ extern "C" { #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 #define meshtastic_EnvironmentMetrics_lux_tag 9 +#define meshtastic_EnvironmentMetrics_white_tag 10 +#define meshtastic_EnvironmentMetrics_ALS_tag 11 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -236,7 +243,9 @@ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ -X(a, STATIC, SINGULAR, FLOAT, lux, 9) +X(a, STATIC, SINGULAR, FLOAT, lux, 9) \ +X(a, STATIC, SINGULAR, UINT32, white, 10) \ +X(a, STATIC, SINGULAR, UINT32, ALS, 11) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -296,7 +305,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 44 +#define meshtastic_EnvironmentMetrics_size 56 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 189ab7ed0..657d309ba 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -23,6 +23,7 @@ #include "Sensor/MCP9808Sensor.h" #include "Sensor/SHT31Sensor.h" #include "Sensor/SHTC3Sensor.h" +#include "Sensor/VEML7700Sensor.h" BMP085Sensor bmp085Sensor; BMP280Sensor bmp280Sensor; @@ -32,6 +33,7 @@ MCP9808Sensor mcp9808Sensor; SHTC3Sensor shtc3Sensor; LPS22HBSensor lps22hbSensor; SHT31Sensor sht31Sensor; +VEML7700Sensor veml7700Sensor; #define FAILED_STATE_SENSOR_READ_MULTIPLIER 10 #define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true @@ -90,6 +92,8 @@ int32_t EnvironmentTelemetryModule::runOnce() result = ina219Sensor.runOnce(); if (ina260Sensor.hasSensor()) result = ina260Sensor.runOnce(); + if (veml7700Sensor.hasSensor()) + result = veml7700Sensor.runOnce(); } return result; } else { @@ -192,10 +196,11 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac const char *sender = getSenderShortName(mp); LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, " - "temperature=%f, voltage=%f\n", + "temperature=%f, voltage=%f, lux=%f, iaq=%i\n", sender, t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.current, t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity, - t->variant.environment_metrics.temperature, t->variant.environment_metrics.voltage); + t->variant.environment_metrics.temperature, t->variant.environment_metrics.voltage, + t->variant.environment_metrics.lux, t->variant.environment_metrics.iaq); #endif // release previous packet before occupying a new spot if (lastMeasurementPacket != nullptr) @@ -210,44 +215,65 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) { meshtastic_Telemetry m; - bool valid = false; + bool valid = true; + bool hasSensor = false; m.time = getTime(); m.which_variant = meshtastic_Telemetry_environment_metrics_tag; - m.variant.environment_metrics.barometric_pressure = 0; - m.variant.environment_metrics.current = 0; - m.variant.environment_metrics.gas_resistance = 0; - m.variant.environment_metrics.relative_humidity = 0; - m.variant.environment_metrics.temperature = 0; - m.variant.environment_metrics.voltage = 0; - - if (sht31Sensor.hasSensor()) - valid = sht31Sensor.getMetrics(&m); - if (lps22hbSensor.hasSensor()) - valid = lps22hbSensor.getMetrics(&m); - if (shtc3Sensor.hasSensor()) - valid = shtc3Sensor.getMetrics(&m); - if (bmp085Sensor.hasSensor()) - valid = bmp085Sensor.getMetrics(&m); - if (bmp280Sensor.hasSensor()) - valid = bmp280Sensor.getMetrics(&m); - if (bme280Sensor.hasSensor()) - valid = bme280Sensor.getMetrics(&m); - if (bme680Sensor.hasSensor()) - valid = bme680Sensor.getMetrics(&m); - if (mcp9808Sensor.hasSensor()) - valid = mcp9808Sensor.getMetrics(&m); - if (ina219Sensor.hasSensor()) + if (sht31Sensor.hasSensor()) { + valid = valid && sht31Sensor.getMetrics(&m); + hasSensor = true; + } + if (lps22hbSensor.hasSensor()) { + valid = valid && lps22hbSensor.getMetrics(&m); + hasSensor = true; + } + if (shtc3Sensor.hasSensor()) { + valid = valid && shtc3Sensor.getMetrics(&m); + hasSensor = true; + } + if (bmp085Sensor.hasSensor()) { + valid = valid && bmp085Sensor.getMetrics(&m); + hasSensor = true; + } + if (bmp280Sensor.hasSensor()) { + valid = valid && bmp280Sensor.getMetrics(&m); + hasSensor = true; + } + if (bme280Sensor.hasSensor()) { + valid = valid && bme280Sensor.getMetrics(&m); + hasSensor = true; + } + if (bme680Sensor.hasSensor()) { + valid = valid && bme680Sensor.getMetrics(&m); + hasSensor = true; + } + if (mcp9808Sensor.hasSensor()) { + valid = valid && mcp9808Sensor.getMetrics(&m); + hasSensor = true; + } + if (ina219Sensor.hasSensor()) { valid = ina219Sensor.getMetrics(&m); - if (ina260Sensor.hasSensor()) - valid = ina260Sensor.getMetrics(&m); + hasSensor = true; + } + if (ina260Sensor.hasSensor()) { + valid = valid && ina260Sensor.getMetrics(&m); + hasSensor = true; + } + if (veml7700Sensor.hasSensor()) { + valid = valid && veml7700Sensor.getMetrics(&m); + hasSensor = true; + } + + valid = valid && hasSensor; if (valid) { LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, " - "voltage=%f\n", + "voltage=%f, lux=%f, iaq=%i\n", m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current, m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity, - m.variant.environment_metrics.temperature, m.variant.environment_metrics.voltage); + m.variant.environment_metrics.temperature, m.variant.environment_metrics.voltage, + m.variant.environment_metrics.lux, m.variant.environment_metrics.iaq); sensor_read_error_count = 0; diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp index cfce1c7f1..5e1376849 100644 --- a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp @@ -26,9 +26,10 @@ void VEML7700Sensor::setup() {} bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement) { - LOG_DEBUG("VEML7700Sensor::getMetrics\n"); - measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO); + measurement->variant.environment_metrics.white = veml7700.readWhite(); + measurement->variant.environment_metrics.ALS = veml7700.readALS(); + return true; } \ No newline at end of file diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index da1c204b8..59f1002fc 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -664,6 +664,10 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp) msgPayload["gas_resistance"] = new JSONValue(decoded->variant.environment_metrics.gas_resistance); msgPayload["voltage"] = new JSONValue(decoded->variant.environment_metrics.voltage); msgPayload["current"] = new JSONValue(decoded->variant.environment_metrics.current); + msgPayload["lux"] = new JSONValue(decoded->variant.environment_metrics.lux); + msgPayload["white"] = new JSONValue((uint)decoded->variant.environment_metrics.white); + msgPayload["ALS"] = new JSONValue((uint)decoded->variant.environment_metrics.ALS); + msgPayload["iaq"] = new JSONValue((uint)decoded->variant.environment_metrics.iaq); } else if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) { msgPayload["voltage_ch1"] = new JSONValue(decoded->variant.power_metrics.ch1_voltage); msgPayload["current_ch1"] = new JSONValue(decoded->variant.power_metrics.ch1_current); From 77e76bc92b8a7ea0816eea23f39b6e59a1e035d0 Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Tue, 14 May 2024 16:42:23 -0400 Subject: [PATCH 04/21] Fix VEML7700Sensor readings and update protobuf and MQTT JSON --- src/mesh/generated/meshtastic/telemetry.pb.h | 18 +++++------ .../Telemetry/Sensor/VEML7700Sensor.cpp | 31 +++++++++++++++++-- src/modules/Telemetry/Sensor/VEML7700Sensor.h | 5 +++ src/mqtt/MQTT.cpp | 3 +- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index d85855437..fb1a84c44 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -88,10 +88,8 @@ typedef struct _meshtastic_EnvironmentMetrics { float distance; /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ float lux; - /* VEML7700 raw white light data digital 16-bit resolution sensor. */ - uint32_t white; - /* VEML7700 raw ALS data digital 16-bit resolution sensor. */ - uint32_t ALS; + /* VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. */ + float white_lux; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -173,12 +171,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -198,8 +196,7 @@ extern "C" { #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 #define meshtastic_EnvironmentMetrics_lux_tag 9 -#define meshtastic_EnvironmentMetrics_white_tag 10 -#define meshtastic_EnvironmentMetrics_ALS_tag 11 +#define meshtastic_EnvironmentMetrics_white_lux_tag 10 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -244,8 +241,7 @@ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ X(a, STATIC, SINGULAR, FLOAT, lux, 9) \ -X(a, STATIC, SINGULAR, UINT32, white, 10) \ -X(a, STATIC, SINGULAR, UINT32, ALS, 11) +X(a, STATIC, SINGULAR, FLOAT, white_lux, 10) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -305,7 +301,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 56 +#define meshtastic_EnvironmentMetrics_size 49 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp index 5e1376849..1870cb3f9 100644 --- a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp @@ -24,11 +24,38 @@ int32_t VEML7700Sensor::runOnce() void VEML7700Sensor::setup() {} +/*! + * @brief Copmute lux from ALS reading. + * @param rawALS raw ALS register value + * @param corrected if true, apply non-linear correction + * @return lux value + */ +float VEML7700Sensor::computeLux(uint16_t rawALS, bool corrected) { + float lux = getResolution() * rawALS; + if (corrected) + lux = (((6.0135e-13 * lux - 9.3924e-9) * lux + 8.1488e-5) * lux + 1.0023) * + lux; + return lux; +} + +/*! + * @brief Determines resolution for current gain and integration time + * settings. + */ +float VEML7700Sensor::getResolution(void) { + return MAX_RES * (IT_MAX / veml7700.getIntegrationTimeValue()) * + (GAIN_MAX / veml7700.getGainValue()); +} + bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement) { + int16_t white; measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO); - measurement->variant.environment_metrics.white = veml7700.readWhite(); - measurement->variant.environment_metrics.ALS = veml7700.readALS(); + white = veml7700.readWhite(true); + measurement->variant.environment_metrics.white_lux = computeLux(white, white > 100); + LOG_INFO("white lux %f, als lux %f\n", + measurement->variant.environment_metrics.white_lux, + measurement->variant.environment_metrics.lux); return true; diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.h b/src/modules/Telemetry/Sensor/VEML7700Sensor.h index fac602672..9c7a584d9 100644 --- a/src/modules/Telemetry/Sensor/VEML7700Sensor.h +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.h @@ -5,7 +5,12 @@ class VEML7700Sensor : public TelemetrySensor { private: + const float MAX_RES = 0.0036; + const float GAIN_MAX = 2; + const float IT_MAX = 800; Adafruit_VEML7700 veml7700; + float computeLux(uint16_t rawALS, bool corrected); + float getResolution(void); protected: virtual void setup() override; diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 59f1002fc..e91eade35 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -665,8 +665,7 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp) msgPayload["voltage"] = new JSONValue(decoded->variant.environment_metrics.voltage); msgPayload["current"] = new JSONValue(decoded->variant.environment_metrics.current); msgPayload["lux"] = new JSONValue(decoded->variant.environment_metrics.lux); - msgPayload["white"] = new JSONValue((uint)decoded->variant.environment_metrics.white); - msgPayload["ALS"] = new JSONValue((uint)decoded->variant.environment_metrics.ALS); + msgPayload["white_lux"] = new JSONValue(decoded->variant.environment_metrics.white_lux); msgPayload["iaq"] = new JSONValue((uint)decoded->variant.environment_metrics.iaq); } else if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) { msgPayload["voltage_ch1"] = new JSONValue(decoded->variant.power_metrics.ch1_voltage); From 022e1f472d2690e68bc3a8246070acdee128d8b9 Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Tue, 14 May 2024 17:00:33 -0400 Subject: [PATCH 05/21] Updated protobufs submodule --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index eade2c6be..71f3d68db 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 +Subproject commit 71f3d68db56fb335c78211443b6cff3d661adb03 From 0aa449bca943528e2fc00f9ddeeaf4631334b011 Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Tue, 14 May 2024 18:47:20 -0400 Subject: [PATCH 06/21] Fix unnecessary code block removal in EnvironmentTelemetryModule --- src/modules/Telemetry/EnvironmentTelemetry.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 53a415af5..77d292849 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -220,8 +220,6 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac t->variant.environment_metrics.temperature, t->variant.environment_metrics.lux); LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f\n", sender, t->variant.environment_metrics.voltage, t->variant.environment_metrics.iaq, t->variant.environment_metrics.distance); - -#endif #endif // release previous packet before occupying a new spot if (lastMeasurementPacket != nullptr) From 78a1b6a9a827462b5486844f5ccd57ba0408db40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 15 May 2024 09:59:46 +0200 Subject: [PATCH 07/21] unrelated change, i just noticed this problem... --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 5641e1f63..ff704c931 100644 --- a/platformio.ini +++ b/platformio.ini @@ -134,5 +134,5 @@ lib_deps = adafruit/Adafruit LSM6DS@^4.7.2 mprograms/QMC5883LCompass@^1.2.0 adafruit/Adafruit VEML7700 Library@^2.1.6 - https://github.com/adafruit/Adafruit_SHT4X#1.0.4 + adafruit/Adafruit SHT4x Library@^1.0.4 From 64dc6cc215a24707b7cd68770a1a589eddfe06e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 15 May 2024 12:24:42 +0200 Subject: [PATCH 08/21] trunk fmt --- src/main.cpp | 1 - .../Telemetry/EnvironmentTelemetry.cpp | 25 +++++++++---------- .../Telemetry/Sensor/VEML7700Sensor.cpp | 24 ++++++++---------- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 03c116ede..f14d08188 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -544,7 +544,6 @@ void setup() SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::VEML7700, meshtastic_TelemetrySensorType_VEML7700) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::SHT4X, meshtastic_TelemetrySensorType_SHT4X) - i2cScanner.reset(); #ifdef HAS_SDCARD diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index e35c2a51a..d0a9890dd 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -246,54 +246,53 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) if (sht31Sensor.hasSensor()) { valid = valid && sht31Sensor.getMetrics(&m); hasSensor = true; - } + } if (lps22hbSensor.hasSensor()) { valid = valid && lps22hbSensor.getMetrics(&m); hasSensor = true; - } + } if (shtc3Sensor.hasSensor()) { valid = valid && shtc3Sensor.getMetrics(&m); hasSensor = true; - } + } if (bmp085Sensor.hasSensor()) { valid = valid && bmp085Sensor.getMetrics(&m); hasSensor = true; - } + } if (bmp280Sensor.hasSensor()) { valid = valid && bmp280Sensor.getMetrics(&m); hasSensor = true; - } + } if (bme280Sensor.hasSensor()) { valid = valid && bme280Sensor.getMetrics(&m); hasSensor = true; - } + } if (bme680Sensor.hasSensor()) { valid = valid && bme680Sensor.getMetrics(&m); hasSensor = true; - } + } if (mcp9808Sensor.hasSensor()) { valid = valid && mcp9808Sensor.getMetrics(&m); hasSensor = true; - } + } if (ina219Sensor.hasSensor()) { valid = valid && ina219Sensor.getMetrics(&m); hasSensor = true; - } + } if (ina260Sensor.hasSensor()) { valid = valid && ina260Sensor.getMetrics(&m); hasSensor = true; - } + } if (veml7700Sensor.hasSensor()) { valid = valid && veml7700Sensor.getMetrics(&m); hasSensor = true; - } - if (rcwl9620Sensor.hasSensor()){ + } + if (rcwl9620Sensor.hasSensor()) { valid = valid && rcwl9620Sensor.getMetrics(&m); hasSensor = true; } valid = valid && hasSensor; - if (valid) { LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, " "lux=%f\n", diff --git a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp index 1870cb3f9..1abe8339f 100644 --- a/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp +++ b/src/modules/Telemetry/Sensor/VEML7700Sensor.cpp @@ -30,21 +30,21 @@ void VEML7700Sensor::setup() {} * @param corrected if true, apply non-linear correction * @return lux value */ -float VEML7700Sensor::computeLux(uint16_t rawALS, bool corrected) { - float lux = getResolution() * rawALS; - if (corrected) - lux = (((6.0135e-13 * lux - 9.3924e-9) * lux + 8.1488e-5) * lux + 1.0023) * - lux; - return lux; +float VEML7700Sensor::computeLux(uint16_t rawALS, bool corrected) +{ + float lux = getResolution() * rawALS; + if (corrected) + lux = (((6.0135e-13 * lux - 9.3924e-9) * lux + 8.1488e-5) * lux + 1.0023) * lux; + return lux; } /*! * @brief Determines resolution for current gain and integration time * settings. */ -float VEML7700Sensor::getResolution(void) { - return MAX_RES * (IT_MAX / veml7700.getIntegrationTimeValue()) * - (GAIN_MAX / veml7700.getGainValue()); +float VEML7700Sensor::getResolution(void) +{ + return MAX_RES * (IT_MAX / veml7700.getIntegrationTimeValue()) * (GAIN_MAX / veml7700.getGainValue()); } 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); white = veml7700.readWhite(true); measurement->variant.environment_metrics.white_lux = computeLux(white, white > 100); - LOG_INFO("white lux %f, als lux %f\n", - measurement->variant.environment_metrics.white_lux, - measurement->variant.environment_metrics.lux); - + LOG_INFO("white lux %f, als lux %f\n", measurement->variant.environment_metrics.white_lux, + measurement->variant.environment_metrics.lux); return true; } \ No newline at end of file From 419820f4836d4b26a38180c39e59fb100722133e Mon Sep 17 00:00:00 2001 From: caveman99 <25002+caveman99@users.noreply.github.com> Date: Wed, 15 May 2024 12:47:31 +0000 Subject: [PATCH 09/21] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 32 +++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/protobufs b/protobufs index 1bfe0354d..bee9ddc71 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 1bfe0354d101a6a71ea1354ea158e59193671a0b +Subproject commit bee9ddc71677e974568a5a95362d78acac6bb974 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index b6b08f2e7..7748dd6b3 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -47,7 +47,17 @@ typedef enum _meshtastic_TelemetrySensorType { /* RCWL-9620 Doppler Radar Distance Sensor, used for water level detection */ meshtastic_TelemetrySensorType_RCWL9620 = 16, /* Sensirion High accuracy temperature and humidity */ - meshtastic_TelemetrySensorType_SHT4X = 17 + meshtastic_TelemetrySensorType_SHT4X = 17, + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ + meshtastic_TelemetrySensorType_VEML7700 = 18, + /* MLX90632 non-contact IR temperature sensor. */ + meshtastic_TelemetrySensorType_MLX90632 = 19, + /* TI OPT3001 Ambient Light Sensor */ + meshtastic_TelemetrySensorType_OPT3001 = 20, + /* Lite On LTR-390UV-01 UV Light Sensor */ + meshtastic_TelemetrySensorType_LTR390UV = 21, + /* AMS TSL25911FN RGB Light Sensor */ + meshtastic_TelemetrySensorType_TSL25911FN = 22 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -84,6 +94,10 @@ typedef struct _meshtastic_EnvironmentMetrics { uint16_t iaq; /* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. */ float distance; + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ + float lux; + /* VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. */ + float white_lux; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -154,8 +168,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SHT4X -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SHT4X+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_TSL25911FN +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_TSL25911FN+1)) @@ -165,12 +179,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -189,6 +203,8 @@ extern "C" { #define meshtastic_EnvironmentMetrics_current_tag 6 #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 +#define meshtastic_EnvironmentMetrics_lux_tag 9 +#define meshtastic_EnvironmentMetrics_white_lux_tag 10 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -231,7 +247,9 @@ X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ -X(a, STATIC, SINGULAR, FLOAT, distance, 8) +X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ +X(a, STATIC, SINGULAR, FLOAT, lux, 9) \ +X(a, STATIC, SINGULAR, FLOAT, white_lux, 10) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -291,7 +309,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 39 +#define meshtastic_EnvironmentMetrics_size 49 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 From bd9156de24196ce99b6bdda8a0c615565c31cea0 Mon Sep 17 00:00:00 2001 From: Ken McGuire Date: Wed, 15 May 2024 11:12:46 -0600 Subject: [PATCH 10/21] GPS Chechsum failures (#3900) * Portduino multiple logging levels * Fixes based on GPSFan work * Fix derped logic * Correct size field for AID message * Reformat to add comments, beginning of GPS rework * Update PM2 message for Neo-6 * Correct ECO mode logic as ECO mode is only for Neo-6 * Cleanup ubx.h add a few more comments * GPS rework, changes for M8 and stub for M10 * Add VALSET commands for u-blox M10 receivers * Add VALSET commands for u-blox M10 receivers tweak M8 commands add comments for VALSET configuration commands * Add commands to init M10 receivers, tweak the M8 init sequence, this is a WIP as there are still some issues during init. Add M10 version of PMREQ. * Add wakeup source of uartrx to PMREQ_10 The M10 does not respond to commands when asleep, may need to do this for the M8 as well * Enable NMEA messages on USB port. Normally, it is a good idea to disable messages on unused ports. Native Linux needs to be able to use GNSS modules connected via via either serial or USB. In the future I2C connections may be required, but are not enabled for now. * Save the config for all u-blox receiver types. The M10 supports this command in addition to saving using the VALSET commands for the RAM & BBR layers. * Address Issue #3779 RAK12500 GPS Checksum failures Remove NMEA sentences that are not processed by TinyGPS++ or Meshtastic. --------- Co-authored-by: Jonathan Bennett Co-authored-by: Ben Meadors --- src/gps/GPS.cpp | 3 +++ src/gps/ubx.h | 31 ++++++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index eaae049b5..4335244f0 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -472,6 +472,9 @@ bool GPS::setup() // Turn off GSV messages, we don't really care about which and where the sats are, maybe someday. _serial_gps->write("$CFGMSG,0,3,0\r\n"); delay(250); + // Turn off GSA messages, TinyGPS++ doesn't use this message. + _serial_gps->write("$CFGMSG,0,2,0\r\n"); + delay(250); // Turn off NOTICE __TXT messages, these may provide Unicore some info but we don't care. _serial_gps->write("$CFGMSG,6,0,0\r\n"); delay(250); diff --git a/src/gps/ubx.h b/src/gps/ubx.h index 5b2cb24ce..0a382a8a3 100644 --- a/src/gps/ubx.h +++ b/src/gps/ubx.h @@ -206,14 +206,14 @@ const uint8_t GPS::_message_GLL[] = { 0x00 // Reserved }; -// Enable GSA. GSA - GPS DOP and active satellites, used for detailing the satellites used in the positioning and +// Disable GSA. GSA - GPS DOP and active satellites, used for detailing the satellites used in the positioning and // the DOP (Dilution of Precision) const uint8_t GPS::_message_GSA[] = { 0xF0, 0x02, // NMEA ID for GSA 0x00, // Rate for DDC - 0x01, // Rate for UART1 + 0x00, // Rate for UART1 0x00, // Rate for UART2 - 0x01, // Rate for USB usefull for native linux + 0x00, // Rate for USB usefull for native linux 0x00, // Rate for SPI 0x00 // Reserved }; @@ -402,23 +402,28 @@ const uint8_t GPS::_message_VALSET_DISABLE_NMEA_BBR[] = {0x00, 0x02, 0x00, 0x00, // BBR layer config message: // b5 62 06 8a 09 00 00 02 00 00 07 00 92 20 06 5a 58 -// Turn NMEA GSA, GGA, RMC messages on: -// Ram layer config message: -// b5 62 06 8a 13 00 00 01 00 00 c0 00 91 20 01 bb 00 91 20 01 ac 00 91 20 01 e1 3b - -// BBR layer config message: -// b5 62 06 8a 13 00 00 02 00 00 c0 00 91 20 01 bb 00 91 20 01 ac 00 91 20 01 e2 4d +// Turn NMEA GGA, RMC messages on: +// Layer config messages: +// RAM: +// b5 62 06 8a 0e 00 00 01 00 00 bb 00 91 20 01 ac 00 91 20 01 6a 8f +// BBR: +// b5 62 06 8a 0e 00 00 02 00 00 bb 00 91 20 01 ac 00 91 20 01 6b 9c +// FLASH: +// b5 62 06 8a 0e 00 00 04 00 00 bb 00 91 20 01 ac 00 91 20 01 6d b6 +// Doing this for the FLASH layer isn't really required since we save the config to flash later const uint8_t GPS::_message_VALSET_DISABLE_TXT_INFO_RAM[] = {0x00, 0x01, 0x00, 0x00, 0x07, 0x00, 0x92, 0x20, 0x03}; const uint8_t GPS::_message_VALSET_DISABLE_TXT_INFO_BBR[] = {0x00, 0x02, 0x00, 0x00, 0x07, 0x00, 0x92, 0x20, 0x03}; -const uint8_t GPS::_message_VALSET_ENABLE_NMEA_RAM[] = {0x00, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x91, 0x20, 0x01, 0xbb, - 0x00, 0x91, 0x20, 0x01, 0xac, 0x00, 0x91, 0x20, 0x01}; -const uint8_t GPS::_message_VALSET_ENABLE_NMEA_BBR[] = {0x00, 0x02, 0x00, 0x00, 0xc0, 0x00, 0x91, 0x20, 0x01, 0xbb, - 0x00, 0x91, 0x20, 0x01, 0xac, 0x00, 0x91, 0x20, 0x01}; + +const uint8_t GPS::_message_VALSET_ENABLE_NMEA_RAM[] = {0x00, 0x01, 0x00, 0x00, 0xbb, 0x00, 0x91, + 0x20, 0x01, 0xac, 0x00, 0x91, 0x20, 0x01}; +const uint8_t GPS::_message_VALSET_ENABLE_NMEA_BBR[] = {0x00, 0x02, 0x00, 0x00, 0xbb, 0x00, 0x91, + 0x20, 0x01, 0xac, 0x00, 0x91, 0x20, 0x01}; const uint8_t GPS::_message_VALSET_DISABLE_SBAS_RAM[] = {0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x31, 0x10, 0x00, 0x05, 0x00, 0x31, 0x10, 0x00}; const uint8_t GPS::_message_VALSET_DISABLE_SBAS_BBR[] = {0x00, 0x02, 0x00, 0x00, 0x20, 0x00, 0x31, 0x10, 0x00, 0x05, 0x00, 0x31, 0x10, 0x00}; + /* Operational issues with the M10: From 9e8ca69a11ee8ad2b53f16fb2f3eeeba7f76bef6 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Wed, 15 May 2024 22:24:25 +0200 Subject: [PATCH 11/21] bin: remove unused import in buildinfo.py This was originally added in b1c30f06509459e5afc5291de067b1946ae4ddd5 and it now do nothing since 361556a6a7913104c513c8f8029efe090267bb9f because it now use readprops. --- bin/buildinfo.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/buildinfo.py b/bin/buildinfo.py index 6b123c9cf..5aecad1bd 100755 --- a/bin/buildinfo.py +++ b/bin/buildinfo.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 -import configparser import sys + from readprops import readProps - -verObj = readProps('version.properties') +verObj = readProps("version.properties") propName = sys.argv[1] print(f"{verObj[propName]}") From e08c808c3fc7e16aab2e12904764bf0aa0c39137 Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Wed, 15 May 2024 17:06:23 -0400 Subject: [PATCH 12/21] fix log line --- src/modules/Telemetry/EnvironmentTelemetry.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index d0a9890dd..a3f63b0aa 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -218,12 +218,12 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac const char *sender = getSenderShortName(mp); LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, " - "temperature=%f, lux=%f\n", + "temperature=%f\n", sender, t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.current, t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity, - t->variant.environment_metrics.temperature, t->variant.environment_metrics.lux); - LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f\n", sender, t->variant.environment_metrics.voltage, - t->variant.environment_metrics.iaq, t->variant.environment_metrics.distance); + t->variant.environment_metrics.temperature); + LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f, lux=%f\n", sender, t->variant.environment_metrics.voltage, + t->variant.environment_metrics.iaq, t->variant.environment_metrics.distance, t->variant.environment_metrics.lux); #endif // release previous packet before occupying a new spot if (lastMeasurementPacket != nullptr) @@ -294,13 +294,12 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) valid = valid && hasSensor; if (valid) { - LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, " - "lux=%f\n", + LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f\n", m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current, m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity, - m.variant.environment_metrics.temperature, m.variant.environment_metrics.lux); - LOG_INFO("(Sending): voltage=%f, IAQ=%d, distance=%f\n", m.variant.environment_metrics.voltage, - m.variant.environment_metrics.iaq, m.variant.environment_metrics.distance); + m.variant.environment_metrics.temperature); + LOG_INFO("(Sending): voltage=%f, IAQ=%d, distance=%f, lux=%f\n", m.variant.environment_metrics.voltage, + m.variant.environment_metrics.iaq, m.variant.environment_metrics.distance, m.variant.environment_metrics.lux); sensor_read_error_count = 0; From ce25381f678e5838a8ca80b74f4ccb5b8311cdb4 Mon Sep 17 00:00:00 2001 From: Jorge Castillo Date: Wed, 15 May 2024 17:13:28 -0400 Subject: [PATCH 13/21] fix unrelated change --- platformio.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index ff704c931..0f2907dee 100644 --- a/platformio.ini +++ b/platformio.ini @@ -134,5 +134,4 @@ lib_deps = adafruit/Adafruit LSM6DS@^4.7.2 mprograms/QMC5883LCompass@^1.2.0 adafruit/Adafruit VEML7700 Library@^2.1.6 - adafruit/Adafruit SHT4x Library@^1.0.4 - + https://github.com/adafruit/Adafruit_SHT4X#1.0.4 \ No newline at end of file From eaa7fcf3dcdaa1f4b4a1a814052c509d34b314bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 00:23:03 +0200 Subject: [PATCH 14/21] Revert "Updated protobufs submodule" This reverts commit 022e1f472d2690e68bc3a8246070acdee128d8b9. --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 71f3d68db..eade2c6be 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 71f3d68db56fb335c78211443b6cff3d661adb03 +Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 From 79628c73cda35d798b854cc68dec245a82cc5481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 00:23:51 +0200 Subject: [PATCH 15/21] tryfix proto conflict --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index eade2c6be..71f3d68db 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 +Subproject commit 71f3d68db56fb335c78211443b6cff3d661adb03 From 6dbc85810209c16a60736da16b52bd42fdb95f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 00:26:01 +0200 Subject: [PATCH 16/21] Revert "tryfix proto conflict" This reverts commit 79628c73cda35d798b854cc68dec245a82cc5481. --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 71f3d68db..eade2c6be 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 71f3d68db56fb335c78211443b6cff3d661adb03 +Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 From 3342395a0b783fee59abbb5ef1291985ce5967e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 01:04:38 +0200 Subject: [PATCH 17/21] fix generated files --- src/mesh/generated/meshtastic/telemetry.pb.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index ecb353ff6..f4a79398f 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -49,7 +49,15 @@ typedef enum _meshtastic_TelemetrySensorType { /* Sensirion High accuracy temperature and humidity */ meshtastic_TelemetrySensorType_SHT4X = 17, /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ - meshtastic_TelemetrySensorType_VEML7700 = 18 + meshtastic_TelemetrySensorType_VEML7700 = 18, + /* MLX90632 non-contact IR temperature sensor. */ + meshtastic_TelemetrySensorType_MLX90632 = 19, + /* TI OPT3001 Ambient Light Sensor */ + meshtastic_TelemetrySensorType_OPT3001 = 20, + /* Lite On LTR-390UV-01 UV Light Sensor */ + meshtastic_TelemetrySensorType_LTR390UV = 21, + /* AMS TSL25911FN RGB Light Sensor */ + meshtastic_TelemetrySensorType_TSL25911FN = 22 } meshtastic_TelemetrySensorType; /* Struct definitions */ From 53dea44983bf1a2ee9bec096b2f3cf74167ffe3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 01:08:52 +0200 Subject: [PATCH 18/21] Revert "Merge pull request #3898 from meshtastic/create-pull-request/patch" This reverts commit 938aba481a9faed90aae4ddac636513dc7d594ff, reversing changes made to 7810e59b0c3fe392c75ed6222558d1d12a1dc201. --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 32 +++++--------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/protobufs b/protobufs index bee9ddc71..1bfe0354d 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit bee9ddc71677e974568a5a95362d78acac6bb974 +Subproject commit 1bfe0354d101a6a71ea1354ea158e59193671a0b diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 7748dd6b3..b6b08f2e7 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -47,17 +47,7 @@ typedef enum _meshtastic_TelemetrySensorType { /* RCWL-9620 Doppler Radar Distance Sensor, used for water level detection */ meshtastic_TelemetrySensorType_RCWL9620 = 16, /* Sensirion High accuracy temperature and humidity */ - meshtastic_TelemetrySensorType_SHT4X = 17, - /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ - meshtastic_TelemetrySensorType_VEML7700 = 18, - /* MLX90632 non-contact IR temperature sensor. */ - meshtastic_TelemetrySensorType_MLX90632 = 19, - /* TI OPT3001 Ambient Light Sensor */ - meshtastic_TelemetrySensorType_OPT3001 = 20, - /* Lite On LTR-390UV-01 UV Light Sensor */ - meshtastic_TelemetrySensorType_LTR390UV = 21, - /* AMS TSL25911FN RGB Light Sensor */ - meshtastic_TelemetrySensorType_TSL25911FN = 22 + meshtastic_TelemetrySensorType_SHT4X = 17 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -94,10 +84,6 @@ typedef struct _meshtastic_EnvironmentMetrics { uint16_t iaq; /* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. */ float distance; - /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ - float lux; - /* VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. */ - float white_lux; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -168,8 +154,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_TSL25911FN -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_TSL25911FN+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SHT4X +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SHT4X+1)) @@ -179,12 +165,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -203,8 +189,6 @@ extern "C" { #define meshtastic_EnvironmentMetrics_current_tag 6 #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 -#define meshtastic_EnvironmentMetrics_lux_tag 9 -#define meshtastic_EnvironmentMetrics_white_lux_tag 10 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -247,9 +231,7 @@ X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ -X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ -X(a, STATIC, SINGULAR, FLOAT, lux, 9) \ -X(a, STATIC, SINGULAR, FLOAT, white_lux, 10) +X(a, STATIC, SINGULAR, FLOAT, distance, 8) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -309,7 +291,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 49 +#define meshtastic_EnvironmentMetrics_size 39 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 From fe2356ae871afd3c8b2c5399e55cd37a423ed5c9 Mon Sep 17 00:00:00 2001 From: caveman99 <25002+caveman99@users.noreply.github.com> Date: Wed, 15 May 2024 23:12:12 +0000 Subject: [PATCH 19/21] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 32 +++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/protobufs b/protobufs index 1bfe0354d..bee9ddc71 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 1bfe0354d101a6a71ea1354ea158e59193671a0b +Subproject commit bee9ddc71677e974568a5a95362d78acac6bb974 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index b6b08f2e7..7748dd6b3 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -47,7 +47,17 @@ typedef enum _meshtastic_TelemetrySensorType { /* RCWL-9620 Doppler Radar Distance Sensor, used for water level detection */ meshtastic_TelemetrySensorType_RCWL9620 = 16, /* Sensirion High accuracy temperature and humidity */ - meshtastic_TelemetrySensorType_SHT4X = 17 + meshtastic_TelemetrySensorType_SHT4X = 17, + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ + meshtastic_TelemetrySensorType_VEML7700 = 18, + /* MLX90632 non-contact IR temperature sensor. */ + meshtastic_TelemetrySensorType_MLX90632 = 19, + /* TI OPT3001 Ambient Light Sensor */ + meshtastic_TelemetrySensorType_OPT3001 = 20, + /* Lite On LTR-390UV-01 UV Light Sensor */ + meshtastic_TelemetrySensorType_LTR390UV = 21, + /* AMS TSL25911FN RGB Light Sensor */ + meshtastic_TelemetrySensorType_TSL25911FN = 22 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -84,6 +94,10 @@ typedef struct _meshtastic_EnvironmentMetrics { uint16_t iaq; /* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. */ float distance; + /* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. */ + float lux; + /* VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. */ + float white_lux; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -154,8 +168,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SHT4X -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SHT4X+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_TSL25911FN +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_TSL25911FN+1)) @@ -165,12 +179,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0, 0} -#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_PowerMetrics_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_AirQualityMetrics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -189,6 +203,8 @@ extern "C" { #define meshtastic_EnvironmentMetrics_current_tag 6 #define meshtastic_EnvironmentMetrics_iaq_tag 7 #define meshtastic_EnvironmentMetrics_distance_tag 8 +#define meshtastic_EnvironmentMetrics_lux_tag 9 +#define meshtastic_EnvironmentMetrics_white_lux_tag 10 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -231,7 +247,9 @@ X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) \ X(a, STATIC, SINGULAR, UINT32, iaq, 7) \ -X(a, STATIC, SINGULAR, FLOAT, distance, 8) +X(a, STATIC, SINGULAR, FLOAT, distance, 8) \ +X(a, STATIC, SINGULAR, FLOAT, lux, 9) \ +X(a, STATIC, SINGULAR, FLOAT, white_lux, 10) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -291,7 +309,7 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 39 +#define meshtastic_EnvironmentMetrics_size 49 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 79 From 0c9eadc507de3790525cbaf895632ff957970a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 16 May 2024 01:16:05 +0200 Subject: [PATCH 20/21] Resync --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index eade2c6be..bee9ddc71 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 +Subproject commit bee9ddc71677e974568a5a95362d78acac6bb974 From c18b4920aedc9a91d39d477b57cefaa662c246ff Mon Sep 17 00:00:00 2001 From: caveman99 <25002+caveman99@users.noreply.github.com> Date: Wed, 15 May 2024 23:28:03 +0000 Subject: [PATCH 21/21] [create-pull-request] automated change --- src/mesh/generated/meshtastic/telemetry.pb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 6c7779710..7748dd6b3 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -168,7 +168,6 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET - #define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_TSL25911FN #define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_TSL25911FN+1)) @@ -178,7 +177,6 @@ extern "C" { - /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0, 0} #define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} @@ -319,4 +317,4 @@ extern const pb_msgdesc_t meshtastic_Telemetry_msg; } /* extern "C" */ #endif -#endif \ No newline at end of file +#endif