esphome icon indicating copy to clipboard operation
esphome copied to clipboard

Add new component mcp3426 7 8

Open mdop opened this issue 1 year ago • 1 comments

What does this implement/fix?

Adds support for the 4 channel 16 bit ADC chips of the MCP3426/7/8 family. Structure is based on the ADS1115, but the measurement is done asynchronously.

Types of changes

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Other

Related issue or feature (if applicable): fixes -

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3810

Test Environment

  • [x] ESP32
  • [x] ESP32 IDF
  • [x] ESP8266
  • [x] RP2040
  • [ ] BK72xx
  • [ ] RTL87xx

Example entry for config.yaml:

mcp3428:
  address: 0b1101000

sensor:
  - platform: mcp3428
    name: "Channel 1"
    multiplexer: 1
    resolution: 12
    gain: 8
    id: mcp3428_sensor1

Checklist:

  • [x] The code change is tested and works locally.
  • [x] Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

mdop avatar May 03 '24 19:05 mdop

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 53.78%. Comparing base (4d8b5ed) to head (35f6ecb). Report is 922 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6675      +/-   ##
==========================================
+ Coverage   53.70%   53.78%   +0.07%     
==========================================
  Files          50       50              
  Lines        9408     9660     +252     
  Branches     1654     1704      +50     
==========================================
+ Hits         5053     5196     +143     
- Misses       4056     4140      +84     
- Partials      299      324      +25     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 03 '24 19:05 codecov-commenter

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

esphome[bot] avatar Jul 04 '24 23:07 esphome[bot]

Not sure why CI / Component test MCP3428 (pull_request) failed, the file ./tests/test_build_components/build_components_base.esp8266.yaml does exist

mdop avatar Jul 07 '24 13:07 mdop