So... who actually uses Graphics.setcolorHSV ?
It feels like a bit of a waste of time to me... I'd really like to remove it and add E.HSBtoRGB instead, that does the hue conversion without relying on graphics. You could then do Graphics.setColor(E.HSBtoRGB(h,s,b)) instead, but if you were trying to do something like cycle hue on some LEDs, you could just use it directly.
I like that idea - is the current method a feature of a standard graphics api you're trying to make it look like?
Does anyone use hsv, for that matter?
No, it was a pull request from someone who thought it'd be handy - I've never seen any API that looks like that ;)
I often use HSV when driving RGB LEDs, but unless you're driving an LED matrix using the Graphics lib, the current solution is less than ideal!
I use it, but i believe the api would change for the better with your planned changes, so no probs.
Only thing, I believe that either I don't understand something, or there are two problems with the current code/docs
1) The docs say that h,s,v should be 0..1, but I found that keeping h within that range only gives blue. Using something between 0 and 360 works a lot better.
2) I tought the resulting color should be hue modulus 360, that is, 361 should be equal to 1, and instead it flashes purple around 361, I can't tell you exactly at what point because I don't have it around now.
So it sounds like not only is SetColorHSV() kinda odd, it also doesn't work as advertised!
Thanks - I'll take a look at that when I do it. Bug here: https://github.com/espruino/Espruino/issues/554
Thanks for saying about the 361 thing. It's probably some <= vs < issue :)
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem