added support for color correction

master
Giovanni Harting 3 years ago
parent 94ce0749c7
commit 5763cbea18
  1. 20
      ledd.go
  2. 2
      proto

@ -77,10 +77,11 @@ type Client struct {
}
type LED struct {
Name string
Channel []int32
Backend string
color chan colorful.Color
Name string
Channel []int32
Correction []float32
Backend string
color chan colorful.Color
}
type LEDManager struct {
@ -189,6 +190,7 @@ func (manager *LEDManager) color(led *LED) {
}
cMap := make(map[int32]float64)
fMap := make(map[int32]float32)
if !color.IsValid() {
log.Warningf("[%s] Got invalid HCL->RGB color, clamping!", led.Name)
@ -201,10 +203,16 @@ func (manager *LEDManager) color(led *LED) {
cMap[led.Channel[1]] = color.G
cMap[led.Channel[2]] = color.B
fMap[led.Channel[0]] = led.Correction[led.Channel[0]]
fMap[led.Channel[1]] = led.Correction[led.Channel[1]]
fMap[led.Channel[2]] = led.Correction[led.Channel[2]]
wrapperMsg := &ledd.BackendWrapperMessage{
Msg: &ledd.BackendWrapperMessage_MSetChannel{
MSetChannel: &ledd.BackendSetChannel{
NewChannelValues: cMap}}}
Values: cMap,
Correction: fMap,
}}}
data, err := proto.Marshal(wrapperMsg)
if err != nil {
@ -525,7 +533,7 @@ func (backend Backend) setChannel(channel int32, val float64) {
wrapperMsg := &ledd.BackendWrapperMessage{
Msg: &ledd.BackendWrapperMessage_MSetChannel{
MSetChannel: &ledd.BackendSetChannel{
NewChannelValues: cMap}}}
Values: cMap}}}
data, err := proto.Marshal(wrapperMsg)
if err != nil {

@ -1 +1 @@
Subproject commit 3d37eb67b3f0ba5a411f0e7f50257f27a3d19c48
Subproject commit bb16464756d0abb4c147ef8f17eac8064342c2c9
Loading…
Cancel
Save