added support for color correction
This commit is contained in:
20
ledd.go
20
ledd.go
@@ -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
2
proto
Submodule proto updated: 3d37eb67b3...bb16464756
Reference in New Issue
Block a user