-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Category
Other
Hardware
Other
Is this bug report about any UI component firmware like InkHUD or Meshtatic UI (MUI)?
- Meshtastic UI aka MUI colorTFT
- InkHUD ePaper
- OLED slide UI on any display
Firmware Version
2.7.20.66858ec2
Description
Summary
When using an SHT31 sensor on I2C address 0x44, the firmware incorrectly detects it as an SHT4x device. This results in failed initialization and the sensor being removed from the telemetry system, even though the hardware is functioning correctly.
Environment
- Device: Elecrow ThinkNode M6
- Firmware: 2.7.20 (alpha, with recently added ThinkNode M6 support)
- Sensor: SHT31 (I2C @ 0x44)
Observed Behavior
Boot log shows:
Register value from 0x44: 0x0
SHT4X found at address 0x44
...
Can't connect to detected SHT4X sensor. Remove from nodeTelemetrySensorsMap
- Sensor is detected at the correct address
- Identified as SHT4x
- Initialization fails
- Sensor is removed and no telemetry is reported
Expected Behavior
- Sensor should be identified as SHT31
- Environmental telemetry should initialize successfully
- Temperature / humidity data should be reported
Root Cause Analysis
Detection logic in ScanI2CTwoWire::scanPort():
else if (i2cCommandResponseLength(addr, 0x89, 6)) {
type = SHT4X;
} else {
type = SHT31;
}The function i2cCommandResponseLength():
- Only checks if the device returns the expected number of bytes
- Does not validate response content or CRC
This allows SHT31 devices to:
- ACK the command
- Return data of matching length
- Be falsely classified as SHT4x
Result:
- Incorrect driver selected
- Initialization fails
- Sensor discarded
Workaround
Force SHT31 detection by bypassing SHT4x probe:
case SHT31_4x_ADDR:
case SHT31_4x_ADDR_ALT:
type = SHT31;
logFoundDevice("SHT31", (uint8_t)addr.address);
break;After this change:
- Sensor initializes correctly
- Telemetry works as expected
Option 3 (most robust)
Avoid heuristic detection entirely:
- Attempt initialization for both sensor types
- Use whichever succeeds
Notes
- SHT31 and SHT4x share the same I2C address (0x44), so detection must be robust
- Current implementation can produce false positives in real-world setups
- This issue may affect other users with mixed or legacy Sensirion sensors
Relevant log output
//\ E S H T /\ S T / C DEBUG | ??:??:?? 3 Filesystem files: DEBUG | ??:??:?? 3 adafruit (directory) DEBUG | ??:??:?? 3 bond_prph (directory) DEBUG | ??:??:?? 3 bond_cntr (directory) DEBUG | ??:??:?? 3 prefs (directory) DEBUG | ??:??:?? 3 transmit_history.dat (18 Bytes) DEBUG | ??:??:?? 3 config.proto (246 Bytes) DEBUG | ??:??:?? 3 module.proto (121 Bytes) DEBUG | ??:??:?? 3 channels.proto (114 Bytes) DEBUG | ??:??:?? 3 device.proto (282 Bytes) DEBUG | ??:??:?? 3 nodes.proto (7145 Bytes) DEBUG | ??:??:?? 3 Messages_default.msgs (1 Bytes) DEBUG | ??:??:?? 3 Power::max17048Init lipo sensor is not ready yet DEBUG | ??:??:?? 3 Use analog input 28 for battery level INFO | ??:??:?? 3 Scan for i2c devices DEBUG | ??:??:?? 3 Scan for I2C devices on port 1 DEBUG | ??:??:?? 3 Register value from 0x44: 0x0 INFO | ??:??:?? 3 SHT4X found at address 0x44 INFO | ??:??:?? 3 PCF8563 found at address 0x51 INFO | ??:??:?? 3 2 I2C devices found DEBUG | ??:??:?? 3 acc_info = 0 INFO | ??:??:?? 3 S:B:120,2.7.20.016e68e,thinknode_m6,meshtastic/firmware INFO | ??:??:?? 3 Build timestamp: 1774249200 DEBUG | ??:??:?? 3 Reset reason: 0x0 DEBUG | ??:??:?? 3 Set random seed 3964916179 INFO | ??:??:?? 3 Init NodeDB INFO | ??:??:?? 3 Load /prefs/nodes.proto INFO | ??:??:?? 3 Loaded /prefs/nodes.proto successfully INFO | ??:??:?? 3 Loaded saved nodedatabase version 24, with nodes count: 76 INFO | ??:??:?? 3 Load /prefs/device.proto INFO | ??:??:?? 3 Loaded /prefs/device.proto successfully INFO | ??:??:?? 3 Loaded saved devicestate version 24 INFO | ??:??:?? 3 Load /prefs/config.proto INFO | ??:??:?? 3 Loaded /prefs/config.proto successfully INFO | ??:??:?? 4 Loaded saved config version 24 INFO | ??:??:?? 4 Load /prefs/module.proto INFO | ??:??:?? 4 Loaded /prefs/module.proto successfully INFO | ??:??:?? 4 Loaded saved moduleConfig version 24 INFO | ??:??:?? 4 Load /prefs/channels.proto INFO | ??:??:?? 4 Loaded /prefs/channels.proto successfully INFO | ??:??:?? 4 Loaded saved channelFile version 24 ERROR | ??:??:?? 4 Could not open / read /prefs/uiconfig.proto DEBUG | ??:??:?? 4 cleanupMeshDB purged 10 entries DEBUG | ??:??:?? 4 Use nodenum 0x3aacca58 DEBUG | ??:??:?? 4 Expand short PSK #1 INFO | ??:??:?? 4 Wanted region 1, using US DEBUG | ??:??:?? 4 Coerce telemetry to min of 30 minutes on defaults DEBUG | ??:??:?? 4 Coerce position broadcasts to min of 1 hour and smart broadcast min of 5 minutes on defaults INFO | ??:??:?? 4 Sort took 0 milliseconds DEBUG | ??:??:?? 4 Save to disk 0 INFO | ??:??:?? 4 TransmitHistory: loaded 2 entries from disk WARN | ??:??:?? 4 Packet History - Invalid size -1, using default 160 DEBUG | ??:??:?? 4 Use compiled/slipstreamed tzplaceholder DEBUG | ??:??:?? 4 Saved TZ: PST8PDT,M3.2.0,M11.1.0 DEBUG | ??:??:?? 4 Set Timezone to PST8PDT,M3.2.0,M11.1.0 INFO | ??:??:?? 4 GPS power state move from OFF to ACTIVE DEBUG | ??:??:?? 4 Use GPIO3 for GPS RX DEBUG | ??:??:?? 4 Use GPIO2 for GPS TX ERROR | ??:??:?? 4 Could not open / read /prefs/cannedConf.proto INFO | ??:??:?? 4 CannedMessageModule is enabled ERROR | ??:??:?? 4 Could not open / read /prefs/ringtone.proto INFO | ??:??:?? 4 Init External Notification Module INFO | ??:??:?? 4 Use Pin 7 in digital mode INFO | ??:??:?? 4 Environment Telemetry adding I2C devices... INFO | ??:??:?? 4 Init sensor: SHT4X DEBUG | ??:??:?? 4 Error trying to execute readSerial(): WARN | ??:??:?? 4 Can't connect to detected SHT4X sensor. Remove from nodeTelemetrySensorsMap DEBUG | ??:??:?? 4 Rescan for I2C keyboard DEBUG | ??:??:?? 4 Scan for I2C devices on port 1 DEBUG | ??:??:?? 4 Scan address 0x1f DEBUG | ??:??:?? 4 Scan address 0x34 DEBUG | ??:??:?? 4 Scan address 0x55 DEBUG | ??:??:?? 4 Scan address 0x5a DEBUG | ??:??:?? 4 Scan address 0x5f DEBUG | ??:??:?? 4 SX126xInterface(cs=44, irq=38, rst=42, busy=43) DEBUG | ??:??:?? 4 SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at 3.300000 V INFO | ??:??:?? 4 Start meshradio init INFO | ??:??:?? 4 Radio freq=906.875, config.lora.frequency_offset=0.000 INFO | ??:??:?? 4 Set radio: region=US, name=LongFast, config=0, ch=19, power=30 INFO | ??:??:?? 4 myRegion->freqStart -> myRegion->freqEnd: 902.000000 -> 928.000000 (26.000000 MHz) INFO | ??:??:?? 4 numChannels: 104 x 250.000kHz INFO | ??:??:?? 4 channel_num: 20 INFO | ??:??:?? 4 frequency: 906.875000 INFO | ??:??:?? 4 Slot time: 28 msec, preamble time: 131 msec INFO | ??:??:?? 4 Final Tx power: 22 dBm INFO | ??:??:?? 4 SX126x init result 0 INFO | ??:??:?? 4 Frequency set to 906.875000 INFO | ??:??:?? 4 Bandwidth set to 250.000000 INFO | ??:??:?? 4 Power output set to 22 ...Reactions are currently unavailable