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

Runtime Error in sensor.py as of version 0.5.11 of RPi.GPIO #2

Closed
alaudet opened this issue Feb 20, 2015 · 3 comments
Closed

Runtime Error in sensor.py as of version 0.5.11 of RPi.GPIO #2

alaudet opened this issue Feb 20, 2015 · 3 comments
Labels

Comments

@alaudet
Copy link
Owner

alaudet commented Feb 20, 2015

Upgraded to version 0.5.11 of RPi.GPIO and am receiving the following error when raspisump initiates a reading with sensor.py

Traceback (most recent call last):
File "/usr/local/bin/rsump.py", line 19, in
reading.water_reading()
File "/usr/local/lib/python2.7/dist-packages/raspisump/reading.py", line 36, in water_reading
water_depth = pit_depth - value.distance()
File "/usr/local/lib/python2.7/dist-packages/raspisump/sensor.py", line 32, in distance
GPIO.setup(self.trig_pin, GPIO.OUT)
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

@alaudet alaudet added the bug label Feb 20, 2015
@alaudet
Copy link
Owner Author

alaudet commented Feb 20, 2015

In the meantime you can downgrade to version 0.5.10 as follows

sudo pip uninstall RPi.GPIO
sudo pip install https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.10.tar.gz#md5=f1c67de40bf99e0612d75538b06a2181

alaudet added a commit that referenced this issue Feb 20, 2015
@alaudet
Copy link
Owner Author

alaudet commented Feb 20, 2015

As of version 0.5.11 of RPi.GPIO the GPIO.setmode statement in sensor.py has to be moved inside the 'for loop' in distance(self) method.

This happens because, according to the changelog for version 0.5.11 of RPi.GPIO, the 'GPIO.cleanup() unsets the current pin mode'

So it was getting unset after the first sample was taken.

This will be fixed in version 0.5.3 of Raspi-Sump. In the meantime simply downgrade RPi.GPIO to version 0.5.10 as stated above. Will try to fix by this weekend.

@alaudet
Copy link
Owner Author

alaudet commented Feb 20, 2015

Issue fixed with raspisump version 0.5.3

sudo pip install -U raspisump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant