Skip to content

_set_item() doesn't support integer values #27

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
siddacious opened this issue Sep 19, 2018 · 1 comment
Closed

_set_item() doesn't support integer values #27

siddacious opened this issue Sep 19, 2018 · 1 comment

Comments

@siddacious
Copy link
Contributor

Currently when calling _set_item with an integer value such as one out of FancyLED's color.pack(), or even the example given in the docstring of _set_item, 0xFFFFFF.

Example/repro code:

import adafruit_dotstar
import board

led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
led[0] = 0xFFFFFF
Traceback (most recent call last):
  File "code.py", line 5, in <module>
  File "adafruit_dotstar.py", line 190, in __setitem__
  File "adafruit_dotstar.py", line 160, in _set_item
TypeError: object of type 'int' has no len()

The issue is that the line in question is assuming that value is a tuple when it can be an int, as mentioned in the docstring. I have a fix I can submit as a PR; basically the function will already convert value to a tuple as rgb, we just need to check the length of rgb instead of value.

The same issue is there in the NeoPixel library though I haven't tested it yet. I can create an issue and PR there as well if this one is accepted.

siddacious pushed a commit to siddacious/Adafruit_CircuitPython_DotStar that referenced this issue Sep 19, 2018
siddacious added a commit to siddacious/Adafruit_CircuitPython_DotStar that referenced this issue Sep 19, 2018
@caternuson
Copy link
Contributor

Fixed by #28

mattytrentini pushed a commit to mattytrentini/micropython-dotstar that referenced this issue Jan 4, 2019
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