mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-04 08:52:28 +02:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user