beyondscreen / node-rpi-ws281x-native

native bindings to drive WS2811 (or WS2812) LED-Controllers on a Raspberry Pi
MIT License
224 stars 101 forks source link

Lower values only update every 16 #73

Open JasXSL opened 6 years ago

JasXSL commented 6 years ago

I'm running an Adafruit Neopixel strip of 120 lights (Should be ws2812), hooked up to a raspberry pi via a 74AHCT125 3.3v to 5v converter. Values on the darker ranges only seem to update every 16 steps. For an example:

Is this an issue of hardware, or am I doing something wrong?

Edit: Might as well post my code:

const ws281x = require('rpi-ws281x-native');
const NUM_LEDS = 120,
    pixelData = new Uint32Array(NUM_LEDS);
ws281x.init(NUM_LEDS); 
let pow = 0;
setInterval(() => {

    pow = (pow+1)%255;
    for( let i =0; i < NUM_LEDS; ++i )
        pixelData[i] = pow;

    ws281x.render(pixelData);

}, 100);
JasXSL commented 6 years ago

I've tested without the 3.3v to 5v converter and I'm getting the same issue. Only every 0x10 will actually update the brightness.

usefulthink commented 6 years ago

in the pre-1.0 version there is gamma-correction in place that might be responsible for this: https://github.com/beyondscreen/node-rpi-ws281x-native/blob/master/lib/ws281x-native.js#L74-L89