Skip to content
This repository has been archived by the owner on Jan 18, 2019. It is now read-only.

LED colours don't change smoothly #35

Open
rik-cross opened this issue Oct 17, 2016 · 2 comments
Open

LED colours don't change smoothly #35

rik-cross opened this issue Oct 17, 2016 · 2 comments

Comments

@rik-cross
Copy link

I've written code to change the LED colours between green and red:

https://trinket.io/library/trinkets/7ef273a494

Instead of changing colour smoothly between green and red, the LEDs appear to change from green --> yellow --> orange --> red. Increasing the timer delay between LED changes doesn't help.

I've also tested the code on the Sense HAT itself and the colour change is much more gradual.

@waveform80
Copy link

Hmm, there is something a bit strange about its transition between colours. Here's a little test script that shows the transition statically - which might be useful for comparison with the real HAT:

from sense_hat import SenseHat
import time

hat = SenseHat()
hat.low_light = False
hat.set_pixels([
  [i, 255-i, 0]
  for i in range(0, 256, 4)
  ])

This produces the following with FF 49.0 under Ubuntu:

trinket_colours

And something slightly better, but still a bit "sudden" under Chrome 54.0.2840.59 (again under Ubuntu):

chrome_colours

I should note that the transition will never be entirely smooth because the real HAT uses RGB565 in its framebuffer and the actual hardware only supports 5-bits per pixel (so the green loses a bit at the final stage) but it should be smoother than is currently shown. Although, the fact there's rendering differences between browsers also implies this isn't entirely within Trinket's control.

For comparison, I gave this a quick test on the desktop emulator, with the following result:

screenshot from 2016-10-17 14-41-30

The brightness is completely off for the yellows (the HAT's neo-pixels don't really "do" dark colours so I probably need to throw some more gamma correction into the process somewhere) but otherwise the transition is closer to what's seen on the real HAT (apologies for the poor quality photo - best I could manage with a mobile phone camera):

sense_hat_colours

@eah13
Copy link

eah13 commented Oct 17, 2016

Thanks for the report- definitely looks like a bit of a bug. I'll try to find some time to dive back into blend modes this week. It could be something to do with limitations of the screen blend mode browser implementation or our math could be off somewhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants