todbot / blink1-python

Official Python library for blink(1) USB RGB LED notification device
MIT License
35 stars 7 forks source link

Hard-coded gamma-correction, maybe add option? (patterns not written correctly on _old_ blink1) #10

Open cvdwl opened 3 years ago

cvdwl commented 3 years ago

I have a couple of old blink1s I bought, possibly first batch out of beta. Using either the CLI or the python library, I get an issue where writing a pattern doesn't work.

  1. Buffers 12-15 map to 0 (ok, I guess the pattern memory is only 12 deep).
  2. written color values do not correspond to those read. Looks like it's a parabolic transform.

Not really a show-stopper, mostly just curious.

In [65]: for i in range(0,15):
    ...:     b.write_pattern_line(i*50,(i,i*10,i*15),i)
    ...:     print((i,i*10,j+i*15,i*50))
    ...:           
(0, 0, 0, 0)
(1, 10, 15, 50)
(2, 20, 30, 100)
(3, 30, 45, 150)
(4, 40, 60, 200)
(5, 50, 75, 250)
(6, 60, 90, 300)
(7, 70, 105, 350)
(8, 80, 120, 400)
(9, 90, 135, 450)
(10, 100, 150, 500)
(11, 110, 165, 550)
(12, 120, 180, 600)
(13, 130, 195, 650)
(14, 140, 210, 700)
(15, 150, 225, 750)

In [66]: b.read_pattern()
Out[66]: 
[(1, 88, 199, 750),
 (0, 0, 1, 50),
 (0, 2, 4, 100),
 (0, 4, 8, 150),
 (0, 6, 14, 200),
 (0, 10, 22, 250),
 (0, 14, 32, 300),
 (0, 19, 43, 350),
 (0, 25, 56, 400),
 (0, 32, 71, 450),
 (0, 39, 88, 500),
 (0, 47, 107, 550),
 (1, 88, 199, 750),
 (1, 88, 199, 750),
 (1, 88, 199, 750),
 (1, 88, 199, 750)]
todbot commented 3 years ago

Hi @cvdwl,

  1. The original blink(1) only has 12 lines of color pattern memory. If you like, email us at blink1 at thingm.com with your blink(1) serial number and and we can arrange a new blink(1) mk3 to be shipped to you. Thank you for being an original blink(1) customer!

  2. What you are seeing is the built-in gamma-correction of blink1-python to make the perceived LED colors match better what is seen on the screen. In blink1-tool, you can optionally disable gamma-correction on pattern line write, but that option isn't available in blink1-python yet. So I think I'll rename this issue so we can add that option.

cvdwl commented 3 years ago

Thanks, that clarifies things; P(em)M sent. Like I said, more a curiosity thing. I'd understand if these are well past EOL, but they still work.

They do seem to be a little finicky with establishing and releasing connections using the python library; still trying to work that one out. I'll check back in if I can establish a pattern.

(n.b. working with Raspberries and Linux mostly)