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: 9
Joined: 02 Jan 2019 22:36

Color Switch in Z-uno for RGB leds

Post by froggy » 07 Jan 2019 16:35

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: 5061
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS » 09 Jan 2019 09:04

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: 9
Joined: 02 Jan 2019 22:36

Re: Color Switch in Z-uno for RGB leds

Post by froggy » 09 Jan 2019 14:15

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: 5061
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS » 18 Jan 2019 01:23

We will check this issue. Thank you

User avatar
PoltoS
Posts: 5061
Joined: 26 Jan 2011 19:36

Re: Color Switch in Z-uno for RGB leds

Post by PoltoS » 19 Jan 2019 12:59

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