From 284598ed5643cf139d8cfa092219dfb498371d55 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 7 Mar 2025 18:51:38 +0800 Subject: [PATCH] Add detection support for LTR390UV Sensor (#6009) * Add detection support for LTR390UV Sensor The LTR390 is a UV sensor. This patch adds detection support, for a future patch that will add the full sensor support. * Update ScanI2C.h --- src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/main.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/src/configuration.h b/src/configuration.h index a9717a637..fd4a5b196 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -151,6 +151,7 @@ along with this program. If not, see . #define MAX30102_ADDR 0x57 #define MLX90614_ADDR_DEF 0x5A #define CGRADSENS_ADDR 0x66 +#define LTR390UV_ADDR 0x53 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 6828169a8..5b6bbe629 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -68,6 +68,7 @@ class ScanI2C NXP_SE050, DFROBOT_RAIN, DPS310, + LTR390UV, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index ab8b05411..8b779277d 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -427,6 +427,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address); + SCAN_SIMPLE_CASE(LTR390UV_ADDR, LTR390UV, "LTR390UV", (uint8_t)addr.address); #ifdef HAS_TPS65233 SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address); #endif diff --git a/src/main.cpp b/src/main.cpp index e5e1a2537..6b8089eaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -641,6 +641,7 @@ void setup() scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::MAX30102, meshtastic_TelemetrySensorType_MAX30102); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::CGRADSENS, meshtastic_TelemetrySensorType_RADSENS); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DFROBOT_RAIN, meshtastic_TelemetrySensorType_DFROBOT_RAIN); + scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::LTR390UV, meshtastic_TelemetrySensorType_LTR390UV); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DPS310, meshtastic_TelemetrySensorType_DPS310); i2cScanner.reset();