From 5763cbea18bdd445861e7d9e2da9d48fc45fea5b Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 5 May 2019 21:29:12 +0200 Subject: [PATCH] added support for color correction --- ledd.go | 20 ++++++++++++++------ proto | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ledd.go b/ledd.go index 6d54818..465bb9c 100644 --- a/ledd.go +++ b/ledd.go @@ -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 { diff --git a/proto b/proto index 3d37eb6..bb16464 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 3d37eb67b3f0ba5a411f0e7f50257f27a3d19c48 +Subproject commit bb16464756d0abb4c147ef8f17eac8064342c2c9