Skip to content

Minor: print statements in Example code fail on motor4.throttle #11

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

Closed
larryfast opened this issue Jul 1, 2018 · 3 comments · Fixed by adafruit/Adafruit_CircuitPython_Register#15

Comments

@larryfast
Copy link

In my test environment "motor4.throttle" fails.
examples/dc_motor.py: line 35
print("throttle:", motor4.throttle)
Looks like the getter (@properties) code isn't working as expected

Thanks for maintaining excellent demo code!

My environment:
Adafruit HUZZAH
CircuitPython version: adafruit-circuitpython-feather_huzzah-2.3.1.bin
Bundle: adafruit-circuitpython-bundle-2.3.1-mpy-20180630.zip

Bundle downloaded by ampy ... put lib

@tannewt
Copy link
Member

tannewt commented Jul 2, 2018

How is it failing?

@dhalbert
Copy link
Contributor

dhalbert commented Jul 2, 2018

I traced this down:

>>> motor4.throttle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_motor/motor.py", line 60, in throttle
  File "adafruit_pca9685.py", line 75, in duty_cycle
  File "adafruit_register/i2c_struct_array.py", line 71, in __getitem__
TypeError: function does not take keyword arguments

The problem is actually that struct.unpack_from(format, buffer, offset=0) as implemented in shared-bindings/struct/__init__.c does not allow offset as a keyword argument, even though adafruit_register/i2c_struct_array.py calls it that way:

        return struct.unpack_from(self.format, buf, offset=1)

So this is a CircuitPython bug.

@dhalbert
Copy link
Contributor

dhalbert commented Jul 2, 2018

This needs to be fixed by fixing adafruit/circuitpython#984. Thanks for finding this!

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

Successfully merging a pull request may close this issue.

3 participants