rm-hull / luma.led_matrix

Python module to drive LED Matrices & 7-segment displays (MAX7219) and RGB NeoPixels (WS2812 / APA102)
https://luma-led-matrix.readthedocs.io
MIT License
515 stars 159 forks source link

BTF-LIGHTING WS2812B RGB 16x16 support #195

Open jpcaldwell30 opened 5 years ago

jpcaldwell30 commented 5 years ago

Type of Raspberry Pi

Model B Rev 2

Linux Kernel version

Linux raspberrypi 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux

Expected behaviour

I have what I think must be a newer product as support for it seems to be lacking. More information about it can be found here: https://www.amazon.com/gp/product/B01DC0IOCK/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

Basically it is a 16X16 RGB WS2812B (neopixel) matrix. The funny thing about it is that it has the same "scanning" layout as the Unicorn hat. I am trying to get it to work for running the examples in the luma.examples repository and the applicable examples for this library. I tried my best to get it to work by importing the ws2812 device and specifying a matrix upon device initialization.

code I have added to the examples I want to run:

from luma.led_matrix.device import ws2812
......

MY_MATRIX = [   
    255, 254,   253,    252,    251,    250,    249,    248,    247,    246,    245,    244,    243,    242,    241,    240,
    224,    225,    226,    227,    228,    229,    230,    231,    232,    233,    234,    235,    236,    237,    238,    239,
    223,    222,    221,    220,    219,    218,    217,    216,    215,    214,    213,    212,    211,    210,    209,    208,
    192,    193,    194,    195,    196,    197,    198,    199,    200,    201,    202,    203,    204,    205,    206,    207,
    191,    190,    189,    188,    187,    186,    185,    184,    183,    182,    181,    180,    179,    178,    177,    176,
    160,    161,    162,    163,    164,    165,    166,    167,    168,    169,    170,    171,    172,    173,    174,    175,
    159,    158,    157,    156,    155,    154,    153,    152,    151,    150,    149,    148,    147,    146,    145,    144,
    128,    129,    130,    131,    132,    133,    134,    135,    136,    137,    138,    139,    140,    141,    142,    143,
    127,    126,    125,    124,    123,    122,    121,    120,    119,    118,    117,    116,    115,    114,    113,    112,
    96, 97, 98, 99, 100,    101,    102,    103,    104,    105,    106,    107,    108,    109,    110,    111,
    95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
    64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
    63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,
    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
    31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
]

........

device = ws2812(width=16, height=16, mapping=MY_MATRIX)

Actual behaviour

For some of the examples I get an output, however the consistent issue I'm having is that the library seems to think that the display is bigger than it actually is. The reason I think I am getting only some of the examples to work is because for some of them the output is "off" the matrix. As an example in the neomatrix_demo.py from this library, the box never seems to fully fit on the display until it shrinks a bit for a few of the animations. Box_demo.py (also from this library) draws a correct outline but the "hello world" text is cut off ("hel" is shown and the top half of "llo"). The same general sizing issues happen for the examples in the luma.examples library. I also tried adding the above matrix to luma.led_matrix.device under it's own definition and importing it like the one for the Unicorn Hat but when I tried to import it following the unicorn hat instructions it gave an import error. Defining the matrix in the actual example file with the code above works though it just has the sizing issue.

Any ideas? I can provide pictures later if necessary.

thijstriemstra commented 4 years ago

having such a device to test with would be useful, not sure if @rm-hull has time though.