Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

drivers/sensor/dht: Change the sequence for importing dht_readinto. #557

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

Closed
robert-hh wants to merge 2 commits into micropython:master from robert-hh:drivers_dht

Conversation

@robert-hh
Copy link
Contributor

@robert-hh robert-hh commented Oct 25, 2022

Check the machine module first, then try the port specific places.

Check the machine module first, then search in previous places.
Copy link
Member

I'm not sure what this achieves? One thing it does do is make the code bigger with the additional error message 😄

Probably best to just move all dht_readinto methods on the ports into machine, and then make this module just do from machine import dht_readinto unconditionally.

Copy link
Contributor Author

The intention is legacy, such that the 'new' dht.py works with previous versions of the firmwarem, at least for a while.

Copy link
Member

Oh, I see! Yes that makes sense then.

Probably good to add a comment then, why the older imports are there.

Also, except for the esp case, the port-specific cases can actually be combined to:

dht_readinto = __import__(sys.platform).dht_readinto

As @dpgeorge suggested.
If the import fails, the error message is somewhat cryptic. It says:
`AttributeError: no such attribute`
But that's anyhow only a transitional state of the driver.
Copy link
Member

dpgeorge commented Nov 8, 2022

Squashed and merged in 0e25b10

@robert-hh robert-hh deleted the drivers_dht branch November 8, 2022 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /