dht: Change the sequence for importing dht_readinto.

Check the machine module first, then search in previous places.  This
supports having machine.dht_readinto as the new standard, while still being
backwards compatible.
pull/570/head
robert-hh 2022-10-25 11:41:57 +02:00 zatwierdzone przez Damien George
rodzic 900dd1c61b
commit 0e25b109c2
1 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -2,17 +2,16 @@
# MIT license; Copyright (c) 2016 Damien P. George
import sys
import machine
if sys.platform.startswith("esp"):
from esp import dht_readinto
elif sys.platform == "mimxrt":
from mimxrt import dht_readinto
elif sys.platform == "rp2":
from rp2 import dht_readinto
elif sys.platform == "pyboard":
from pyb import dht_readinto
else:
if hasattr(machine, "dht_readinto"):
from machine import dht_readinto
elif sys.platform.startswith("esp"):
from esp import dht_readinto
else:
dht_readinto = __import__(sys.platform).dht_readinto
del machine
class DHTBase: