-
Notifications
You must be signed in to change notification settings - Fork 26
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
SPI-USB Adapter with OPC-N2 example does not work with any python version #70
Comments
The first error showed you haven't installed pyusbiss.
Did you execute `pip install pyusbiss?`
…On Sat, 23 Jun 2018, 00:16 Tony Shu, ***@***.***> wrote:
Related to #69 <#69>, running the
example script for the device using python3 results in
Traceback (most recent call last):
File "reviewTest.py", line 1, in <module>
from usbiss.spi import SPI
ImportError: No module named 'usbiss'
Attempting to use python results in
ERROR:opc:Could not parse the fimrware version from ????????????????????????????????????????????????????????????
Traceback (most recent call last):
File "/home/pi/py-opc/opc/__init__.py", line 77, in __init__
self.firmware['version'] = int(re.findall("\d{3}", infostring)[-1])
IndexError: list index out of range
ERROR:opc:Could not parse the fimrware version from ?
Traceback (most recent call last):
File "/home/pi/py-opc/opc/__init__.py", line 77, in __init__
self.firmware['version'] = int(re.findall("\d{3}", infostring)[-1])
IndexError: list index out of range
WARNING:opc:Data transfer was incomplete
in addition to the device's fan continually running until unplugged.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#70>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIB3VVIpINi6fPQKWpr8he_zooeBCZH6ks5t_XregaJpZM4U0iJK>
.
|
Ah. If you wanted python 3 to work then execute |
Your second issue after executing |
Oh, your traceback does show that you successfully connected to your sensor. Your real problem is the last line in the traceback Line 27 in 8eba6bb
This histogram can have issues because you have to wait a bit between executing histogram. Debugging this problem is difficult because the traceback for the failed attempts pollutes the traceback of other exceptions and so made it hard to see what is the problem. There must be a way to not show the traceback from the failed connection attempts after successful connection. |
@tshu Can you let me know which version of |
Great, so both python2 and python3 work with test-device.py after using pip3 and waiting after USB connection. I will occasionally fail to connect 2-3 times, but it will always run the script in the end. If there can be a note about the wait time in the readme, that would be great. However, referring back to the original problem in this issue of running the example code from the readme, both python2 and python3 will attempt to connect 0-3 times before terminating with `WARNING:opc:Data transfer was incomplete'. Fan remains on. I can still run test-device.py to regain control of the device and have the fans turn off at the end of the script. @dhhagan currently running 1.6.0 |
What is output of the following script (modified from readme)
|
|
@DancingQuanta @tshu It would appear the script/code above is incorrect - it should be |
Opps, I made a name mistake. Some corrections here
|
Getting some garbage outputs. |
Could you replace |
|
Your output shows that it is getting blank data from your sensor. |
That did the trick.
The only necessary sleep is between turnon and the read. The following code works:
@dhhagan These edits can go in the readme examples. |
We probably need to improve |
@DancingQuanta Yea, I tried to avoid doing anything other than wrapping the SPI commands, but it seems that it is causing so much trouble for most users (myself included). I went ahead and added sleeps in the necessary places and will push a bit later on today as I have some free time. |
Can I suggest a decorator to wrap some methods to add sleep to beginning of a method if the method was called in the specified time period since last method called. Like a cool down. We know that a method such as This way the time spent waiting for |
@DancingQuanta I'll go ahead and merge a few PR's and push right now - maybe then take a look and see what you think is best? A decorator would be fine as you suggest - I think I just added a few sleeps. Give me 30 min or so. |
@tshu I've added some notes to the readme. Should be okay now? |
Related to #69, running the example script for the device using
python3
results inAttempting to use
python
results inin addition to the device's fan continually running until unplugged.
The text was updated successfully, but these errors were encountered: