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

Initialization error? #69

Open
yeyeto2788 opened this issue Mar 30, 2021 · 4 comments
Open

Initialization error? #69

yeyeto2788 opened this issue Mar 30, 2021 · 4 comments

Comments

@yeyeto2788
Copy link

yeyeto2788 commented Mar 30, 2021

Please take a look at the following snippet (explanation after it):

(venv) pi@raspberrypi:~/mudpi-core $ python
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> import adafruit_dht
>>> dht = None
>>> dht
>>> type(dht)
<class 'NoneType'>
>>> dht = adafruit_dht.DHT11(board.D26)
>>> Unable to set line 26 to input

>>> type(dht)
<class 'adafruit_dht.DHT11'>
>>> dht._use_pulseio
True
>>> dht = adafruit_dht.DHT11(board.D26, use_pulseio=False)
>>> dht._use_pulseio
False
>>> dht.temperature
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/mudpi-core/venv/lib/python3.7/site-packages/adafruit_dht.py", line 243, in temperature
    self.measure()
  File "/home/pi/mudpi-core/venv/lib/python3.7/site-packages/adafruit_dht.py", line 199, in measure
    raise RuntimeError("A full buffer was not returned. Try again.")
RuntimeError: A full buffer was not returned. Try again.
>>>

Expected behavior:
Could not instantiate the DHT object as when setting the use_pluseio to False so behavior is the same and instantiation can be handled the same way.

Issue/Doubt:
Shouldn't the library raise an Exception when (by default) use_pulseio is set to True instead of actually instantiate the DHT11 object?

SBC: Raspberry Pi A+
Libraries:

Adafruit-Blinka==6.4.1
adafruit-circuitpython-dht==3.5.5
Adafruit-PlatformDetect==3.4.1
Adafruit-PureIO==1.1.8

Python: 3.7.3

@jposada202020
Copy link

@yeyeto2788 I read this a couple of days ago, interesting, I will look into this during the weekend, hopefully :) I am doing some other stuff, Also I wanted to test the other issue, so maybe I can do both at the same time but no promises, :)

@jposada202020
Copy link

@yeyeto2788 Do you have a solution in mind, maybe some brainstorming in Discord? let me know. Thanks :)

@yeyeto2788
Copy link
Author

Sure, sorry for the late reply.

My suggestion would be to actually either raise the error so anyone can handle it as one wants (My preferred option) or by just now raising the error but not instantiating any object.

If you want to discuss it further do not hesitate on sending me a DM on Discord.

@jposada202020
Copy link

No problem, wlil do. Thanks

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

No branches or pull requests

2 participants