drivers: Make status() private across all sensor drivers.#157
Merged
nedseb merged 1 commit intofix/standardize-statusfrom Mar 15, 2026
Merged
drivers: Make status() private across all sensor drivers.#157nedseb merged 1 commit intofix/standardize-statusfrom
nedseb merged 1 commit intofix/standardize-statusfrom
Conversation
This was
linked to
issues
Mar 15, 2026
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes how several sensor drivers expose the “status register” read helper by renaming status() to _status(), updating YAML scenario tests and examples accordingly, and updating the repo-level Driver API conventions in README.md.
Changes:
- Renames
status()→_status()across multiple drivers and updates internal callers (data_ready(),<measurement>_ready()). - Updates scenario YAMLs to call
_statusinstead ofstatus. - Updates examples and the top-level README’s Driver API conventions to reference
_status().
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scenarios/wsen_pads.yaml | Scenario now calls _status instead of status. |
| tests/scenarios/wsen_hids.yaml | Scenario now calls _status instead of status. |
| tests/scenarios/lis2mdl.yaml | Scenario now calls _status instead of status. |
| tests/scenarios/ism330dl.yaml | Scenario script/call now uses _status. |
| tests/scenarios/hts221.yaml | Scenario now calls _status instead of status. |
| README.md | Driver API convention updated to _status() as the status helper. |
| lib/wsen-pads/wsen_pads/device.py | Renames public status() to _status() and updates ready helpers to use it. |
| lib/wsen-pads/examples/test.py | Example now calls _status() where it previously called status(). |
| lib/wsen-hids/wsen_hids/device.py | Renames public status() to _status() and updates ready helpers to use it. |
| lib/wsen-hids/examples/full_test.py | Example now calls _status() where it previously called status(). |
| lib/lis2mdl/lis2mdl/device.py | Renames public status() to _status() and updates callers. |
| lib/lis2mdl/examples/magnet_test.py | Example now calls _status() where it previously called status(). |
| lib/ism330dl/ism330dl/device.py | Renames status() to _status() (currently returns a parsed dict). |
| lib/hts221/hts221/device.py | Renames status() to _status() and updates callers. |
| lib/apds9960/apds9960/device.py | Renames status() to _status(). |
Comments suppressed due to low confidence (2)
lib/apds9960/apds9960/device.py:89
- Renaming
status()to_status()is a breaking change for APDS9960 users. Suggest keepingstatus()as a public alias that calls_status()so downstream code doesn’t unexpectedly fail.
def device_id(self):
return self.dev_id
def _status(self):
return self._read_reg(APDS9960_REG_STATUS)
def data_ready(self):
return self.light_ready() and self.proximity_ready()
lib/ism330dl/ism330dl/device.py:260
- Per the updated repo API guidance,
_status()is supposed to be the raw status register value, but here it returns a parsed dict of ready flags. Either adjust_status()to return the rawREG_STATUS_REGbyte and add a separate public helper for the parsed flags, or keep this method public asstatus()and reserve_status()for raw reads for consistency across drivers.
def _status(self):
s = self._read_u8(REG_STATUS_REG)
return {
"temp_ready": bool(s & STATUS_TDA),
"gyro_ready": bool(s & STATUS_GDA),
"accel_ready": bool(s & STATUS_XLDA),
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
afba75e to
57933d6
Compare
dfa6a85 to
5f8f405
Compare
5f8f405 to
6e0fe68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #150, #151, #152, #153, #154, #155
Summary
Rename
status()→_status()in 6 sensor drivers. The raw status register is an implementation detail — users should usedata_ready()and*_ready()methods instead.status()→_status()status()→_status()status()→_status()status()→_status()status()→_status()status()→_status()BQ27441
status()handled separately in #156 (different semantics).Also updated all internal callers, tests, examples, and README.
Test plan