You are reading a single comment by @maze1980 and its replies. Click here to read the full conversation.
  • Is there a bug in the souce?

    https://github.com/espruino/Espruino/blo­b/master/libs/neopixel/jswrap_neopixel.c­#L246

    start = _getCycleCount();                        // get start time of this bit
    while (_getCycleCount()-start < t) ;             // busy-wait
    

    The function _getCycleCount() returns ccount with is a counter increasing steady from zero to max, but once max is reached it is set to zero again. In the case if start is set to max (or a value almost max) then _getCycleCount()-start will be always smaller than t.
    I'd say a fix would be to calculate the cycles to transfer a bit, subtract this value from the max ccount giving the compare value for ccount. And if _getCycleCount() is higher than the compare value just output low until _getCycleCount() is zero again. Keeping the output low for the duration of a very short time (a single bit) should not affect the neopixels at all, according to https://wp.josh.com/2014/05/13/ws2812-ne­opixels-are-not-so-finicky-once-you-get-­to-know-them/
    Or any other idea?

About

Avatar for maze1980 @maze1980 started