Skip to content

drivers: Replace deprecated utime imports with time.#64

Merged
nedseb merged 2 commits intomainfrom
fix/replace-utime-imports
Mar 12, 2026
Merged

drivers: Replace deprecated utime imports with time.#64
nedseb merged 2 commits intomainfrom
fix/replace-utime-imports

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 12, 2026

Summary

  • wsen-pads: from utime import sleep_ms, ticks_ms, ticks_difffrom time import sleep_ms, ticks_ms, ticks_diff
  • apds9960: from 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 check passes
  • All mock tests pass (pytest tests/ -k mock — 41 passed)
  • Hardware test: verify wsen-pads and apds9960 still work correctly on the board

@nedseb nedseb requested review from Charly-sketch and Copilot March 12, 2026 21:18
@nedseb nedseb self-assigned this Mar 12, 2026
@nedseb nedseb added the enhancement New feature or request label Mar 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 utime to time.
  • Update APDS9960 driver to use sleep_ms() instead of sleep() for FIFO pause delays.
  • Convert APDS9960_TIME_FIFO_PAUSE from float seconds to integer milliseconds to match sleep_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.

Comment thread lib/apds9960/apds9960/const.py Outdated
@@ -10,7 +10,7 @@
APDS9960_DEV_ID = [0xAB, 0x9C, 0xA8, -0x55]

# APDS9960 times
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# APDS9960 times
# APDS9960 times (FIFO pause in milliseconds)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment to clarify units are milliseconds (commit 42c08a6).

@nedseb nedseb closed this Mar 12, 2026
@nedseb nedseb reopened this Mar 12, 2026
@nedseb nedseb merged commit 4225c7b into main Mar 12, 2026
6 checks passed
@nedseb nedseb deleted the fix/replace-utime-imports branch March 12, 2026 21:23
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drivers: Replace deprecated utime imports with time.

2 participants