some more stuffs.

This commit is contained in:
2023-09-06 18:00:18 +02:00
parent 64bb737569
commit 07c9398414
23 changed files with 337 additions and 234 deletions
+13 -10
View File
@@ -3,6 +3,7 @@ package nanoleaf
import (
"encoding/binary"
"git.aiterp.net/lucifer3/server/device"
"git.aiterp.net/lucifer3/server/internal/color"
"time"
)
@@ -141,13 +142,13 @@ var shapeTypeMap = map[int]string{
var shapeIconMap = map[int]string{
0: "triangle",
1: "rhythm",
2: "Square",
1: "triangle",
2: "square",
3: "square",
4: "square",
7: "hexagon",
8: "triangle",
9: "triangle-small",
9: "triangle",
12: "hexagon",
}
@@ -218,14 +219,16 @@ func (p *panel) apply(change device.State, transitionTime time.Time) {
p.Intensity = *change.Intensity
}
if change.Color != nil {
if !p.On {
newColor := [4]byte{0, 0, 0, 0}
if newColor != p.ColorRGBA {
p.update(newColor, transitionTime)
}
}
if change.Color == nil {
change.Color = &color.Color{RGB: &color.RGB{Red: 255, Green: 255, Blue: 255}}
}
if !p.On {
newColor := [4]byte{0, 0, 0, 0}
if newColor != p.ColorRGBA {
p.update(newColor, transitionTime)
}
} else {
rgbColor, ok := change.Color.ToRGB()
if !ok {
newColor := [4]byte{255, 255, 255, 255}