From eb0a70d87d19301922e8f3d36644034499771810 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 29 Jun 2018 03:13:56 +0200 Subject: [PATCH] added correct clamping --- ledd.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ledd.go b/ledd.go index 45f2a18..e3e1ac7 100644 --- a/ledd.go +++ b/ledd.go @@ -179,9 +179,13 @@ func (manager *LEDManager) color(led *LED) { cMap := make(map[int32]int32) - cMap[led.Channel[0]] = int32(color.Clamped().R * float64(backend.resolution)) - cMap[led.Channel[1]] = int32(color.Clamped().G * float64(backend.resolution)) - cMap[led.Channel[2]] = int32(color.Clamped().B * float64(backend.resolution)) + if !color.IsValid() { + color = color.Clamped() + } + + 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)) wrapperMsg := &ledd.BackendWrapperMessage{ Msg: &ledd.BackendWrapperMessage_MSetChannel{