switched to doubles as channel values
This commit is contained in:
14
ledd.go
14
ledd.go
@@ -188,7 +188,7 @@ func (manager *LEDManager) color(led *LED) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cMap := make(map[int32]int32)
|
cMap := make(map[int32]float64)
|
||||||
|
|
||||||
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)
|
||||||
@@ -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())
|
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[0]] = color.R
|
||||||
cMap[led.Channel[1]] = int32(color.G * float64(backend.resolution))
|
cMap[led.Channel[1]] = color.G
|
||||||
cMap[led.Channel[2]] = int32(color.B * float64(backend.resolution))
|
cMap[led.Channel[2]] = color.B
|
||||||
|
|
||||||
wrapperMsg := &ledd.BackendWrapperMessage{
|
wrapperMsg := &ledd.BackendWrapperMessage{
|
||||||
Msg: &ledd.BackendWrapperMessage_MSetChannel{
|
Msg: &ledd.BackendWrapperMessage_MSetChannel{
|
||||||
@@ -486,7 +486,7 @@ func (manager *ClientManager) receive(client *Client) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
backend.setChannel(msg.MSetDirect.Channel, msg.MSetDirect.Value)
|
backend.setChannel(msg.MSetDirect.Channel, float64(msg.MSetDirect.Value/backend.resolution))
|
||||||
case *ledd.ClientWrapperMessage_MRemoveLed:
|
case *ledd.ClientWrapperMessage_MRemoveLed:
|
||||||
led, ok := ledManager.leds[msg.MRemoveLed.Name]
|
led, ok := ledManager.leds[msg.MRemoveLed.Name]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -517,8 +517,8 @@ func (backend *Backend) niceName() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (backend Backend) setChannel(channel int32, val int32) {
|
func (backend Backend) setChannel(channel int32, val float64) {
|
||||||
cMap := make(map[int32]int32)
|
cMap := make(map[int32]float64)
|
||||||
|
|
||||||
cMap[channel] = val
|
cMap[channel] = val
|
||||||
|
|
||||||
|
2
proto
2
proto
Submodule proto updated: 9a2fd0ad06...3d37eb67b3
Reference in New Issue
Block a user