Skip to content

Feature/wiring#13

Draft
khlam wants to merge 13 commits into
mainfrom
feature/wiring
Draft

Feature/wiring#13
khlam wants to merge 13 commits into
mainfrom
feature/wiring

Conversation

@khlam

@khlam khlam commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Overview

This PR consolidates all MicroPython I²C driver packages (i2c_bus, atgm336h, mpu6050, qmc5883p, vl53l0x, vl53l5cx) by removing chip-specific backend files (esp32s3.py, rp2040.py, rp2350.py) and unifying them under a single __init__.py per package. All dependent projects (compass, distance-stream, gps, gyro-stream, multizone-ranging) are updated to use the new unified driver API, with tests refactored accordingly.

What's New

  • Comprehensive chip-specific file removal across 6 firmware packages, consolidating ESP32-S3, RP2040, and RP2350 implementations into unified __init__.py modules.
  • New micropython_stubs/machine.py stubs expanded (+51 lines) to support host-side testing of the refactored drivers.
  • New test coverage for multizone-ranging project (test_full_import.py, test_init_sensor.py).
  • Updated README files for atgm336h, i2c_bus, distance-stream, gps, gyro-stream, and multizone-ranging packages/projects.

What Has Changed

  • i2c_bus: Chip-specific backends removed (esp32s3.py, rp2040.py, rp2350.py); __init__.py unified (+76/- lines); tests simplified with shared conftest.
  • atgm336h (GPS): Chip-specific files removed; driver logic consolidated in __init__.py; test suite refactored with fake_uart removal.
  • mpu6050 (IMU): Driver unified under __init__.py (+39 lines); tests updated for new API.
  • qmc5883p (Magnetometer): Driver unified under __init__.py; tests updated.
  • vl53l0x (ToF): Driver unified under __init__.py (+41 lines); tests updated.
  • vl53l5cx (ToF): Driver unified under __init__.py (+39 lines); new conftest and test additions.
  • manifest.py: Updated to reflect package structure changes.
  • Projects (compass, distance-stream, gps, gyro-stream, multizone-ranging): Firmware main.py updated to use consolidated driver APIs; tests refactored with simplified conftest fixtures; READMEs updated.
  • cpython-packages/micropython_stubs: machine.py stubs expanded to support host-side testing of refactored drivers.

What's Fixed

  • Eliminated code duplication across chip-specific driver implementations (6 packages × 3 chips = ~18 files consolidated).
  • Simplified test fixtures by removing redundant chip-dispatch logic in conftest files.
  • Removed unused fake_uart.py from atgm336h tests, reducing test maintenance burden.

Testing

  • All firmware package tests updated: i2c_bus, atgm336h, mpu6050, qmc5883p, vl53l0x, vl53l5cx.
  • All project tests updated: compass, distance-stream, gps, gyro-stream, multizone-ranging (new).
  • Run with: docker compose up pytest --build --exit-code-from pytest (all) or target specific paths.

Additional Information

  • 55 files changed: +1,071 / -878 lines — net reduction of ~200 lines despite new test coverage.
  • The refactoring follows the existing backend-dispatch pattern established by boot_status_led.
  • No functional behavior changes to drivers — only structural consolidation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant