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

Ring modulo crash #20

Closed
rowlap opened this issue Oct 27, 2019 · 1 comment
Closed

Ring modulo crash #20

rowlap opened this issue Oct 27, 2019 · 1 comment

Comments

@rowlap
Copy link
Contributor

rowlap commented Oct 27, 2019

Although the ring() and single() library functions allow any integer value for ring_index, the code crashes when passed certain values due to modulo 7, which should be modulo 6 to correspond with the size of the lists in _legs.

Steps to reproduce, creating a wormhole-in-space effect:

$ cat piglow-ring-modulo-bug.py
import piglow

for x in range(20):
    piglow.ring(x, 100)
    piglow.ring(x+1, 0)
    piglow.show()

$ python3 piglow-ring-modulo-bug.py
Traceback (most recent call last):
  File "/home/pi/piglow-ring-modulo-bug.py", line 5, in <module>
    piglow.ring(x+1, 0)
  File "/home/pi/piglow-pristine/piglow/library/piglow.py", line 181, in ring
    _set([_legs[0][ring_index], _legs[1][ring_index], _legs[2][ring_index]], value)
IndexError: list index out of range
@rowlap
Copy link
Contributor Author

rowlap commented Oct 30, 2019

Resolved in PR #21

@rowlap rowlap closed this as completed Oct 30, 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

1 participant