diff --git a/ledd.go b/ledd.go index 73b8764..6d54818 100644 --- a/ledd.go +++ b/ledd.go @@ -188,7 +188,7 @@ func (manager *LEDManager) color(led *LED) { return } - cMap := make(map[int32]int32) + cMap := make(map[int32]float64) if !color.IsValid() { log.Warningf("[%s] Got invalid HCL->RGB color, clamping!", led.Name) @@ -197,9 +197,9 @@ func (manager *LEDManager) color(led *LED) { log.Debugf("[%s] New color: \x1b[38;2;%d;%d;%dm%s\x1b[0m", led.Name, int(math.Round(color.R*255)), int(math.Round(color.G*255)), int(math.Round(color.B*255)), color.Hex()) - cMap[led.Channel[0]] = int32(color.R * float64(backend.resolution)) - cMap[led.Channel[1]] = int32(color.G * float64(backend.resolution)) - cMap[led.Channel[2]] = int32(color.B * float64(backend.resolution)) + cMap[led.Channel[0]] = color.R + cMap[led.Channel[1]] = color.G + cMap[led.Channel[2]] = color.B wrapperMsg := &ledd.BackendWrapperMessage{ Msg: &ledd.BackendWrapperMessage_MSetChannel{ @@ -486,7 +486,7 @@ func (manager *ClientManager) receive(client *Client) { break } - backend.setChannel(msg.MSetDirect.Channel, msg.MSetDirect.Value) + backend.setChannel(msg.MSetDirect.Channel, float64(msg.MSetDirect.Value/backend.resolution)) case *ledd.ClientWrapperMessage_MRemoveLed: led, ok := ledManager.leds[msg.MRemoveLed.Name] if !ok { @@ -517,8 +517,8 @@ func (backend *Backend) niceName() string { } } -func (backend Backend) setChannel(channel int32, val int32) { - cMap := make(map[int32]int32) +func (backend Backend) setChannel(channel int32, val float64) { + cMap := make(map[int32]float64) cMap[channel] = val diff --git a/proto b/proto index 9a2fd0a..3d37eb6 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 9a2fd0ad06763d65f3cf685f206de8659b7c7096 +Subproject commit 3d37eb67b3f0ba5a411f0e7f50257f27a3d19c48