-
Notifications
You must be signed in to change notification settings - Fork 639
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
HSV command is not HSV set #1864
Comments
Can you give an example of expected values? Following the brightness function, it does some other transformations when "useWhite" mode is on. However, basic brightness method will simply multiply each channel by the "current" brightness divided by "max" brightness, resulting in the same values as this conversion shows: espurna/code/espurna/light.ino Line 1212 in 43a44cf
espurna/code/espurna/light.ino Line 117 in 43a44cf
Extracted light.ino algorithm: espurna/code/espurna/light.ino Lines 274 to 276 in 43a44cf
Note about Arduino.h => std::... |
I'm running the latest release, not dev. I fixed the issue by preventing the brightness from being calculated when an HSB command is received. I think if you were to use the maximum Brightness value (100% not I do see that another issue I found has been fixed now, I saw that channels 4 and 5 would be set by brightness if colour was enabled, regardless of white settings. |
Ping. Was #1874 sufficient? |
Sorry Max, I did not have time to load it on any of my devices yet. I will let you know the results when I do, hopefully tonight if not then tomorrow. |
@mcspr it works perfectly! Thank you! Hopefully I'll be able to contribute more next time I find a bug. The new brightness function was over my head in terms of my C++ knowledge. |
Wait a sec. Display value is still wrong tho espurna/code/espurna/light.ino Line 395 in 2478847
The first message, before edit, v is 12700 Let's ignore c++ for now, and look at this purely by what's happening with math part. If r,g,b above are 0...255, should'nt they be divided by 255 (aka VALUE_MAX)? espurna/code/espurna/light.ino Lines 388 to 393 in 2478847
|
Right... so my lighting automation was putting values on Btw I switched off color mode to get around this issue until you or Xose had some time to look into it, that's why commands were going to channels directly. |
Yes, since channel value already has brightness applied, and we want to use percentages instead of raw numbers cc @xoseperez anyway |
And also thank you for the full logs! Because at first I thought it was formatting issue again. Not quite... |
It is possible what I was seeing for V was the channel set command * 100. I can retest for more detailed results tomorrow if you need. Also let me know if you have a branch you want to test before merging. I should be more available for testing this weekend. |
Using Running magichome-led-controller on wemos board, I do see one significant difference. |
Brightness doesn't follow V? |
Yes. Basically, we should not use values without brightness, |
Wouldn't the original arrangement work as long as |
It would, but it was incorrect in other direction :) If target value is multiplied by brightness, we got a different hsv there. Why I focused on web is because colorpicker returns the same value both times, we push back a hsv which it parses properly |
In the other direction? Wouldn't that be |
It would. Loading webui, it receives hsv value via toHSV. Then, we change it via the wheelcolorpicker to something else, and it sends it back. Receiving side applies it via fromHSV and immediatly reports back via toHSV again, causing colorpicker to update. That's where the rounding issue comes from, since it slightly moves one of the sliders. |
Oh I see, WebUI gets its values back from |
Bug description
HSV commands do not apply the H, S, and V in the command.
Steps to reproduce
Send an HSV command to a device with Color enabled.
Expected behavior
HSV set should be the same as the command.
Device information
2.3.0 rev 159542381
1.13.5
Solution
The "Value" of the command is being used as the brightness, then the calculated RGB channel values are scaled by it. This should not be done, as the conversion from HSV to RGB takes the V component into consideration already.
The text was updated successfully, but these errors were encountered: