From ba9cadc14da1de00b36c5ed8a895306ae43160d6 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 24 Apr 2026 06:09:37 +0300 Subject: [PATCH 1/2] Fix INA226 detection for non-TI compatible chip (Silergy) (#10247) * Fix INA226 detection for non-TI compatible chip (Silergy) * Removed extra I2C transaction + 20ms delay on every scan of address 0x40 (including real SHT2x sensors). Changes suggested by Copilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Apply formatting (trunk fmt) --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/detect/ScanI2CTwoWire.cpp | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index e298663a0..e3471c32a 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -415,30 +415,45 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) #if !defined(M5STACK_UNITC6L) case INA_ADDR: // Same as SHT2X case INA_ADDR_ALTERNATE: - case INA_ADDR_WAVESHARE_UPS: - registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2); - LOG_DEBUG("Register MFG_UID: 0x%x", registerValue); - if (registerValue == 0x5449) { - registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 2); - LOG_DEBUG("Register DIE_UID: 0x%x", registerValue); + case INA_ADDR_WAVESHARE_UPS: { + uint16_t mfg = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2); - if (registerValue == 0x2260) { + LOG_DEBUG("Register MFG_UID: 0x%x", mfg); + + // Only read DIE_UID for vendors we recognize as INA-compatible to avoid + // an extra I2C transaction + delay on other devices sharing this address. + if (mfg == 0x5449 || mfg == 0x190F) { + uint16_t die = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 2); + LOG_DEBUG("Register DIE_UID: 0x%x", die); + + // TI INA226 or fully compatible clones (e.g. TPA626) + if (mfg == 0x5449 && die == 0x2260) { logFoundDevice("INA226", (uint8_t)addr.address); type = INA226; - } else { + } + // Silergy SQ52201 (INA226-compatible with different IDs) + else if (mfg == 0x190F && die == 0x0000) { + logFoundDevice("INA226 (SQ52201)", (uint8_t)addr.address); + type = INA226; + } + // TI INA260 + else if (mfg == 0x5449) { logFoundDevice("INA260", (uint8_t)addr.address); type = INA260; } + } #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR - } else if (detectSHT21SerialNumber(i2cBus, (uint8_t)addr.address)) { + if (type == NONE && detectSHT21SerialNumber(i2cBus, (uint8_t)addr.address)) { logFoundDevice("SHTXX (SHT2X)", (uint8_t)addr.address); type = SHTXX; + } #endif - } else { // Assume INA219 if none of the above ones are found + else { // Assume INA219 if none of the above ones are found logFoundDevice("INA219", (uint8_t)addr.address); type = INA219; } break; + } case INA3221_ADDR: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2); LOG_DEBUG("Register MFG_UID FE: 0x%x", registerValue); From 7adfc3f992fb3fa3d7a4cee1470d9eeff838db44 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 24 Apr 2026 00:17:33 -0500 Subject: [PATCH 2/2] Remove incorrect LED_STATE_ON definition for t-beam-s3 (#10280) Fixes #9912 and #10170 --- variants/esp32s3/tbeam-s3-core/variant.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/variants/esp32s3/tbeam-s3-core/variant.h b/variants/esp32s3/tbeam-s3-core/variant.h index 9ce4aade9..2637e7f78 100644 --- a/variants/esp32s3/tbeam-s3-core/variant.h +++ b/variants/esp32s3/tbeam-s3-core/variant.h @@ -9,8 +9,6 @@ #define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3 // #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module. -#define LED_STATE_ON 0 // State when LED is lit - // TTGO uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if // not found then probe for SX1262 #define USE_SX1262 @@ -76,4 +74,4 @@ // has 32768 Hz crystal #define HAS_32768HZ 1 -#define USE_SH1106 \ No newline at end of file +#define USE_SH1106