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

2
proto

Submodule proto updated: 3d37eb67b3...bb16464756