fix(ens210): check correct VALID bit in T_VAL/H_VAL polling

Bit 0 of byte 2 is the T_VALID/H_VALID flag (datasheet Figure 32/33,
page 23 example: t_valid = (t_val>>16) & 0x1). The previous code checked
bit 1 (CRC LSB), which caused sporadic timeouts when the CRC happened to
have a 0 in that position.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Joshua Mesilane
2026-05-13 17:07:28 +10:00
parent 7865e9cb4b
commit a01d59381b
+1 -1
View File
@@ -84,7 +84,7 @@ class ENS210Sensor(SensorBase):
time.sleep(self._poll_interval)
t_data = bus.read_i2c_block_data(self.i2c_address, _REG_T_VAL, 3)
h_data = bus.read_i2c_block_data(self.i2c_address, _REG_H_VAL, 3)
if ((t_data[2] >> 1) & 0x01) and ((h_data[2] >> 1) & 0x01):
if (t_data[2] & 0x01) and (h_data[2] & 0x01):
break
else:
raise RuntimeError(