drivers: Standardize continuous and one-shot mode method naming.#163
drivers: Standardize continuous and one-shot mode method naming.#163
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58f4d3b543
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
58f4d3b to
e434a59
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e434a59f63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e434a59 to
d93ab6c
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes driver APIs for continuous vs one-shot measurement modes by converging on a common set of method names (set_continuous, trigger_one_shot, read_one_shot) across multiple sensor drivers, and updates related docs/examples/tests accordingly.
Changes:
- Renames WSEN-HIDS continuous-mode entrypoint to
set_continuous(odr)and updates its examples. - Adds standardized continuous/one-shot helpers to HTS221 and LIS2MDL drivers.
- Extends YAML scenario tests and updates the root README to document the new “mode methods” convention.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scenarios/wsen_hids.yaml | Adds scenario coverage for set_continuous() enabling the sensor. |
| tests/scenarios/lis2mdl.yaml | Adds scenarios validating continuous/one-shot helpers are callable and write expected registers. |
| tests/scenarios/hts221.yaml | Adds scenarios for set_continuous() enabling sensor and read_one_shot() return types. |
| lib/wsen-hids/wsen_hids/device.py | Renames set_continuous_mode() to set_continuous(). |
| lib/wsen-hids/examples/full_test.py | Updates example usage/output strings to new method name. |
| lib/wsen-hids/examples/continuous_mode.py | Updates example usage to set_continuous(). |
| lib/lis2mdl/lis2mdl/device.py | Adds set_continuous(), trigger_one_shot(), read_one_shot(). |
| lib/hts221/hts221/device.py | Adds set_continuous() and read_one_shot(). |
| README.md | Documents standardized mode-method naming convention. |
Comments suppressed due to low confidence (1)
lib/wsen-hids/wsen_hids/device.py:193
set_continuous_mode()was renamed toset_continuous(), which is a breaking public API change. Consider keepingset_continuous_modeas a deprecated alias that forwards toset_continuous(at least for one release) to avoid breaking existing users and downstream examples/docs.
def set_continuous(self, odr=ODR_1_HZ):
if odr not in (ODR_1_HZ, ODR_7_HZ, ODR_12_5_HZ):
raise ValueError("Invalid ODR for continuous mode")
ctrl1 = self._read_reg(REG_CTRL_1)
ctrl1 |= CTRL_1_PD
ctrl1 &= ~CTRL_1_ODR_MASK
ctrl1 |= odr
self._write_reg(REG_CTRL_1, ctrl1)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d93ab6c0fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d93ab6c to
bf57b26
Compare
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes #81
Summary
Standardize continuous/one-shot mode methods across all drivers.
Convention:
set_continuous(odr)— start continuous measurements at given ratetrigger_one_shot()— trigger a single conversionread_one_shot()— trigger + wait + return dataChanges
set_continuous_mode(odr)set_continuous(odr)set_odr()onlyset_continuous(odr),read_one_shot()set_mode("continuous")onlyset_continuous(hz),trigger_one_shot(),read_one_shot()Final state
set_continuous()trigger_one_shot()read_one_shot()Not applicable to ISM330DL (always continuous), APDS9960 (enable/disable model), VL53L1X (start/stop ranging), BQ27441/MCP23009E/SSD1327 (no conversion modes).
Also updated README and examples.
Test plan