Skip to content

hts221: Add data ready polling in _ensure_data() for consistency. #127

Description

@nedseb

Context

Part of the auto-trigger consistency harmonization (#44).

The HTS221 _ensure_data() calls trigger_one_shot() which uses a fixed sleep_ms(15) without polling the STATUS register for data ready or raising on timeout. While the fixed delay works because the datasheet guarantees the conversion time, it is inconsistent with the pattern used by WSEN-HIDS, LIS2MDL, VL53L1X, and APDS9960 which all poll for data ready and raise on timeout.

Current behavior

def trigger_one_shot(self):
    # ... configure one-shot ...
    sleep_ms(15)

def _ensure_data(self):
    if self._is_power_down() or self._is_one_shot_mode():
        self.trigger_one_shot()

Expected behavior

Add polling of STATUS register after trigger_one_shot() with a bounded timeout, and raise OSError if data never becomes ready. This provides a consistent safety net across all drivers.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdriverConcerne un driver spécifiquereleased

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions