Skip to content

Commit e340b1f

Browse files
committed
Initialize luxception with default color
1 parent 83a21ee commit e340b1f

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

cmd/luxaudio/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func getEffect(f utils.FlagsResult, pinger *utils.Pinger) effects.Effect {
111111
return effects.NewRainbowEffect(f.LedCount, 30)
112112

113113
case "luxception":
114-
return effects.NewLuxceptionEffect(f.LedCount, "0.0.0.0", utils.DefaultPort, pinger)
114+
return effects.NewLuxceptionEffect(f.LedCount, f.Color, "0.0.0.0", utils.DefaultPort, pinger)
115115

116116
default:
117117
log.Fatalf("Unsupported effect: %s", f.Effect)

internal/effects/luxception.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package effects
33
import (
44
"github.com/ivkos/luxaudio/internal/led"
55
"github.com/ivkos/luxaudio/internal/utils"
6+
"image/color"
67
"log"
78
"net"
89
)
@@ -18,7 +19,7 @@ type LuxceptionEffect struct {
1819
pinger *utils.Pinger
1920
}
2021

21-
func NewLuxceptionEffect(ledCount int, host string, port uint16, pinger *utils.Pinger) Effect {
22+
func NewLuxceptionEffect(ledCount int, defaultColor color.RGBA, host string, port uint16, pinger *utils.Pinger) Effect {
2223
e := &LuxceptionEffect{
2324
ledCount: ledCount,
2425
ledData: make([]byte, ledCount*3),
@@ -30,6 +31,12 @@ func NewLuxceptionEffect(ledCount int, host string, port uint16, pinger *utils.P
3031
pinger: pinger,
3132
}
3233

34+
for i := 0; i < ledCount; i++ {
35+
e.colors[i*3+0] = byte(float64(defaultColor.G))
36+
e.colors[i*3+1] = byte(float64(defaultColor.R))
37+
e.colors[i*3+2] = byte(float64(defaultColor.B))
38+
}
39+
3340
go e.listen()
3441

3542
return e

0 commit comments

Comments
 (0)