Stop using Red parameter for brightness value
This change corrects using Red parameter of RGBA for the Brightness value, to using the Alpha parameter of RGBA. As the brightness max value for APA102 is `31` the `math.Min` stops the driver from using any value higher than 31.
This commit is contained in:
parent
47eaa1cab9
commit
78ec92af7a
|
@ -1,9 +1,9 @@
|
|||
package spi
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"image/color"
|
||||
"math"
|
||||
)
|
||||
|
||||
// APA102Driver is a driver for the APA102 programmable RGB LEDs
|
||||
|
@ -93,7 +93,7 @@ func (d *APA102Driver) Draw() error {
|
|||
|
||||
for i, c := range d.vals {
|
||||
j := (i + 1) * 4
|
||||
tx[j] = 0xe0 + byte(c.R)
|
||||
tx[j] = 0xe0 + byte(math.Min(c.A, 31))
|
||||
tx[j+1] = byte(c.B)
|
||||
tx[j+2] = byte(c.G)
|
||||
tx[j+3] = byte(c.R)
|
||||
|
|
Loading…
Reference in New Issue