3131URI = uri_helper .uri_from_env (default = 'radio://0/80/2M/E7E7E7E7E7' )
3232
3333
34- class rgbw :
35- def __init__ (self , r : int , g : int , b : int , w : int = 0 ):
34+ class wrgb :
35+ def __init__ (self , w : int , r : int , g : int , b : int ):
36+ self .w = w
3637 self .r = r
3738 self .g = g
3839 self .b = b
39- self .w = w
4040
4141
4242class rgb :
@@ -47,8 +47,8 @@ def __init__(self, r: int, g: int, b: int):
4747 self .b = b - self .w
4848
4949
50- def pack_rgbw (input : rgbw | rgb ) -> int :
51- """Pack RGBW values into uint32 format: 0xWWRRGGBB"""
50+ def pack_wrgb (input : wrgb | rgb ) -> int :
51+ """Pack WRGB values into uint32 format: 0xWWRRGGBB"""
5252 return (input .w << 24 ) | (input .r << 16 ) | (input .g << 8 ) | input .b
5353
5454
@@ -86,24 +86,24 @@ def thermal_status_callback(timestamp, data, logconf):
8686 # Set your desired color here:
8787 # ========================================
8888 # Examples:
89- # color = rgbw( r=255, g=0, b=0, w =0) # Pure red
90- # color = rgbw( r=0, g=255, b=0, w =0) # Pure green
91- # color = rgbw( r=0, g=0, b=255, w=0 ) # Pure blue
92- # color = rgbw( r=0, g=0, b=0, w=255 ) # Pure white LED
93- # color = rgbw( r=255, g=128, b=0, w=50 ) # Orange + white
89+ # color = wrgb(w=0, r=255, g=0, b=0) # Pure red
90+ # color = wrgb(w=0, r=0, g=255, b=0) # Pure green
91+ # color = wrgb(w=0, r=0, g=0, b=255) # Pure blue
92+ # color = wrgb(w=255, r=0, g=0, b=0) # Pure white LED
93+ # color = wrgb(w=50, r=255, g=128, b=0) # Orange + white
9494 # color = rgb(r=255, g=255, b=255) # White (auto W extraction)
9595
96- color = rgbw ( r = 255 , g = 0 , b = 100 , w = 0 )
96+ color = wrgb ( w = 0 , r = 255 , g = 0 , b = 100 )
9797 # ========================================
9898
99- color_uint32 = pack_rgbw (color )
100- cf .param .set_value ('colorled.rgbw8888 ' , color_uint32 )
99+ color_uint32 = pack_wrgb (color )
100+ cf .param .set_value ('colorled.wrgb8888 ' , color_uint32 )
101101 time .sleep (0.01 )
102102 print (f'Setting LED to R={ color .r } , G={ color .g } , B={ color .b } , W={ color .w } ' )
103103 print ('Press Ctrl-C to turn off LED and exit.' )
104104 while True :
105105 time .sleep (0.1 )
106106 except KeyboardInterrupt :
107107 print ('\n Stopping and turning off LED...' )
108- cf .param .set_value ('colorled.rgbw8888 ' , 0 )
108+ cf .param .set_value ('colorled.wrgb8888 ' , 0 )
109109 time .sleep (0.1 )
0 commit comments