Color Switch in Z-uno for RGB leds

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
froggy
Posts: 10
Joined: 02 Jan 2019 22:36

Color Switch in Z-uno for RGB leds

Post by froggy »

Hi,

I'm trying to control some RBG leds with Z-uno. I used the ZUNO_SWITCH_COLOR() macro to set-up the channel as in the Reference page. In the controller (Razberry) the color switch is registered properly and I can select a color there. But when I change the RGB color, the Z-Uno setter function is called only once with the flag for the red color (with a value that should be assigned to the blue component). I was expecting this setter function to be called 3 times, one for each of the colors. Should this be working differently?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS »

Make sure to define color components correctly.

You can have a look on our configurator:
https://z-uno.z-wave.me/shield/configur ... C&pin12=NC
froggy
Posts: 10
Joined: 02 Jan 2019 22:36

Re: Color Switch in Z-uno for RGB leds

Post by froggy »

I don't use PWM to control the LEDs. I have WS2811 Led strips. I use this code to get the RGB values from the controller:

ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_COLOR(SWITCH_COLOR_FLAGS_RED|SWITCH_COLOR_FLAGS_GREEN|SWITCH_COLOR_FLAGS_BLUE, getColor, setColor));

void setColor (byte color,byte value){

switch (color){
case SWITCH_COLOR_FLAGS_RED: Serial.println("SetColor red");
red = value;
break;
case SWITCH_COLOR_FLAGS_GREEN: Serial.println("SetColor green");
green = value;
break;
case SWITCH_COLOR_FLAGS_BLUE: Serial.println("SetColor blue");
blue = value;
}


}

byte getColor (byte color){
switch (color){
case SWITCH_COLOR_FLAGS_RED: return red;
case SWITCH_COLOR_FLAGS_GREEN: return green;
case SWITCH_COLOR_FLAGS_BLUE: return blue;
}

As you can see I added some message to the serial monitor to see what happens. The issue is, that when I change the color on the controller, the setColor function is called only once with the red component. It's not called for the blue and green.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS »

We will check this issue. Thank you
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS »

You mixed flags (bitmasks) and constants.

in setter/getter you need to use SWITCH_COLOR_COMPONENT_xxx instead: https://github.com/Z-Wave-Me/Z-Uno-Core ... ons.h#L481
Post Reply