MrYsLab / pymata-aio

This is the second generation PyMata client.
https://github.com/MrYsLab/pymata-aio/wiki
GNU Affero General Public License v3.0
155 stars 51 forks source link

set_pin_mode was never awaited for sonar_config #35

Closed thiezn closed 8 years ago

thiezn commented 8 years ago

Hi, sorry if this is not the right way or format to report an issue, I'm a rookie regarding git (and programming for that matter!)

I'm using the pymata3 class to try and initialize my HR-SR04 sensor and get the following warnings:

/usr/local/lib/python3.5/site-packages/pymata_aio/pymata_core.py:1098: RuntimeWarning: coroutine 'PymataCore.set_pin_mode' was never awaited
  self.set_pin_mode(trigger_pin, Constants.SONAR, Constants.INPUT)
/usr/local/lib/python3.5/site-packages/pymata_aio/pymata_core.py:1099: RuntimeWarning: coroutine 'PymataCore.set_pin_mode' was never awaited
  self.set_pin_mode(echo_pin, Constants.SONAR, Constants.INPUT)

Looking at pymata_core.py lines 1098/1099 it seems they are called as a normal function instead of a coroutine. I think these lines should be prepended with await (or yield from on python <=3.4)

Thanks, Thiezn

MrYsLab commented 8 years ago

@thiezn That was a great catch - you are completely correct. I will be updating with the fix for the next release within an hour or so. Thanks again.