Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AHT20 sensor #68

Merged
merged 7 commits into from
Jan 15, 2024
Merged

Add AHT20 sensor #68

merged 7 commits into from
Jan 15, 2024

Conversation

SoulKa
Copy link
Contributor

@SoulKa SoulKa commented Jan 14, 2024

Implemented the AHT20 environmental sensor using the SenseEnv interface. Implementation is based on this Datasheet. Tested on a RaspberryPi with the AHT20 sensor.

Features:

  • Pure Go, no dependencies
  • Sense() reads a single measurement
  • SenseContinuous() reads measurements with the given interval into a channel (or as fast as possible if it is too small)
  • Halt() stops a continuous measurement
  • Options:
    • A configurable polling interval if the measurement is not finished after 80ms. Defaults to 10ms
    • A configurable measurement read timeout after the initial delay of 80ms. Default is 150ms.
    • Optionally CRC8 data validation of measurements. Default is enabled

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bd7de1d) 61.6% compared to head (d998c15) 61.6%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #68   +/-   ##
=====================================
  Coverage   61.6%   61.6%           
=====================================
  Files         65      65           
  Lines       7442    7442           
=====================================
  Hits        4583    4583           
  Misses      2705    2705           
  Partials     154     154           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@maruel maruel left a comment

Choose a reason for hiding this comment

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

Thanks for the new driver! Please resolve the github actions failure.

aht20/aht20.go Outdated Show resolved Hide resolved
@SoulKa
Copy link
Contributor Author

SoulKa commented Jan 15, 2024

Thanks for the fast reaction on this PR! I resolved your issue and the pipeline issues. Somehow, errors.Join() is not known during build. Is it not built with Go 1.20? At least that's what's written in the go.mod.

Should I add some tests using the bus mock as in bmxx80?

@maruel
Copy link
Member

maruel commented Jan 15, 2024

I try to keep compatibility with older version of Go since it's what is installed via apt-get install and users could be confused.

Copy link
Member

@maruel maruel left a comment

Choose a reason for hiding this comment

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

It's better if you can add tests but I won't require it.

aht20/aht20.go Show resolved Hide resolved
@maruel maruel merged commit e644b7c into periph:main Jan 15, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants