From f87db3d80ae23f1c5cca274fb9c37fcbc6e7af67 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2017 18:47:53 +0200 Subject: [PATCH] add missing memory allocation for SPI mode (#231) --- ws2811.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ws2811.c b/ws2811.c index 3319bdeb..8fe78045 100644 --- a/ws2811.c +++ b/ws2811.c @@ -806,6 +806,16 @@ static ws2811_return_t spi_init(ws2811_t *ws2811) { channel->strip_type=WS2811_STRIP_RGB; } + + // Set default uncorrected gamma table + if (!channel->gamma) + { + channel->gamma = malloc(sizeof(uint8_t) * 256); + int x; + for(x = 0; x < 256; x++){ + channel->gamma[x] = x; + } + } channel->wshift = (channel->strip_type >> 24) & 0xff; channel->rshift = (channel->strip_type >> 16) & 0xff;