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

[BUG] Colorconversion HUE to RGB in the lighting example is broken #27063

Closed
Sickeroni opened this issue Jun 5, 2023 · 0 comments · Fixed by #27065
Closed

[BUG] Colorconversion HUE to RGB in the lighting example is broken #27063

Sickeroni opened this issue Jun 5, 2023 · 0 comments · Fixed by #27065

Comments

@Sickeroni
Copy link
Contributor

Sickeroni commented Jun 5, 2023

Reproduction steps

brief

The code works somehow, but the used used colors are wrong.

Reproduction:

  • compile and test the lighting-example for esp32 (and every other platform using lighting-common's ColorFormat.cpp
    url: examples/lighting-app/lighting-common/src/ColorFormat.cpp

Reason:

The function HsvToRgb() uses following struct as the input:

struct HsvColor_t
{
    uint8_t h;
    uint8_t s;
    uint8_t v;
};

In matter-space it is correct!

The function itself expects not "0-255, 0-255, 0-255" but "0-360, 0-100, 0-100". aka "degree for H, percent for the saturation and value". Therefore the result of the function is not what is wanted.

Bug prevalence

Every time the lighting example is used.

GitHub hash of the SDK that was being used

?

Platform

other

Platform Version(s)

No response

Anything else?

No response

Sickeroni added a commit to Sickeroni/connectedhomeip that referenced this issue Jun 5, 2023
This commit fixes the bug of issue project-chip#27063.
The used code is a copy of `[MATTERROOT]/examples/lighting-app/genio/src/ColorFormat.cpp`
andy31415 pushed a commit that referenced this issue Jun 6, 2023
* Fix color conversion bug lighting-example

This commit fixes the bug of issue #27063.
The used code is a copy of `[MATTERROOT]/examples/lighting-app/genio/src/ColorFormat.cpp`

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <commits@restyled.io>
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

Successfully merging a pull request may close this issue.

1 participant