drivers: Standardize power on/off method naming.#148
Merged
Conversation
1622f9d to
cb1ebcb
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Standardizes driver power-management APIs across the repository by converging on power_on() / power_off(), and updates scenario tests/docs/examples accordingly to match the new names.
Changes:
- Renamed inconsistent power methods across multiple drivers to
power_on()/power_off(). - Added new
power_on()/power_off()implementations for some drivers and extended mock scenarios to validate behavior. - Updated README + driver READMEs + examples + YAML scenarios to use the standardized names.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new cross-driver power_on() / power_off() convention. |
| lib/apds9960/apds9960/device.py | Renames enable_power() / disable_power() to power_on() / power_off(). |
| lib/bq27441/bq27441/device.py | Renames power_up() / power_down() to power_on() / power_off() and updates ctor call. |
| lib/ism330dl/ism330dl/device.py | Renames power_down() to power_off() and introduces power_on(). |
| lib/ism330dl/README.md | Updates power-down documentation to power_off(). |
| lib/lis2mdl/lis2mdl/device.py | Renames wake() → power_on() and power_down() → power_off(). |
| lib/lis2mdl/examples/magnet_test.py | Updates example calls to new power method names (output text still needs alignment). |
| lib/lis2mdl/README.md | Updates method overview table to power_on() / power_off(). |
| lib/mcp23009e/mcp23009e/device.py | Adds power_on() / power_off() using the RESET pin. |
| lib/ssd1327/ssd1327/device.py | Renames poweron() / poweroff() to power_on() / power_off() and updates internal calls. |
| lib/vl53l1x/vl53l1x/device.py | Adds power_on() / power_off() via the SOFT_RESET register. |
| lib/wsen-hids/wsen_hids/device.py | Adds power_on() / power_off() based on the PD bit behavior. |
| lib/wsen-pads/wsen_pads/device.py | Renames power_down() to power_off() and adds power_on(odr=...). |
| lib/wsen-pads/examples/test.py | Updates example usage to power_off(). |
| tests/scenarios/apds9960.yaml | Updates scenario scripts to call power_off(). |
| tests/scenarios/bq27441.yaml | Updates scenario comments to reflect power_on() constructor behavior. |
| tests/scenarios/hts221.yaml | Renames scenario titles to reference power_off. |
| tests/scenarios/ism330dl.yaml | Updates scenario scripts to call power_off(). |
| tests/scenarios/lis2mdl.yaml | Updates scenario scripts to call power_off(). |
| tests/scenarios/mcp23009e.yaml | Adds mock scenarios validating reset-pin behavior for power_on/off. |
| tests/scenarios/ssd1327.yaml | Adds mock smoke scenarios for power_on/off. |
| tests/scenarios/vl53l1x.yaml | Adds mock scenarios validating SOFT_RESET writes for power_on/off. |
| tests/scenarios/wsen_hids.yaml | Adds mock scenarios validating PD bit changes for power_on/off. |
| tests/scenarios/wsen_pads.yaml | Updates scenario scripts to call power_off(). |
Comments suppressed due to low confidence (3)
lib/lis2mdl/examples/magnet_test.py:529
- This example output string still references
wake('continuous'), but the API has been renamed topower_on('continuous'). Update the printed label to avoid confusing users running the example.
print(
"wake('continuous') => MD=",
md,
"expected 0b00 =>",
"OK" if md == 0b00 else "FAIL",
)
lib/lis2mdl/examples/magnet_test.py:541
- This example output string still references
wake('single'), but the API has been renamed topower_on('single'). Update the printed label to match the new method name.
print(
"wake('single') => MD=",
md,
"expected 0b01 =>",
"OK" if md == 0b01 else "FAIL",
)
lib/lis2mdl/examples/magnet_test.py:572
- This example output string still references
wake('continuous'), but the API has been renamed topower_on('continuous'). Update the printed label to match the new method name.
print(
"wake('continuous') => MD=",
md,
"expected 0b00 =>",
"OK" if md == 0b00 else "FAIL",
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cb1ebcb to
6638f1d
Compare
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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 #76
Summary
Standardize all power on/off methods to
power_on()/power_off().Changes
enable_power()/disable_power()power_on()/power_off()power_up()/power_down()power_on()/power_off()power_on()/power_off()power_down()power_on()/power_off()wake()/power_down()power_on()/power_off()power_on()/power_off()added (via RESET pin)poweron()/poweroff()power_on()/power_off()power_on()/power_off()added (via SOFT_RESET register)power_on()/power_off()added (via PD bit)power_down()power_on()/power_off()Final state
power_on()power_off()Also updated README, tests (8 new mock tests), examples, and driver READMEs.
Test plan