Skip to content

Conversation

@robert-hh
Copy link
Contributor

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

Check the machine module first, then search in previous places.
@dpgeorge
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.

@robert-hh
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.

@dpgeorge
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.
@dpgeorge
Copy link
Member

dpgeorge commented Nov 8, 2022

Squashed and merged in 0e25b10

@dpgeorge dpgeorge closed this Nov 8, 2022
@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants