added support for color correction

This commit is contained in:
2019-05-05 21:29:12 +02:00
parent 94ce0749c7
commit 5763cbea18
2 changed files with 15 additions and 7 deletions

20
ledd.go
View File

@@ -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 {

2
proto

Submodule proto updated: 3d37eb67b3...bb16464756