forked from tom-2015/rpi-ws2812-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modifications.txt
48 lines (39 loc) · 1.56 KB
/
modifications.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
If you want to update the jgarff rpi_ws281x code you need to make some changes:
https://github.com/jgarff/rpi_ws281x
//First add in ws2811.h:
int color_size; //3 = RGB, 4 = RGBW
//to ws2811_channel_t;
//change type of ws2811_led_t;
typedef struct
{
uint32_t color;
uint32_t brightness;
}ws2811_led_t;
//change in the reder function of ws2811.c the for loop:
for (i = 0; i < channel->count; i++) // Led
{
const int brightness = scale * (channel->leds[i].brightness & 0xff) + 1;
uint8_t color[] =
{
channel->gamma[(((channel->leds[i].color >> channel->rshift) & 0xff) * brightness) >> 16], // red
channel->gamma[(((channel->leds[i].color >> channel->gshift) & 0xff) * brightness) >> 16], // green
channel->gamma[(((channel->leds[i].color >> channel->bshift) & 0xff) * brightness) >> 16], // blue
channel->gamma[(((channel->leds[i].color >> channel->wshift) & 0xff) * brightness) >> 16], // white
};
uint8_t array_size = 3; // Assume 3 color LEDs, RGB
// If our shift mask includes the highest nibble, then we have 4
// LEDs, RBGW.
if (channel->strip_type & SK6812_SHIFT_WMASK)
{
array_size = 4;
}
//add initialization of the led brightness table in the ws2811_return_t ws2811_init(ws2811_t *ws2811) function:
//add:
for (i=0;i<channel->count;i++) channel->leds[i].brightness=255;
//before:
// Set default uncorrected gamma table
if (!channel->gamma)
{
in readpng.c:readpng_get_image comment:
//if (png_get_gAMA(png_ptr, info_ptr, &gamma))
// png_set_gamma(png_ptr, display_exponent, gamma);