drivers: Replace deprecated utime imports with time.#64
Conversation
There was a problem hiding this comment.
Pull request overview
Updates MicroPython driver timing imports/usages to avoid deprecated utime and to prefer millisecond-based sleeps for consistency with the codebase’s MicroPython conventions.
Changes:
- Switch WSEN-PADS driver timing imports from
utimetotime. - Update APDS9960 driver to use
sleep_ms()instead ofsleep()for FIFO pause delays. - Convert
APDS9960_TIME_FIFO_PAUSEfrom float seconds to integer milliseconds to matchsleep_ms().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/wsen-pads/wsen_pads/device.py | Replaces deprecated utime timing imports with time equivalents. |
| lib/apds9960/apds9960/device.py | Uses sleep_ms() for FIFO pause delays instead of sleep() with a float. |
| lib/apds9960/apds9960/const.py | Updates FIFO pause constant to milliseconds to align with sleep_ms() usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -10,7 +10,7 @@ | |||
| APDS9960_DEV_ID = [0xAB, 0x9C, 0xA8, -0x55] | |||
|
|
|||
| # APDS9960 times | |||
There was a problem hiding this comment.
APDS9960_TIME_FIFO_PAUSE changed from a float seconds value to an integer milliseconds value (now passed to sleep_ms). To avoid unit confusion, please update the constant name (e.g., suffix _MS) or adjust the nearby comment to explicitly state the units are milliseconds.
| # APDS9960 times | |
| # APDS9960 times (FIFO pause in milliseconds) |
There was a problem hiding this comment.
Updated the comment to clarify units are milliseconds (commit 42c08a6).
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
from utime import sleep_ms, ticks_ms, ticks_diff→from time import sleep_ms, ticks_ms, ticks_difffrom time import sleep+sleep(0.03)→from time import sleep_ms+sleep_ms(30)(constant updated from float seconds to integer milliseconds)Closes #57
Test plan
ruff checkpassespytest tests/ -k mock— 41 passed)