-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Bug] Colors on 3x3 Color Matrix Light on Robot Inventor Hub #619
Comments
Thanks for reporting. It looks like the hue is being truncated to a |
The pb_powered_up_color_id_from_hue() function used uint8_t for the hue argument, but expected values from 0-359, so values > 255 where being truncated. This is fixed by changing the parameter type to uint16_t. Also add doc comments and use macros instead of hard coded constants while we are touching this. Also wikipedia says the name of the hue at 150 deg is teal rather than turquoise (other common names are *something* green, but teal is shorter). Fixes: pybricks/support#619
The pb_powered_up_color_id_from_hue() function used uint8_t for the hue argument, but expected values from 0-359, so values > 255 where being truncated. This is fixed by changing the parameter type to uint16_t. Also add doc comments and use macros instead of hard coded constants while we are touching this. Also wikipedia says the name of the hue at 150 deg is spring green rather than turquoise. https://en.wikipedia.org/wiki/Tertiary_color Fixes: pybricks/support#619
Hi Guys, |
You can always grab the latest firmware from https://github.com/pybricks/pybricks-micropython/actions/workflows/build.yml?query=is%3Asuccess+branch%3Amaster if you don't want to wait for a release. |
Hi, thanks for the input. In meantime I found some info that allows me to use your PUPDevice class to directly set the 3x3 LED Matrix colors. `
`mode 0 = M0 = "LEV O" = level output mode 1 = M1 = "COL O" = color output mode 2 = M2 = "PIX O" = pixel output mode 3 = M3 = "TRANS" = transitions |
It's been a while since I looked at this, but I could not get this to work in the way I had hoped. I was hoping this could fade one set of 9 colors smoothly into the next. But it seems to always fully turn off, and then fade back in after a few seconds. So I ended up using just mode 2 which lets you do (almost) everything manually. Did you find other functionality that we missed? |
Nice! This is usually how we explore sensor functionality when a new device comes out. If you find any interesting features on the other sensors that we don't support, feel free to let us know :) |
Thanks for the comments. One thing I did notice is that the PUPDevice has a read method which returns info on each pixel. Not sure how to decode that yet, but that read back function might be useful for something. I suppose you could set the pixel Colors at one point and then read them back later before making changes, but not sure why one would need that ;0) |
The read method probably doesn't check that the mode is actually receiving data, so what you are seeing is probably leftover data from something else. |
Actually, after playing with this some, I found that the PUPDevice read(2) function, mode=2, returns a useful pixel status tuple. |
Did this issue affect other devices as well, e.g. the Color & Distance Sensor? I had some reliability issues with detecting colors, but since have moved on to custom filtering of the hsv values. |
No, this was a mapping issue from HSV to lego color ids (not the other way around.)
Did you try setting the detectable colors?
This is essentially what the aforementioned method does --- you specify the HSV values of your desired colors and then we find the best match when you try to detect the color. |
Nice work.
It could be interesting to make the weighing factors (or method?) configurable - feel free to start a dedicated discussion about this. |
Yeah I think that would be useful, I'll open an issue about it. |
I am using the 3x3 Color Matrix device on RI Hub.
All the standard colors in documentation work fine except for Violet and Magenta.
Color.VIOLET produces Red light and Color.MAGENTA produces Orange light.
These colors work fine with the color light built into the hub and also the color light on the Lego Remote control.
Thanks
The text was updated successfully, but these errors were encountered: