Skip to content

fix: INA226 sensor detection#10365

Open
Krokodilushka wants to merge 1 commit into
meshtastic:developfrom
Krokodilushka:fix-ina226-detection
Open

fix: INA226 sensor detection#10365
Krokodilushka wants to merge 1 commit into
meshtastic:developfrom
Krokodilushka:fix-ina226-detection

Conversation

@Krokodilushka
Copy link
Copy Markdown

Problem

The firmware attempted to read data from an INA226 power sensor as if it were an INA219. Due to an incorrect conditional, any supported INA* sensor was incorrectly identified as an INA219.

Related logs:

INFO  | ??:??:?? 0 Scan for i2c devices
DEBUG | ??:??:?? 0 Scan for I2C devices on port 1
DEBUG | ??:??:?? 0 Register value from 0x40: 0x5449
DEBUG | ??:??:?? 0 Register MFG_UID: 0x5449
DEBUG | ??:??:?? 0 Register value from 0x40: 0x2260
DEBUG | ??:??:?? 0 Register DIE_UID: 0x2260
INFO  | ??:??:?? 0 INA226 found at address 0x40
INFO  | ??:??:?? 0 INA219 found at address 0x40
INFO  | ??:??:?? 0 Device found at address 0x47 was not able to be enumerated
INFO  | ??:??:?? 0 1 I2C devices found

Fix

Fixed the incorrect conditional used for sensor detection.

Hardware

ESP32-C6 + E22900M30S + INA226 + BMP580

@github-actions github-actions Bot added the bugfix Pull request that fixes bugs label May 1, 2026
@thebentern thebentern requested review from Copilot and oscgonfer May 1, 2026 11:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes INA226 I2C detection in the device scanner so an INA226 at the shared INA/SHT2x address range is not subsequently misclassified as INA219, preventing incorrect sensor driver selection in telemetry.

Changes:

  • Corrects the fallback conditional so “assume INA219” only runs when no INA226/INA260/SHT2x match has been detected.

Comment on lines +447 to +452
if (detectSHT21SerialNumber(i2cBus, (uint8_t)addr.address)) {
logFoundDevice("SHTXX (SHT2X)", (uint8_t)addr.address);
type = SHTXX;
} else
#endif
else { // Assume INA219 if none of the above ones are found
logFoundDevice("INA219", (uint8_t)addr.address);
type = INA219;
{ // Assume INA219 if none of the above ones are found
@oscgonfer
Copy link
Copy Markdown
Contributor

Note to self: check with #10482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants